It fails with `get` as well.
I have a fresh Rails app installed with minitest-rails
Rails: 3.2.13
minitest-rails: 0.9.2
minitest-rails-capybara: 0.9.0
minitest: 4.7.4
I've followed all the install instructions and everything works except when I try to do "get" or "post" calls to the app's resources. I've seen those methods in other apps, so I figure I'm doing something wrong.
Here's the error I'm seeing:
POST :: /users/:id/authentications request::successful request#test_0001_Adds an authentication record to a user:
NoMethodError: undefined method `post' for #<#<Class:0x007fa607163028>:0x007fa6070012c0>
test/requests/authentications_test.rb:9:in `block (3 levels) in <main>'
Here's my test_helper:
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 do
DatabaseCleaner.start
end
after :each do
DatabaseCleaner.clean
end
end
class RequestTest < MiniTest::Spec
include Rails.application.routes.url_helpers
register_spec_type(/request$/, self)
end
and Here's the test:
require "minitest_helper"
describe "POST :: /users/:id/authentications request" do
describe "successful request" do
it "Adds an authentication record to a user" do
user = create_user
post user_authentications_path(user)
response.status.must_equal "200"
end
end
end
I really want to use MiniTest instead of RSpec, but this has happened to me every time I try to switch over to MiniTest.
Thanks