One test failing when run in whole test suite

I’ve added several specs as part of a new feature I’m adding. One example tests to make sure that if an option in one field is selected that another field must have data. The test passes when run in it’s feature group or when run singly. However, it fails when run in the full test suite.

I’ve got DatabaseCleaner setup and it’s always seemed to work correctly… here’s the consifuration in spec/support/database_cleaner.rb:

RSpec.configure do |config|
  # From Avdi Grimm: http://devblog.avdi.org/2012/08/31/configuring-database_cleaner-with-rails-rspec-capybara-and-selenium/
  config.before(:suite) do
    DatabaseCleaner.clean_with(:truncation)
  end
  config.before(:each) do
    DatabaseCleaner.strategy = :transaction
  end
  config.before(:each, :js => true) do
    DatabaseCleaner.strategy = :truncation
  end
  config.before(:each) do
    DatabaseCleaner.start
  end
  config.after(:each) do
    DatabaseCleaner.clean
  end
end

I tried taking out the spec that ran just before it in the full deck (215 examples) but that didn’t solve the problem.

Any suggestions as to what else to look for to resolve this? Thanks.

Hi @JESii , can you post the test?

Sure… shoulda done that for starters. It’s in this pastie.

@JESii Nothing’s jumping out at me from the test code. Could you post the failure message too?

Sure…

  1) EeRequisitions 'Other' position request user must provide position comments
     Failure/Error: expect(page).to have_content "Position comments can't be blank"
       expected there to be content "Position comments can't be blank" in "\nxxxxx :\nEmployee Requisitions\n\n\n\nHome\nIncident Rpt\nAuto Accident Rpt\nEmployee Req\nCheck Req\nPurchase Req\nQuote Req\n\nLogged in as: xxx\n\nDisplay Employee Requisition\n\nEe requisition was successfully created.\n\nEdit\n|\nBack\n\n\n\n\n\n\nBasic information about the job position\n\n\n\n* Job Title\n\n\nOTHERTREE CLIMBER\n\n* Dept/Region\n\n\nAD - AdminEB - East BaySB - South BayPN - PeninsulaSC - SacramentoOC - Orange CountySD - San DiegoSR - Santa Rosa\n\n* Reports to:\n\n\nPatrick Smith\n\n\n\nSalary Range:\n\n\n \n\n\n\n\n\n* Start Date:\n\n\n2013-03-01\n\n\n\n\n(YYYY/MM/DD)\n\n\n\n* Position?\n\n\nNEW - New PositionREP - Replacement\n\nName:\n\n\n \n\n\n\n* Position Status\n\n\nFTE - Full TimePTE - Part-timeCNS - ConsultantTMP - Temporary\n\n\n\n\n\nSummary of Position (Describe additional duties & responsibilities)\n\n Position Comments \n\n\nApprovals\n\n\nManager:\n\n\n \n\n\n\n\n\n2nd-Level Manager:\n\n\n \n\n\n\nFor HR use only\n\n\nReq#:\n\n\nEB-0002\n\n\n\n\n\nFilled By:\n\n\n \n\n\n\n\n\nHire Date:\n\n\n \n\n\n\n\n\n\n\n\n\n\nEdit\n|\nBack\n\n\n\n"                                                                                
     # ./spec/features/add_other_job_request_spec.rb:38:in `block (2 levels) in <top (required)>'