您好,感谢您的阅读。这是我的工厂:
FactoryGirl.define do
factory :venue do
sequence(:name) { |n| "ExampleVenue#{n}" }
factory :venue_with_gig do
after_create do |venue|
create(:gig, venue: venue) #I've created a valid gig factory as well
end
end
end
end
场地有_许多演出和演出属于_场地。我在这里所拥有的似乎遵循了此处的思想机器人博客文章中的示例
然而,我运行我的模型规格并由于wrong Number of Arguments (3 for 2) at the
以下操作之前的错误而失败:
需要'spec_helper'
describe Venue do
describe "basic attributes" do
before { @venue = create(:venue_with_gig) }
subject { @venue }
it { should be_valid }
it { should respond_to(:name) }
# it { should respond_to(:address) }
it { should respond_to(:gigs) }
end
describe "with invalid params" do
before { @venue = build(:venue, name: " ") }
subject { @venue }
it { should_not be_valid }
end
end
我已经看它太久了,可以使用一个新的视角。谢谢!