minitest-rails 0.3 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -2
- data/LICENSE +1 -1
- data/Manifest.txt +5 -8
- data/README.rdoc +11 -29
- data/Rakefile +3 -3
- data/gemfiles/3.0.gemfile +1 -1
- data/gemfiles/3.0.gemfile.lock +35 -35
- data/gemfiles/3.1.gemfile +1 -1
- data/gemfiles/3.1.gemfile.lock +35 -35
- data/gemfiles/3.2.gemfile +1 -1
- data/gemfiles/3.2.gemfile.lock +39 -38
- data/gemfiles/4.0.gemfile +8 -0
- data/gemfiles/4.0.gemfile.lock +104 -0
- data/lib/generators/mini_test.rb +25 -12
- data/lib/generators/mini_test/controller/templates/controller_test.rb +1 -1
- data/lib/generators/mini_test/helper/templates/helper_test.rb +2 -2
- data/lib/generators/mini_test/install/install_generator.rb +1 -1
- data/lib/generators/mini_test/install/templates/test/minitest_helper.rb +3 -9
- data/lib/generators/mini_test/integration/integration_generator.rb +2 -2
- data/lib/generators/mini_test/integration/templates/integration_spec.rb +2 -2
- data/lib/generators/mini_test/integration/templates/integration_test.rb +1 -1
- data/lib/generators/mini_test/mailer/templates/mailer_test.rb +1 -1
- data/lib/generators/mini_test/model/templates/model_test.rb +1 -1
- data/lib/generators/mini_test/scaffold/templates/controller_test.rb +1 -1
- data/lib/minitest/rails.rb +109 -20
- data/lib/minitest/rails/constant_lookup.rb +41 -44
- data/lib/minitest/rails/tasks/minitest.rake +22 -51
- data/lib/minitest/rails/test_case.rb +93 -0
- data/lib/minitest/rails/testing.rb +39 -0
- data/lib/minitest/rails/version.rb +1 -1
- data/minitest-rails.gemspec +11 -11
- data/tasks/gemfiles.rake +2 -1
- data/tasks/test.rake +6 -0
- data/test/generators/test_controller_generator.rb +10 -39
- data/test/generators/test_helper_generator.rb +8 -35
- data/test/generators/test_install_generator.rb +4 -27
- data/test/generators/test_mailer_generator.rb +5 -29
- data/test/generators/test_model_generator.rb +7 -32
- data/test/generators/test_scaffold_generator.rb +5 -29
- data/test/helper.rb +35 -0
- data/test/rails/action_controller/test_controllers.rb +4 -14
- data/test/rails/action_controller/test_spec_type.rb +3 -7
- data/test/rails/action_dispatch/test_spec_type.rb +16 -11
- data/test/rails/action_mailer/test_mailers.rb +4 -8
- data/test/rails/action_mailer/test_spec_type.rb +3 -8
- data/test/rails/action_view/test_helpers.rb +4 -7
- data/test/rails/action_view/test_spec_type.rb +3 -10
- data/test/rails/active_support/test_spec_type.rb +2 -7
- data/test/rails/test_constant_lookup.rb +2 -5
- data/test/test_sanity.rb +1 -2
- metadata +33 -36
- data/gemfiles/minitest_tu_shim.rb +0 -4
- data/lib/minitest/rails/action_controller.rb +0 -28
- data/lib/minitest/rails/action_dispatch.rb +0 -41
- data/lib/minitest/rails/action_mailer.rb +0 -26
- data/lib/minitest/rails/action_view.rb +0 -23
- data/lib/minitest/rails/active_support.rb +0 -70
- data/lib/minitest/rails/declarative.rb +0 -27
- data/lib/minitest/rails/mochaing.rb +0 -11
@@ -1,23 +0,0 @@
|
|
1
|
-
require "minitest/rails/active_support"
|
2
|
-
require "action_view/test_case"
|
3
|
-
|
4
|
-
module MiniTest
|
5
|
-
module Rails
|
6
|
-
module ActionView
|
7
|
-
class TestCase < MiniTest::Rails::ActiveSupport::TestCase
|
8
|
-
TestController = ::ActionView::TestCase::TestController
|
9
|
-
|
10
|
-
# Use AV::TestCase for the base class for helpers and views
|
11
|
-
register_spec_type(/(Helper|View)( ?Test)?\z/i, self)
|
12
|
-
|
13
|
-
include ::ActionView::TestCase::Behavior
|
14
|
-
|
15
|
-
def self.determine_default_helper_class(name)
|
16
|
-
determine_constant_from_test_name(name) do |constant|
|
17
|
-
Module === constant
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'minitest/spec'
|
2
|
-
|
3
|
-
# I hate this! Be sure you have installed minitest_tu_shim
|
4
|
-
require "test/unit" if RUBY_VERSION < "1.9"
|
5
|
-
|
6
|
-
require 'active_support/testing/setup_and_teardown'
|
7
|
-
require 'active_support/testing/assertions'
|
8
|
-
require 'active_support/testing/deprecation'
|
9
|
-
require 'minitest/rails/declarative'
|
10
|
-
require 'active_support/testing/pending'
|
11
|
-
require 'active_support/testing/isolation'
|
12
|
-
require 'minitest/rails/mochaing'
|
13
|
-
require 'active_support/core_ext/kernel/reporting'
|
14
|
-
|
15
|
-
require "minitest/rails/constant_lookup"
|
16
|
-
module MiniTest
|
17
|
-
module Rails
|
18
|
-
module ActiveSupport
|
19
|
-
class TestCase < ::MiniTest::Spec
|
20
|
-
|
21
|
-
# This is deprecated, but I don't want to change the Rails calls to it.
|
22
|
-
# Keep it here for now, until a better way presents itself...
|
23
|
-
def assert_block msg = nil
|
24
|
-
msg = message(msg) { "Expected block to return true value" }
|
25
|
-
assert yield, msg
|
26
|
-
end
|
27
|
-
|
28
|
-
if defined?(ActiveRecord::Base)
|
29
|
-
# Use AS::TestCase for the base class when describing a model
|
30
|
-
register_spec_type(self) do |desc|
|
31
|
-
desc < ActiveRecord::Base if desc.is_a?(Class)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# For backward compatibility with Test::Unit
|
36
|
-
def build_message(message, template = nil, *args)
|
37
|
-
template = template.gsub('<?>', '<%s>')
|
38
|
-
message || sprintf(template, *args)
|
39
|
-
end
|
40
|
-
|
41
|
-
Assertion = ::MiniTest::Assertion
|
42
|
-
alias_method :method_name, :name if method_defined? :name
|
43
|
-
alias_method :method_name, :__name__ if method_defined? :__name__
|
44
|
-
|
45
|
-
$tags = {}
|
46
|
-
def self.for_tag(tag)
|
47
|
-
yield if $tags[tag]
|
48
|
-
end
|
49
|
-
|
50
|
-
include ::ActiveSupport::Testing::SetupAndTeardown
|
51
|
-
include ::ActiveSupport::Testing::Assertions
|
52
|
-
include ::ActiveSupport::Testing::Deprecation
|
53
|
-
include ::ActiveSupport::Testing::Pending
|
54
|
-
extend Testing::Declarative
|
55
|
-
include MiniTest::Rails::ActiveSupport::Testing::ConstantLookup
|
56
|
-
|
57
|
-
# test/unit backwards compatibility methods
|
58
|
-
alias :assert_raise :assert_raises
|
59
|
-
alias :assert_not_nil :refute_nil
|
60
|
-
alias :assert_not_equal :refute_equal
|
61
|
-
alias :assert_no_match :refute_match
|
62
|
-
alias :assert_not_same :refute_same
|
63
|
-
|
64
|
-
def assert_nothing_raised(*args)
|
65
|
-
yield
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module MiniTest
|
2
|
-
module Rails
|
3
|
-
module ActiveSupport
|
4
|
-
module Testing
|
5
|
-
module Declarative
|
6
|
-
|
7
|
-
# test "verify something" do
|
8
|
-
# ...
|
9
|
-
# end
|
10
|
-
def test(name, &block)
|
11
|
-
test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
|
12
|
-
defined = instance_method(test_name) rescue false
|
13
|
-
raise "#{test_name} is already defined in #{self}" if defined
|
14
|
-
if block_given?
|
15
|
-
define_method(test_name, &block)
|
16
|
-
else
|
17
|
-
define_method(test_name) do
|
18
|
-
flunk "No implementation provided for #{name}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'active_support/testing/mochaing'
|
3
|
-
rescue LoadError
|
4
|
-
begin
|
5
|
-
silence_warnings { require 'mocha' }
|
6
|
-
rescue LoadError
|
7
|
-
# Fake Mocha::ExpectationError so we can rescue it in #run. Bleh.
|
8
|
-
Object.const_set :Mocha, Module.new
|
9
|
-
Mocha.const_set :ExpectationError, Class.new(StandardError)
|
10
|
-
end
|
11
|
-
end
|