来修复它
尝试在Ruby中使用RSPEC,并在Rails项目中使用。从命令行中工作正常,但是在Textmate中cmd-r会在NameError: uninitialized constant RSpec
spec/coffee_spec.rb
:
class Coffee
def ingredients
@ingredients ||= []
end
def add(ingredient)
ingredients << ingredient
end
def price
1.00
end
end
RSpec.describe 'A cup of coffee' do
let(:coffee) { Coffee.new }
it 'costs $1' do
expect(coffee.price).to eq(1.00)
end
context 'with milk' do
before { coffee.add :milk }
it 'costs $1.25' do
expect(coffee.price).to eq(1.25)
end
end
end
我首先尝试从Ruby中的Marston-Dees运行coffee_spec.rb
,并且也有相同的问题,但在Rails Project中也尝试了相同的结果。
我只是对此进行了重新审视,因为它仍然无法正常工作。这次我通过将Textmate PATH
设置为$PATH:/usr/local/bin:/usr/texbin:/opt/local/bin