minitest-rails 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -2
- data/CHANGELOG.rdoc +11 -0
- data/Manifest.txt +11 -5
- data/Rakefile +3 -1
- data/gemfiles/3.0.gemfile +0 -1
- data/gemfiles/3.0.gemfile.lock +31 -32
- data/gemfiles/3.1.gemfile +0 -1
- data/gemfiles/3.1.gemfile.lock +34 -35
- data/gemfiles/3.2.gemfile +0 -1
- data/gemfiles/3.2.gemfile.lock +36 -37
- data/lib/autotest/minitest_rails.rb +2 -1
- data/lib/generators/mini_test/scaffold/scaffold_generator.rb +15 -0
- data/lib/generators/mini_test/scaffold/templates/controller_spec.rb +6 -6
- data/lib/generators/mini_test/scaffold/templates/controller_test.rb +6 -6
- data/lib/minitest-rails.rb +1 -1
- data/lib/minitest/rails/action_controller.rb +3 -36
- data/lib/minitest/rails/action_dispatch.rb +6 -1
- data/lib/minitest/rails/action_mailer.rb +8 -1
- data/lib/minitest/rails/action_view.rb +8 -5
- data/lib/minitest/rails/active_support.rb +2 -0
- data/lib/minitest/rails/constant_lookup.rb +57 -0
- data/lib/minitest/rails/version.rb +5 -0
- data/minitest-rails.gemspec +11 -11
- data/tasks/gemfiles.rake +23 -0
- data/tasks/test.rake +20 -0
- data/test/rails/{test_action_dispatch_spec_type.rb → action_dispatch/test_spec_type.rb} +0 -0
- data/test/rails/action_mailer/test_mailers.rb +113 -0
- data/test/rails/{test_action_mailer_spec_type.rb → action_mailer/test_spec_type.rb} +0 -0
- data/test/rails/action_view/test_helpers.rb +76 -0
- data/test/rails/{test_action_view_spec_type.rb → action_view/test_spec_type.rb} +0 -0
- data/test/rails/{test_active_support_spec_type.rb → active_support/test_spec_type.rb} +0 -0
- data/test/rails/test_constant_lookup.rb +61 -0
- metadata +25 -17
- data/test/rails/action_controller/test_controller_lookup.rb +0 -49
@@ -10,6 +10,8 @@ module MiniTest
|
|
10
10
|
|
11
11
|
check_class_collision :suffix => "ControllerTest"
|
12
12
|
|
13
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
14
|
+
|
13
15
|
def create_test_files
|
14
16
|
if options[:spec]
|
15
17
|
template "controller_spec.rb",
|
@@ -23,6 +25,19 @@ module MiniTest
|
|
23
25
|
"#{controller_file_name}_controller_test.rb")
|
24
26
|
end
|
25
27
|
end
|
28
|
+
|
29
|
+
def accessible_attributes
|
30
|
+
attributes.reject(&:reference?)
|
31
|
+
end
|
32
|
+
|
33
|
+
def attributes_hash
|
34
|
+
return if accessible_attributes.empty?
|
35
|
+
|
36
|
+
accessible_attributes.map do |a|
|
37
|
+
name = a.name
|
38
|
+
key_value name, "@#{singular_table_name}.#{name}"
|
39
|
+
end.sort.join(', ')
|
40
|
+
end
|
26
41
|
end
|
27
42
|
end
|
28
43
|
end
|
@@ -4,7 +4,7 @@ require "minitest_helper"
|
|
4
4
|
describe <%= controller_class_name %>Controller do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@<%= singular_table_name %> = <%=
|
7
|
+
@<%= singular_table_name %> = <%= table_name %>(:one)
|
8
8
|
end
|
9
9
|
|
10
10
|
it "must get index" do
|
@@ -20,30 +20,30 @@ describe <%= controller_class_name %>Controller do
|
|
20
20
|
|
21
21
|
it "must create <%= singular_table_name %>" do
|
22
22
|
assert_difference('<%= class_name %>.count') do
|
23
|
-
post :create, <%=
|
23
|
+
post :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
24
24
|
end
|
25
25
|
|
26
26
|
assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
|
27
27
|
end
|
28
28
|
|
29
29
|
it "must show <%= singular_table_name %>" do
|
30
|
-
get :show, <%= key_value :id, "@#{singular_table_name}
|
30
|
+
get :show, <%= key_value :id, "@#{singular_table_name}" %>
|
31
31
|
assert_response :success
|
32
32
|
end
|
33
33
|
|
34
34
|
it "must get edit" do
|
35
|
-
get :edit, <%= key_value :id, "@#{singular_table_name}
|
35
|
+
get :edit, <%= key_value :id, "@#{singular_table_name}" %>
|
36
36
|
assert_response :success
|
37
37
|
end
|
38
38
|
|
39
39
|
it "must update <%= singular_table_name %>" do
|
40
|
-
put :update, <%= key_value :id, "@#{singular_table_name}
|
40
|
+
put :update, <%= key_value :id, "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
41
41
|
assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
|
42
42
|
end
|
43
43
|
|
44
44
|
it "must destroy <%= singular_table_name %>" do
|
45
45
|
assert_difference('<%= class_name %>.count', -1) do
|
46
|
-
delete :destroy, <%= key_value :id, "@#{singular_table_name}
|
46
|
+
delete :destroy, <%= key_value :id, "@#{singular_table_name}" %>
|
47
47
|
end
|
48
48
|
|
49
49
|
assert_redirected_to <%= index_helper %>_path
|
@@ -4,7 +4,7 @@ require "minitest_helper"
|
|
4
4
|
class <%= controller_class_name %>ControllerTest < MiniTest::Rails::ActionController::TestCase
|
5
5
|
|
6
6
|
before do
|
7
|
-
@<%= singular_table_name %> = <%=
|
7
|
+
@<%= singular_table_name %> = <%= table_name %>(:one)
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_index
|
@@ -20,30 +20,30 @@ class <%= controller_class_name %>ControllerTest < MiniTest::Rails::ActionContro
|
|
20
20
|
|
21
21
|
def test_create
|
22
22
|
assert_difference('<%= class_name %>.count') do
|
23
|
-
post :create, <%=
|
23
|
+
post :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
24
24
|
end
|
25
25
|
|
26
26
|
assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_show
|
30
|
-
get :show, <%= key_value :id, "@#{singular_table_name}
|
30
|
+
get :show, <%= key_value :id, "@#{singular_table_name}" %>
|
31
31
|
assert_response :success
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_edit
|
35
|
-
get :edit, <%= key_value :id, "@#{singular_table_name}
|
35
|
+
get :edit, <%= key_value :id, "@#{singular_table_name}" %>
|
36
36
|
assert_response :success
|
37
37
|
end
|
38
38
|
|
39
39
|
def test_update
|
40
|
-
put :update, <%= key_value :id, "@#{singular_table_name}
|
40
|
+
put :update, <%= key_value :id, "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
41
41
|
assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_destroy
|
45
45
|
assert_difference('<%= class_name %>.count', -1) do
|
46
|
-
delete :destroy, <%= key_value :id, "@#{singular_table_name}
|
46
|
+
delete :destroy, <%= key_value :id, "@#{singular_table_name}" %>
|
47
47
|
end
|
48
48
|
|
49
49
|
assert_redirected_to <%= index_helper %>_path
|
data/lib/minitest-rails.rb
CHANGED
@@ -16,43 +16,10 @@ module MiniTest
|
|
16
16
|
include ::ActionController::TestCase::Behavior
|
17
17
|
|
18
18
|
def self.determine_default_controller_class(name)
|
19
|
-
|
20
|
-
|
21
|
-
# describe WidgetsController do
|
22
|
-
# describe "index" do
|
23
|
-
# it "is successful" do
|
24
|
-
# assert_response :success
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
# end
|
28
|
-
#
|
29
|
-
# Original implementation:
|
30
|
-
# name.sub(/Test$/, '').safe_constantize
|
31
|
-
# safe_constantize is not supported in Rails 3.0...
|
32
|
-
ControllerLookup.find name
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
module ControllerLookup
|
37
|
-
def self.find controller
|
38
|
-
# HACK: I don't love this implementation
|
39
|
-
# Please suggest a better one!
|
40
|
-
names = controller.split "::"
|
41
|
-
controller = while names.size > 0 do
|
42
|
-
# Remove "Test" if present
|
43
|
-
names.last.sub! /Test$/, ''
|
44
|
-
begin
|
45
|
-
constant = names.join("::").constantize
|
46
|
-
break(constant) if constant
|
47
|
-
rescue NameError
|
48
|
-
# do nothing
|
49
|
-
ensure
|
50
|
-
names.pop
|
51
|
-
end
|
52
|
-
end
|
53
|
-
if controller.nil?
|
54
|
-
raise ::NameError.new("Unable to resolve controller for #{name}")
|
19
|
+
controller = determine_constant_from_test_name(name) do |constant|
|
20
|
+
Class === constant && constant < ::ActionController::Metal
|
55
21
|
end
|
22
|
+
raise ::NameError.new("Unable to resolve controller for #{name}") if controller.nil?
|
56
23
|
controller
|
57
24
|
end
|
58
25
|
end
|
@@ -16,7 +16,7 @@ module MiniTest
|
|
16
16
|
def self.app
|
17
17
|
# DEPRECATE Rails application fallback
|
18
18
|
# This should be set by the initializer
|
19
|
-
@@app || (defined?(Rails.application) && Rails.application) || nil
|
19
|
+
@@app || (defined?(::Rails.application) && ::Rails.application) || nil
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.app=(app)
|
@@ -26,6 +26,11 @@ module MiniTest
|
|
26
26
|
def app
|
27
27
|
super || ::ActionDispatch::IntegrationTest.app
|
28
28
|
end
|
29
|
+
|
30
|
+
def url_options
|
31
|
+
reset! unless integration_session
|
32
|
+
integration_session.url_options
|
33
|
+
end
|
29
34
|
|
30
35
|
# Register by name
|
31
36
|
register_spec_type(/Acceptance ?Test\z/i, self)
|
@@ -9,10 +9,17 @@ module MiniTest
|
|
9
9
|
register_spec_type(self) do |desc|
|
10
10
|
desc < ::ActionMailer::Base if desc.is_a?(Class)
|
11
11
|
end
|
12
|
-
|
13
12
|
register_spec_type(/Mailer( ?Test)?\z/i, self)
|
14
13
|
|
15
14
|
include ::ActionMailer::TestCase::Behavior
|
15
|
+
|
16
|
+
def self.determine_default_mailer(name)
|
17
|
+
mailer = determine_constant_from_test_name(name) do |constant|
|
18
|
+
Class === constant && constant < ::ActionMailer::Base
|
19
|
+
end
|
20
|
+
raise ::ActionMailer::NonInferrableMailerError.new(name) if mailer.nil?
|
21
|
+
mailer
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
@@ -7,13 +7,16 @@ module MiniTest
|
|
7
7
|
class TestCase < MiniTest::Rails::ActiveSupport::TestCase
|
8
8
|
TestController = ::ActionView::TestCase::TestController
|
9
9
|
|
10
|
-
#
|
11
|
-
register_spec_type(/Helper( ?Test)?\z/i, self)
|
12
|
-
|
13
|
-
# View specs
|
14
|
-
register_spec_type(/View( ?Test)?\z/i, self)
|
10
|
+
# Use AV::TestCase for the base class for helpers and views
|
11
|
+
register_spec_type(/(Helper|View)( ?Test)?\z/i, self)
|
15
12
|
|
16
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
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|
@@ -12,6 +12,7 @@ require 'active_support/testing/isolation'
|
|
12
12
|
require 'minitest/rails/mochaing'
|
13
13
|
require 'active_support/core_ext/kernel/reporting'
|
14
14
|
|
15
|
+
require "minitest/rails/constant_lookup"
|
15
16
|
module MiniTest
|
16
17
|
module Rails
|
17
18
|
module ActiveSupport
|
@@ -51,6 +52,7 @@ module MiniTest
|
|
51
52
|
include ::ActiveSupport::Testing::Deprecation
|
52
53
|
include ::ActiveSupport::Testing::Pending
|
53
54
|
extend Testing::Declarative
|
55
|
+
include MiniTest::Rails::ActiveSupport::Testing::ConstantLookup
|
54
56
|
|
55
57
|
# test/unit backwards compatibility methods
|
56
58
|
alias :assert_raise :assert_raises
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
3
|
+
module MiniTest
|
4
|
+
module Rails
|
5
|
+
module ActiveSupport
|
6
|
+
module Testing
|
7
|
+
# Resolves a constant from a minitest spec name.
|
8
|
+
#
|
9
|
+
# Given the following spec-style test:
|
10
|
+
#
|
11
|
+
# describe WidgetsController, :index do
|
12
|
+
# describe "authenticated user" do
|
13
|
+
# describe "returns widgets" do
|
14
|
+
# it "has a controller that exists" do
|
15
|
+
# assert_kind_of WidgetsController, @controller
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# The test will have the following name:
|
22
|
+
#
|
23
|
+
# "WidgetsController::index::authenticated user::returns widgets"
|
24
|
+
#
|
25
|
+
# The constant WidgetsController can be resolved from the name.
|
26
|
+
# The following code will resolve the constant:
|
27
|
+
#
|
28
|
+
# controller = determine_constant_from_test_name(name) do |constant|
|
29
|
+
# Class === constant && constant < ::ActionController::Metal
|
30
|
+
# end
|
31
|
+
module ConstantLookup
|
32
|
+
extend ::ActiveSupport::Concern
|
33
|
+
|
34
|
+
module ClassMethods
|
35
|
+
def determine_constant_from_test_name(test_name)
|
36
|
+
names = test_name.split "::"
|
37
|
+
while names.size > 0 do
|
38
|
+
names.last.sub! /Test$/, ""
|
39
|
+
# Rails 3.0 doesn't have safe_constantize,
|
40
|
+
# so we'll do it the hard way.
|
41
|
+
begin
|
42
|
+
constant = names.join("::").constantize
|
43
|
+
break(constant) if yield(constant)
|
44
|
+
rescue NameError
|
45
|
+
# Constant wasn't found, move on
|
46
|
+
ensure
|
47
|
+
names.pop
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/minitest-rails.gemspec
CHANGED
@@ -2,44 +2,44 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "minitest-rails"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.3.20121102170159"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Mike Moore"]
|
9
|
-
s.date = "2012-
|
9
|
+
s.date = "2012-11-02"
|
10
10
|
s.description = "Adds MiniTest as the default testing library in Rails 3.x"
|
11
11
|
s.email = ["mike@blowmage.com"]
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc"]
|
13
|
-
s.files = [".autotest", ".gemtest", ".travis.yml", "CHANGELOG.rdoc", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "gemfiles/3.0.gemfile", "gemfiles/3.0.gemfile.lock", "gemfiles/3.1.gemfile", "gemfiles/3.1.gemfile.lock", "gemfiles/3.2.gemfile", "gemfiles/3.2.gemfile.lock", "gemfiles/minitest_tu_shim.rb", "lib/autotest/discover.rb", "lib/autotest/fixtures.rb", "lib/autotest/migrate.rb", "lib/autotest/minitest_rails.rb", "lib/generators/mini_test.rb", "lib/generators/mini_test/controller/controller_generator.rb", "lib/generators/mini_test/controller/templates/controller_spec.rb", "lib/generators/mini_test/controller/templates/controller_test.rb", "lib/generators/mini_test/helper/helper_generator.rb", "lib/generators/mini_test/helper/templates/helper_spec.rb", "lib/generators/mini_test/helper/templates/helper_test.rb", "lib/generators/mini_test/install/install_generator.rb", "lib/generators/mini_test/install/templates/test/minitest_helper.rb", "lib/generators/mini_test/integration/integration_generator.rb", "lib/generators/mini_test/integration/templates/integration_spec.rb", "lib/generators/mini_test/integration/templates/integration_test.rb", "lib/generators/mini_test/mailer/mailer_generator.rb", "lib/generators/mini_test/mailer/templates/mailer_spec.rb", "lib/generators/mini_test/mailer/templates/mailer_test.rb", "lib/generators/mini_test/model/model_generator.rb", "lib/generators/mini_test/model/templates/fixtures.yml", "lib/generators/mini_test/model/templates/model_spec.rb", "lib/generators/mini_test/model/templates/model_test.rb", "lib/generators/mini_test/scaffold/scaffold_generator.rb", "lib/generators/mini_test/scaffold/templates/controller_spec.rb", "lib/generators/mini_test/scaffold/templates/controller_test.rb", "lib/minitest-rails.rb", "lib/minitest/rails.rb", "lib/minitest/rails/action_controller.rb", "lib/minitest/rails/action_dispatch.rb", "lib/minitest/rails/action_mailer.rb", "lib/minitest/rails/action_view.rb", "lib/minitest/rails/active_support.rb", "lib/minitest/rails/declarative.rb", "lib/minitest/rails/mochaing.rb", "lib/minitest/rails/tasks/minitest.rake", "lib/minitest/rails/tasks/sub_test_task.rb", "minitest-rails.gemspec", "test/generators/test_controller_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_scaffold_generator.rb", "test/rails/action_controller/
|
13
|
+
s.files = [".autotest", ".gemtest", ".travis.yml", "CHANGELOG.rdoc", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "gemfiles/3.0.gemfile", "gemfiles/3.0.gemfile.lock", "gemfiles/3.1.gemfile", "gemfiles/3.1.gemfile.lock", "gemfiles/3.2.gemfile", "gemfiles/3.2.gemfile.lock", "gemfiles/minitest_tu_shim.rb", "lib/autotest/discover.rb", "lib/autotest/fixtures.rb", "lib/autotest/migrate.rb", "lib/autotest/minitest_rails.rb", "lib/generators/mini_test.rb", "lib/generators/mini_test/controller/controller_generator.rb", "lib/generators/mini_test/controller/templates/controller_spec.rb", "lib/generators/mini_test/controller/templates/controller_test.rb", "lib/generators/mini_test/helper/helper_generator.rb", "lib/generators/mini_test/helper/templates/helper_spec.rb", "lib/generators/mini_test/helper/templates/helper_test.rb", "lib/generators/mini_test/install/install_generator.rb", "lib/generators/mini_test/install/templates/test/minitest_helper.rb", "lib/generators/mini_test/integration/integration_generator.rb", "lib/generators/mini_test/integration/templates/integration_spec.rb", "lib/generators/mini_test/integration/templates/integration_test.rb", "lib/generators/mini_test/mailer/mailer_generator.rb", "lib/generators/mini_test/mailer/templates/mailer_spec.rb", "lib/generators/mini_test/mailer/templates/mailer_test.rb", "lib/generators/mini_test/model/model_generator.rb", "lib/generators/mini_test/model/templates/fixtures.yml", "lib/generators/mini_test/model/templates/model_spec.rb", "lib/generators/mini_test/model/templates/model_test.rb", "lib/generators/mini_test/scaffold/scaffold_generator.rb", "lib/generators/mini_test/scaffold/templates/controller_spec.rb", "lib/generators/mini_test/scaffold/templates/controller_test.rb", "lib/minitest-rails.rb", "lib/minitest/rails.rb", "lib/minitest/rails/action_controller.rb", "lib/minitest/rails/action_dispatch.rb", "lib/minitest/rails/action_mailer.rb", "lib/minitest/rails/action_view.rb", "lib/minitest/rails/active_support.rb", "lib/minitest/rails/constant_lookup.rb", "lib/minitest/rails/declarative.rb", "lib/minitest/rails/mochaing.rb", "lib/minitest/rails/tasks/minitest.rake", "lib/minitest/rails/tasks/sub_test_task.rb", "lib/minitest/rails/version.rb", "minitest-rails.gemspec", "tasks/gemfiles.rake", "tasks/test.rake", "test/generators/test_controller_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_scaffold_generator.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/action_dispatch/test_spec_type.rb", "test/rails/action_mailer/test_mailers.rb", "test/rails/action_mailer/test_spec_type.rb", "test/rails/action_view/test_helpers.rb", "test/rails/action_view/test_spec_type.rb", "test/rails/active_support/test_spec_type.rb", "test/rails/test_constant_lookup.rb", "test/test_sanity.rb"]
|
14
14
|
s.homepage = "http://blowmage.com/minitest-rails"
|
15
15
|
s.rdoc_options = ["--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = "minitest-rails"
|
18
|
-
s.rubygems_version = "1.8.
|
18
|
+
s.rubygems_version = "1.8.23"
|
19
19
|
s.summary = "MiniTest integration for Rails 3.x"
|
20
|
-
s.test_files = ["test/generators/test_controller_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_scaffold_generator.rb", "test/rails/action_controller/
|
20
|
+
s.test_files = ["test/generators/test_controller_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_scaffold_generator.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/action_dispatch/test_spec_type.rb", "test/rails/action_mailer/test_mailers.rb", "test/rails/action_mailer/test_spec_type.rb", "test/rails/action_view/test_helpers.rb", "test/rails/action_view/test_spec_type.rb", "test/rails/active_support/test_spec_type.rb", "test/rails/test_constant_lookup.rb", "test/test_sanity.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
s.specification_version = 3
|
24
24
|
|
25
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
-
s.add_runtime_dependency(%q<minitest>, ["~>
|
26
|
+
s.add_runtime_dependency(%q<minitest>, ["~> 4.0"])
|
27
27
|
s.add_runtime_dependency(%q<rails>, ["~> 3.0"])
|
28
28
|
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
29
29
|
s.add_development_dependency(%q<fakefs>, ["~> 0.4"])
|
30
|
-
s.add_development_dependency(%q<hoe>, ["~> 3.
|
30
|
+
s.add_development_dependency(%q<hoe>, ["~> 3.1"])
|
31
31
|
else
|
32
|
-
s.add_dependency(%q<minitest>, ["~>
|
32
|
+
s.add_dependency(%q<minitest>, ["~> 4.0"])
|
33
33
|
s.add_dependency(%q<rails>, ["~> 3.0"])
|
34
34
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
35
35
|
s.add_dependency(%q<fakefs>, ["~> 0.4"])
|
36
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
36
|
+
s.add_dependency(%q<hoe>, ["~> 3.1"])
|
37
37
|
end
|
38
38
|
else
|
39
|
-
s.add_dependency(%q<minitest>, ["~>
|
39
|
+
s.add_dependency(%q<minitest>, ["~> 4.0"])
|
40
40
|
s.add_dependency(%q<rails>, ["~> 3.0"])
|
41
41
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
42
42
|
s.add_dependency(%q<fakefs>, ["~> 0.4"])
|
43
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
43
|
+
s.add_dependency(%q<hoe>, ["~> 3.1"])
|
44
44
|
end
|
45
45
|
end
|
data/tasks/gemfiles.rake
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
namespace :gemfiles do
|
2
|
+
desc "Updates the gemfiles"
|
3
|
+
task :update do
|
4
|
+
`bundle --gemfile=gemfiles/3.0.gemfile`
|
5
|
+
`bundle --gemfile=gemfiles/3.1.gemfile`
|
6
|
+
`bundle --gemfile=gemfiles/3.2.gemfile`
|
7
|
+
end
|
8
|
+
desc "Clear the gemfile lock files"
|
9
|
+
task :clear do
|
10
|
+
`rm gemfiles/3.*.gemfile.lock`
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Building this in case it doesn't exist
|
15
|
+
# /me shakes fist at travis-ci
|
16
|
+
namespace :gem do
|
17
|
+
task :spec do
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Rake::Task["gem:spec"].enhance do
|
22
|
+
Rake::Task["gemfiles:update"].invoke
|
23
|
+
end
|
data/tasks/test.rake
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
namespace :test do
|
2
|
+
desc "Run tests against the 3.0 gemfile"
|
3
|
+
task "3.0" do
|
4
|
+
ENV["BUNDLE_GEMFILE"] = "gemfiles/3.0.gemfile"
|
5
|
+
sh "bundle exec rake test"
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Run tests against the 3.1 gemfile"
|
9
|
+
task "3.1" do
|
10
|
+
ENV["BUNDLE_GEMFILE"] = "gemfiles/3.1.gemfile"
|
11
|
+
sh "bundle exec rake test"
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Run tests against the 3.2 gemfile"
|
15
|
+
task "3.2" do
|
16
|
+
ENV["BUNDLE_GEMFILE"] = "gemfiles/3.2.gemfile"
|
17
|
+
sh "bundle exec rake test"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
File without changes
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
require "action_mailer"
|
5
|
+
require "minitest/rails/action_mailer"
|
6
|
+
|
7
|
+
class TestTestMailer < ActionMailer::Base; end
|
8
|
+
|
9
|
+
# From Rails...
|
10
|
+
class CrazyNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
|
11
|
+
tests TestTestMailer
|
12
|
+
|
13
|
+
def test_set_mailer_class_manual
|
14
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class CrazySymbolNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
|
19
|
+
tests :test_test_mailer
|
20
|
+
|
21
|
+
def test_set_mailer_class_manual_using_symbol
|
22
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
23
|
+
end
|
24
|
+
end if Rails::VERSION::STRING >= "3.2"
|
25
|
+
|
26
|
+
class CrazyStringNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
|
27
|
+
tests 'test_test_mailer'
|
28
|
+
|
29
|
+
def test_set_mailer_class_manual_using_string
|
30
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
31
|
+
end
|
32
|
+
end if Rails::VERSION::STRING >= "3.2"
|
33
|
+
|
34
|
+
# New tests...
|
35
|
+
describe TestTestMailer do
|
36
|
+
it "gets the mailer from the test name" do
|
37
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe TestTestMailer, :action do
|
42
|
+
it "gets the mailer from the test name" do
|
43
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe TestTestMailer do
|
48
|
+
describe "nested" do
|
49
|
+
it "gets the mailer from the test name" do
|
50
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe TestTestMailer, :action do
|
56
|
+
describe "nested" do
|
57
|
+
it "gets the mailer from the test name" do
|
58
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "TestTestMailer" do
|
64
|
+
it "gets the mailer from the test name" do
|
65
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "TestTestMailerTest" do
|
70
|
+
it "gets the mailer from the test name" do
|
71
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "AnotherCrazySymbolNameMailerTest" do
|
76
|
+
tests :test_test_mailer
|
77
|
+
|
78
|
+
it "gets the mailer after setting it with a symbol" do
|
79
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
80
|
+
end
|
81
|
+
end if Rails::VERSION::STRING >= "3.2"
|
82
|
+
|
83
|
+
describe "AnotherCrazyStringNameMailerTest" do
|
84
|
+
tests 'test_test_mailer'
|
85
|
+
|
86
|
+
it "gets the mailer after setting it with a string" do
|
87
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
88
|
+
end
|
89
|
+
end if Rails::VERSION::STRING >= "3.2"
|
90
|
+
|
91
|
+
describe "Another Crazy Name Mailer Test" do
|
92
|
+
tests TestTestMailer
|
93
|
+
|
94
|
+
it "gets the mailer after setting it manually" do
|
95
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "Another Crazy Symbol Name Mailer Test" do
|
100
|
+
tests :test_test_mailer
|
101
|
+
|
102
|
+
it "gets the mailer after setting it with a symbol" do
|
103
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
104
|
+
end
|
105
|
+
end if Rails::VERSION::STRING >= "3.2"
|
106
|
+
|
107
|
+
describe "Another Crazy String Name Mailer Test" do
|
108
|
+
tests 'test_test_mailer'
|
109
|
+
|
110
|
+
it "gets the mailer after setting it with a string" do
|
111
|
+
assert_equal TestTestMailer, self.class.mailer_class
|
112
|
+
end
|
113
|
+
end if Rails::VERSION::STRING >= "3.2"
|