Friday, 23 August 2013

Rspec/FactoryGirl: NoMethodError: undefined method 'description' for true:TrueClass

Rspec/FactoryGirl: NoMethodError: undefined method 'description' for
true:TrueClass

exchange communidad. I am trying to write a feature test for my RoR
program, but am getting the following error when I run rspec:
Failure/Error: page.should have_content entry.description
NoMethodError:
undefined method `description' for true:TrueClass
Here is the context in which the error is being thrown:
entries.each do |entry|
page.should have_content entry.description
end
where entries is defined earlier in the same test as follows:
entries = 5.times.map do
FactoryGirl.create(:entry, project_id: proj.id, :date => 9/10/13,
:type_of_work => 'chump', :description => 'chumpin',
:phase => 'Draft', :status => 'Draft' ,
:on_off_site => 'off', :user_id => 1, :start_time
=> now,
:end_time => later).should be_valid
end
Entry is a model which has an attribute of type string called description
which is what I am testing against and what is returning the
true:TrueClass nonsense.
Any leads? Thank you kindly!

No comments:

Post a Comment