Displaying 1 result from an estimated 1 matches for "plans_controller_spec".
2012 Nov 12
7
RSpec: controller POST create
...validates :weight, :presence => true
end
The failure message is
1) PlansController POST create with valid params assigns a newly
created plan as @plan
Failure/Error: assigns(:plan).should be_persisted
expected persisted? to return true, got false
# ./spec/controllers/plans_controller_spec.rb:117:in `block (4
levels) in <top (required)>''
If my understanding is correct, be_persisted is testing if the newly
created model instance is properly stored in DB.
I understand that my way is rather opposite: building test methods after
setting actual codes. But first I need t...