diff --git a/config/application.rb b/config/application.rb index d298afe..61a1adb 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,5 +11,8 @@ class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. + config.generators do |g| + g.test_framework :minitest, spec: true + end end end diff --git a/config/routes.rb b/config/routes.rb index 89a5260..a328ad6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html get "pets", to: "pets#index", as: "pets" + get "pet/:id", to: "pets#show", as: "pet" end diff --git a/test/controllers/pets_controller_test.rb b/test/controllers/pets_controller_test.rb index ccd3833..0f4beea 100644 --- a/test/controllers/pets_controller_test.rb +++ b/test/controllers/pets_controller_test.rb @@ -40,6 +40,10 @@ class PetsControllerTest < ActionDispatch::IntegrationTest describe "show" do # This bit is up to you! + it "can get a pet" do + get pet_path(pets(:two).id) + must_respond_with :success + end end describe "create" do diff --git a/test/test_helper.rb b/test/test_helper.rb index 63ee0ce..c87c2c0 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,13 +1,22 @@ -ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../../config/environment', __FILE__) -require 'rails/test_help' +ENV["RAILS_ENV"] = "test" +require File.expand_path("../../config/environment", __FILE__) +require "rails/test_help" +require "minitest/rails" + +Minitest::Reporters.use!( + Minitest::Reporters::SpecReporter.new, + ENV, + Minitest.backtrace_filter +) +# To add Capybara feature tests add `gem "minitest-rails-capybara"` +# to the test group in the Gemfile and uncomment the following: +# require "minitest/rails/capybara" + +# Uncomment for awesome colorful output +# require "minitest/pride" class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all - - # Use Minitest Reporters for colored output. - Minitest::Reporters.use! - # Add more helper methods to be used by all tests here... end