ruby on rails - Rspec controller test does not hit my controller action -


i added import method controller, , works fine when test manually website, failing in rspec. here test looks like:

require 'spec_helper'  describe propertiescontroller   let!(:user) { factorygirl.create(:user) }    before :each     sign_in user   end    describe "should upload user properties"     before       post :import, spreadsheet: fixture_file_upload("/files/property_upload_template.xlsx")     end      "should have created records"       expect(property.count).to eq 3       # other assertions     end   end end 

when add puts statements inside import action, including on first line, none of them apparently invoked. test generating no errors other failing assertions. similarly, when @ test.log file, happens creation of test user (and devise confirmation email gets sent out), doesn't appear import action ever hit. test server seems recognize route fine, it's not executing action.

is there wrong test configuration?

i had been banging head couple hours, figured out. needed confirm user in user factory. guess since enabled confirmable module in devise, , user wasn't confirmed, silently not allowing me authenticate...

... sure nice if rspec/rails/devise generated sort of error pointing me problem here.

for sake of completeness, i'm adding in code confirming user in version of factorygirl @ time of writing:

factorygirl.define   factory :confirmed_user, :parent => :user     after(:create) { |user| user.confirm! }   end end 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -