我无法通过 rspec 测试
规格/模型/ticket_spec.rb
describe Ticket do
describe "should have associations" do
it { should belong_to(:location) }
重击
1) Ticket should have associations
Failure/Error: it { should belong_to(:location) }
NoMethodError:
undefined method `relations' for #<Class:0x000000076a34a0>
# ./spec/models/ticket_spec.rb:5:in `block (3 levels) in <top (required)>'
模型/ticket.rb
class Ticket < ActiveRecord::Base
...
belongs_to :location
宝石文件
group :test do
...
gem "shoulda"
gem "shoulda-matchers"
end