===
it “should publish a job” do @job = Factory(:job, :available => false)
lambda { @job.publish }.should
change(@job.available).from(false).to(true)
end
error
==
Job Job publish should publish a job
Failure/Error: lambda { @job.publish }.should
change(@job.available).from(false).to(true)
nil is not a symbol
./spec/models/job_spec.rb:128:in `block (3 levels) in <top
(required)>’
Finished in 1.12 seconds
47 examples, 1 failure, 4 pending
In this block:
lambda { @job.publish }.should
change(@job.available).from(false).to(true)
end
try putting the arguments to the change method in curly braces:
lambda { @job.publish }.should
change{@job.available}.from(false).to(true)
end
If you pass the method parameters, which is what it expects with
parantheses, it expects two arguments, the second of which would be
the method name in the form of a symbol, which I think explains the
‘nil is not a symbol’ error you’re getting.