Skip to content

Commit

Permalink
Moving to minitest spec style testing
Browse files Browse the repository at this point in the history
  • Loading branch information
CheezItMan committed May 9, 2017
1 parent 0c7bb56 commit 2dc507e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions test/controllers/pets_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 16 additions & 7 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2dc507e

Please sign in to comment.