Use generic test framework for independent matchers test

This commit is contained in:
Elliot Winkler 2014-11-20 12:04:12 -07:00
parent 190007155e
commit ab91bbf123
4 changed files with 16 additions and 16 deletions

View File

@ -2,14 +2,14 @@ require 'acceptance_spec_helper'
describe 'shoulda-matchers has independent matchers' do
context 'specifically delegate_method' do
specify 'and integrates with a Ruby application that uses Minitest' do
specify 'and integrates with a Ruby application that uses the default test framework' do
create_generic_bundler_project
updating_bundle do
add_minitest_to_project
add_shoulda_context_to_project(manually: true)
add_shoulda_matchers_to_project(
test_frameworks: [:minitest],
test_frameworks: [default_test_framework],
manually: true
)
end
@ -35,11 +35,11 @@ describe 'shoulda-matchers has independent matchers' do
end
FILE
write_minitest_test 'test/courier_test.rb' do |test_case_superclass|
write_n_unit_test 'test/courier_test.rb' do |test_case_superclass|
<<-FILE
require "test_helper"
require "courier"
require "post_office"
require 'test_helper'
require 'courier'
require 'post_office'
class CourierTest < #{test_case_superclass}
subject { Courier.new(post_office) }

View File

@ -4,14 +4,6 @@ module AcceptanceTests
module MinitestHelpers
include GemHelpers
def minitest_test_case_superclass
if minitest_version >= 5
'Minitest::Test'
else
'MiniTest::Unit::TestCase'
end
end
def minitest_version
bundle_version_of('minitest')
end

View File

@ -4,6 +4,14 @@ module AcceptanceTests
module NUnitHelpers
include RailsVersionHelpers
def n_unit_test_case_superclass
case default_test_framework
when :test_unit then 'Test::Unit::TestCase'
when :minitest_4 then 'MiniTest::Unit::TestCase'
else 'Minitest::Test'
end
end
def default_test_framework
if rails_version =~ '< 4'
:test_unit

View File

@ -45,8 +45,8 @@ module AcceptanceTests
end
end
def write_minitest_test(path)
contents = yield minitest_test_case_superclass
def write_n_unit_test(path)
contents = yield n_unit_test_case_superclass
write_file(path, contents)
end