testing - Rails MiniTest 'post' method not found -


i'm receiving following error when try run request specs:

post :: /users/:id/authentications request::successful request#test_0001_adds authentication record user: nomethoderror: undefined method `post' #<#<class:0x007fa607163028>:0x007fa6070012c0>   test/requests/authentications_test.rb:9:in `block (3 levels) in <main>' 

here's test itself:

require "minitest_helper"  describe "post :: /users/:id/authentications request"   describe "successful request"     "adds authentication record user"       user = create_user        post user_authentications_path(user)        response.status.must_equal "200"     end   end end 

here's minitest_helper.rb file:

env["rails_env"] = "test" require file.expand_path("../../config/environment", __file__) require "rails/test_help" require "minitest/autorun" require "minitest/rails" require "minitest/rails/capybara"  dir[rails.root.join("test/support/**/*.rb")].each {|f| require f}  class activesupport::testcase end  # database cleaner databasecleaner.strategy = :transaction  class minitest::spec   before :each     databasecleaner.start   end    after :each     databasecleaner.clean   end end  class requesttest < minitest::spec   include rails.application.routes.url_helpers    register_spec_type(/request$/, self) end 

relevant versions of things: rails: 3.2.13 minitest-rails: 0.9.2 minitest-rails-capybara: 0.9.0

it doesn't make sense can't call post. looks every other example out web can fine.

any appreciated.

you have lot going on in test helper. seems have copied several different approaches running minitest in rails tests. suggest following:

remove following test helper:

# database cleaner databasecleaner.strategy = :transaction  class minitest::spec   before :each     databasecleaner.start   end    after :each     databasecleaner.clean   end end  class requesttest < minitest::spec   include rails.application.routes.url_helpers    register_spec_type(/request$/, self) end 

add following test helper:

class actiondispatch::integrationtest   # register "request" tests handled integrationtest   register_spec_type(/request( ?test)?\z/i, self) end 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -