ruby on rails 3 - Test fails when run together but passes alone -
i new rspec , testing controllers. happens test passes alone
rspec spec/controllers/controller_name_spec.rb
it passes when run :-
rspec spec
the test fails, same test passed earlier.
what can reason, related scalability of rspec or application specific issue. found same issue integration tests also. rails -v => 3.2.11 ruby -v => 1.9.2p320 rspec-rails version => 2.13.0 rspec version => 2.13.0
eg:-
test case :-
it "should ##something##" plans=plan.pluck(:id) plans.delete(@user.subscription.plan.id) @user.subscription.stripe_customer_token= "cus_1l9m6cicqexzj0" @user.save 'apply_change_account', {:subscription=>{:plan_id=>plans.sample}} flash.now[:success].should_not be_nil response.should redirect_to dashboard_manage_accounts_path end
response error message :-
1) dashboardcontroller dashboard should ##something## failure/error: flash.now[:success].should_not be_nil expected: not nil got: nil # ./spec/controllers/dashboard_controller_spec.rb:119:in `block (2 levels) in <top (required)>'
thanks in advance
try add flash.clear
in before block every test related flash.
this may or may not solve problem, it's essential test flash related item avoid flash object been polluted.
Comments
Post a Comment