minitest-rails 0.2 → 0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
File without changes
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
require "minitest/rails/action_view"
|
5
|
+
|
6
|
+
module PeopleHelper
|
7
|
+
def title(text)
|
8
|
+
content_tag(:h1, text)
|
9
|
+
end
|
10
|
+
|
11
|
+
def homepage_path
|
12
|
+
people_path
|
13
|
+
end
|
14
|
+
|
15
|
+
def homepage_url
|
16
|
+
people_url
|
17
|
+
end
|
18
|
+
|
19
|
+
def link_to_person(person)
|
20
|
+
link_to person.name, person
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# From Rails...
|
25
|
+
class CrazyHelperTest < MiniTest::Rails::ActionView::TestCase
|
26
|
+
tests PeopleHelper
|
27
|
+
|
28
|
+
def test_helper_class_can_be_set_manually_not_just_inferred
|
29
|
+
assert_equal PeopleHelper, self.class.helper_class
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class CrazySymbolHelperTest < MiniTest::Rails::ActionView::TestCase
|
34
|
+
tests :people
|
35
|
+
|
36
|
+
def test_set_helper_class_using_symbol
|
37
|
+
assert_equal PeopleHelper, self.class.helper_class
|
38
|
+
end
|
39
|
+
end if Rails::VERSION::STRING >= "3.2"
|
40
|
+
|
41
|
+
class CrazyStringHelperTest < MiniTest::Rails::ActionView::TestCase
|
42
|
+
tests 'people'
|
43
|
+
|
44
|
+
def test_set_helper_class_using_string
|
45
|
+
assert_equal PeopleHelper, self.class.helper_class
|
46
|
+
end
|
47
|
+
end if Rails::VERSION::STRING >= "3.2"
|
48
|
+
|
49
|
+
# New tests...
|
50
|
+
describe PeopleHelper do
|
51
|
+
it "resolves the right helper_class" do
|
52
|
+
assert_equal PeopleHelper, self.class.helper_class
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe PeopleHelper, :helper_class do
|
57
|
+
it "resolves the right helper_class" do
|
58
|
+
assert_equal PeopleHelper, self.class.helper_class
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe PeopleHelper do
|
63
|
+
describe "even while nested" do
|
64
|
+
it "resolves the right helper_class" do
|
65
|
+
assert_equal PeopleHelper, self.class.helper_class
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe PeopleHelper, :helper_class do
|
71
|
+
describe "even while nested" do
|
72
|
+
it "resolves the right helper_class" do
|
73
|
+
assert_equal PeopleHelper, self.class.helper_class
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
require "minitest/rails/active_support"
|
5
|
+
|
6
|
+
class Foo; end
|
7
|
+
class Bar < Foo;
|
8
|
+
def index; end
|
9
|
+
def self.index; end
|
10
|
+
end
|
11
|
+
class Baz < Bar; end
|
12
|
+
module FooBar; end
|
13
|
+
|
14
|
+
class TestLookup < MiniTest::Rails::ActiveSupport::TestCase
|
15
|
+
|
16
|
+
def find_foo(name)
|
17
|
+
self.class.determine_constant_from_test_name(name) do |constant|
|
18
|
+
Class === constant && constant < Foo
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_module(name)
|
23
|
+
self.class.determine_constant_from_test_name(name) do |constant|
|
24
|
+
Module === constant
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_find_bar_from_foo
|
29
|
+
assert_equal Bar, find_foo("Bar")
|
30
|
+
assert_equal Bar, find_foo("Bar::index")
|
31
|
+
assert_equal Bar, find_foo("Bar::index::authenticated")
|
32
|
+
assert_equal Bar, find_foo("BarTest")
|
33
|
+
assert_equal Bar, find_foo("BarTest::index")
|
34
|
+
assert_equal Bar, find_foo("BarTest::index::authenticated")
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_find_module
|
38
|
+
assert_equal FooBar, find_module("FooBar")
|
39
|
+
assert_equal FooBar, find_module("FooBar::index")
|
40
|
+
assert_equal FooBar, find_module("FooBar::index::authenticated")
|
41
|
+
assert_equal FooBar, find_module("FooBarTest")
|
42
|
+
assert_equal FooBar, find_module("FooBarTest::index")
|
43
|
+
assert_equal FooBar, find_module("FooBarTest::index::authenticated")
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_returns_nil_when_cant_find_foo
|
47
|
+
assert_nil find_foo("DoesntExist")
|
48
|
+
assert_nil find_foo("DoesntExistTest")
|
49
|
+
assert_nil find_foo("DoesntExist::Nadda")
|
50
|
+
assert_nil find_foo("DoesntExist::Nadda::Nope")
|
51
|
+
assert_nil find_foo("DoesntExist::Nadda::Nope::NotHere")
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_returns_nil_when_cant_find_module
|
55
|
+
assert_nil find_module("DoesntExist")
|
56
|
+
assert_nil find_module("DoesntExistTest")
|
57
|
+
assert_nil find_module("DoesntExist::Nadda")
|
58
|
+
assert_nil find_module("DoesntExist::Nadda::Nope")
|
59
|
+
assert_nil find_module("DoesntExist::Nadda::Nope::NotHere")
|
60
|
+
end
|
61
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '4.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '4.0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rails
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: '3.
|
85
|
+
version: '3.1'
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '3.
|
93
|
+
version: '3.1'
|
94
94
|
description: Adds MiniTest as the default testing library in Rails 3.x
|
95
95
|
email:
|
96
96
|
- mike@blowmage.com
|
@@ -149,24 +149,30 @@ files:
|
|
149
149
|
- lib/minitest/rails/action_mailer.rb
|
150
150
|
- lib/minitest/rails/action_view.rb
|
151
151
|
- lib/minitest/rails/active_support.rb
|
152
|
+
- lib/minitest/rails/constant_lookup.rb
|
152
153
|
- lib/minitest/rails/declarative.rb
|
153
154
|
- lib/minitest/rails/mochaing.rb
|
154
155
|
- lib/minitest/rails/tasks/minitest.rake
|
155
156
|
- lib/minitest/rails/tasks/sub_test_task.rb
|
157
|
+
- lib/minitest/rails/version.rb
|
156
158
|
- minitest-rails.gemspec
|
159
|
+
- tasks/gemfiles.rake
|
160
|
+
- tasks/test.rake
|
157
161
|
- test/generators/test_controller_generator.rb
|
158
162
|
- test/generators/test_helper_generator.rb
|
159
163
|
- test/generators/test_install_generator.rb
|
160
164
|
- test/generators/test_mailer_generator.rb
|
161
165
|
- test/generators/test_model_generator.rb
|
162
166
|
- test/generators/test_scaffold_generator.rb
|
163
|
-
- test/rails/action_controller/test_controller_lookup.rb
|
164
167
|
- test/rails/action_controller/test_controllers.rb
|
165
168
|
- test/rails/action_controller/test_spec_type.rb
|
166
|
-
- test/rails/
|
167
|
-
- test/rails/
|
168
|
-
- test/rails/
|
169
|
-
- test/rails/
|
169
|
+
- test/rails/action_dispatch/test_spec_type.rb
|
170
|
+
- test/rails/action_mailer/test_mailers.rb
|
171
|
+
- test/rails/action_mailer/test_spec_type.rb
|
172
|
+
- test/rails/action_view/test_helpers.rb
|
173
|
+
- test/rails/action_view/test_spec_type.rb
|
174
|
+
- test/rails/active_support/test_spec_type.rb
|
175
|
+
- test/rails/test_constant_lookup.rb
|
170
176
|
- test/test_sanity.rb
|
171
177
|
homepage: http://blowmage.com/minitest-rails
|
172
178
|
licenses: []
|
@@ -190,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
196
|
version: '0'
|
191
197
|
requirements: []
|
192
198
|
rubyforge_project: minitest-rails
|
193
|
-
rubygems_version: 1.8.
|
199
|
+
rubygems_version: 1.8.23
|
194
200
|
signing_key:
|
195
201
|
specification_version: 3
|
196
202
|
summary: MiniTest integration for Rails 3.x
|
@@ -201,11 +207,13 @@ test_files:
|
|
201
207
|
- test/generators/test_mailer_generator.rb
|
202
208
|
- test/generators/test_model_generator.rb
|
203
209
|
- test/generators/test_scaffold_generator.rb
|
204
|
-
- test/rails/action_controller/test_controller_lookup.rb
|
205
210
|
- test/rails/action_controller/test_controllers.rb
|
206
211
|
- test/rails/action_controller/test_spec_type.rb
|
207
|
-
- test/rails/
|
208
|
-
- test/rails/
|
209
|
-
- test/rails/
|
210
|
-
- test/rails/
|
212
|
+
- test/rails/action_dispatch/test_spec_type.rb
|
213
|
+
- test/rails/action_mailer/test_mailers.rb
|
214
|
+
- test/rails/action_mailer/test_spec_type.rb
|
215
|
+
- test/rails/action_view/test_helpers.rb
|
216
|
+
- test/rails/action_view/test_spec_type.rb
|
217
|
+
- test/rails/active_support/test_spec_type.rb
|
218
|
+
- test/rails/test_constant_lookup.rb
|
211
219
|
- test/test_sanity.rb
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require "minitest/autorun"
|
2
|
-
require "rails"
|
3
|
-
|
4
|
-
require "minitest/rails/action_controller"
|
5
|
-
require "action_controller"
|
6
|
-
|
7
|
-
class ApplicationController < ActionController::Base; end
|
8
|
-
class ModelsController < ApplicationController; end
|
9
|
-
module Admin
|
10
|
-
class WidgetsController < ApplicationController; end
|
11
|
-
end
|
12
|
-
|
13
|
-
class TestControllerLookup < MiniTest::Unit::TestCase
|
14
|
-
include MiniTest::Rails::ActionController
|
15
|
-
def test_find_application_controller
|
16
|
-
assert_equal ApplicationController, ControllerLookup.find("ApplicationController")
|
17
|
-
assert_equal ApplicationController, ControllerLookup.find("ApplicationControllerTest")
|
18
|
-
assert_equal ApplicationController, ControllerLookup.find("ApplicationController::index")
|
19
|
-
assert_equal ApplicationController, ControllerLookup.find("ApplicationController::index::authenticated")
|
20
|
-
assert_equal ApplicationController, ControllerLookup.find("ApplicationControllerTest::index")
|
21
|
-
assert_equal ApplicationController, ControllerLookup.find("ApplicationControllerTest::index::authenticated")
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_find_models_controller
|
25
|
-
assert_equal ModelsController, ControllerLookup.find("ModelsController")
|
26
|
-
assert_equal ModelsController, ControllerLookup.find("ModelsControllerTest")
|
27
|
-
assert_equal ModelsController, ControllerLookup.find("ModelsController::index")
|
28
|
-
assert_equal ModelsController, ControllerLookup.find("ModelsController::index::authenticated")
|
29
|
-
assert_equal ModelsController, ControllerLookup.find("ModelsControllerTest::index")
|
30
|
-
assert_equal ModelsController, ControllerLookup.find("ModelsControllerTest::index::authenticated")
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_find_admin_widgets_controller
|
34
|
-
assert_equal Admin::WidgetsController, ControllerLookup.find("Admin::WidgetsController")
|
35
|
-
assert_equal Admin::WidgetsController, ControllerLookup.find("Admin::WidgetsControllerTest")
|
36
|
-
assert_equal Admin::WidgetsController, ControllerLookup.find("Admin::WidgetsController::index")
|
37
|
-
assert_equal Admin::WidgetsController, ControllerLookup.find("Admin::WidgetsController::index::authenticated")
|
38
|
-
assert_equal Admin::WidgetsController, ControllerLookup.find("Admin::WidgetsControllerTest::index")
|
39
|
-
assert_equal Admin::WidgetsController, ControllerLookup.find("Admin::WidgetsControllerTest::index::authenticated")
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_raises_when_cant_find_controller
|
43
|
-
assert_raises(NameError) { ControllerLookup.find("DoesntExistController") }
|
44
|
-
assert_raises(NameError) { ControllerLookup.find("DoesntExistControllerTest") }
|
45
|
-
assert_raises(NameError) { ControllerLookup.find("DoesntExistController::Nadda") }
|
46
|
-
assert_raises(NameError) { ControllerLookup.find("DoesntExistController::Nadda::Nope") }
|
47
|
-
assert_raises(NameError) { ControllerLookup.find("DoesntExistController::Nadda::Nope::NotHere") }
|
48
|
-
end
|
49
|
-
end
|