minitest-spec-rails 4.7.2 → 4.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ ## 4.7.3
3
+
4
+ * Allow using ActiveSupport's Declarative#test as an alias to it. Thanks @ysbaddaden. Fixes #23.
5
+
6
+
2
7
  ## 4.7.2
3
8
 
4
9
  * Register non ActiveRecord::Base classes correctly. Thanks @mptre.
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'minitest-spec-rails-tu-shim', '~> 1.9.3.1' if RUBY_VERSION == '1.8.7'
5
+ gem 'minitest-spec-rails-tu-shim', '~> 1.9.3.3' if RUBY_VERSION == '1.8.7'
data/README.md CHANGED
@@ -53,6 +53,8 @@ To start off both Mike Moore (@blowmage) and I have worked together and we both
53
53
  * No special test helper and/or generators.
54
54
  * Easy migration path for existing Rails applications.
55
55
  * How we go about freedom patching Rails.
56
+ * Fully support Ruby 1.8.7 with all legacy Test::Unit behavior.
57
+ * Compatability with ActiveSupport::TestCase's setup and teardowns.
56
58
 
57
59
  So the goal of this project is to make Rails 3 or 4 applications just work as if rails-core had decided to support MiniTest::Spec all along. We believe that eventually that day will come and when it does, all your tests will still work! So bundle up and get started!
58
60
 
@@ -146,6 +148,31 @@ class UserTest < ActiveSupport::TestCase
146
148
  end
147
149
  ```
148
150
 
151
+ ### Setup & Teardown Compatability
152
+
153
+ Rails ActiveSupport::TestCase allows multiple setup and teardown methods per class. It also allows you to specify these either with a symbol or a block. Unlike normal ActiveSupport setup and teardown callbacks, our blocks are evaluated in the scope of the instance, just like before and after. So this just works!
154
+
155
+ ```ruby
156
+ class ActiveSupportCallbackTest < ActiveSupport::TestCase
157
+
158
+ setup :foo
159
+ setup :bar
160
+ before { @bat = 'biz' }
161
+
162
+ it 'works' do
163
+ @foo.must_equal 'foo'
164
+ @bar.must_equal 'bar'
165
+ @bat.must_equal 'biz'
166
+ end
167
+
168
+ private
169
+
170
+ def foo ; @foo = 'foo' ; end
171
+ def bar ; @bar = 'bar' ; end
172
+
173
+ end
174
+ ```
175
+
149
176
  ### mini_shoulda
150
177
 
151
178
  If you are migrating away from Shoulda, then minitest-spec-rails' mini_shoulda feature will help. To enable it, set the following configuration in your test environment file.
@@ -5,6 +5,7 @@ module MiniTestSpecRails
5
5
 
6
6
  def self.included(klass)
7
7
  klass.extend ClassMethods
8
+ remove_method :test if method_defined?(:test)
8
9
  end
9
10
 
10
11
  module ClassMethods
@@ -17,6 +18,10 @@ module MiniTestSpecRails
17
18
  teardown { self.instance_eval(&block) }
18
19
  end
19
20
 
21
+ def test(name, &block)
22
+ it { self.instance_eval(&block) }
23
+ end
24
+
20
25
  def rails_test_cases
21
26
  RAILS_TEST_CASES
22
27
  end
@@ -1,3 +1,3 @@
1
1
  module MiniTestSpecRails
2
- VERSION = "4.7.2"
2
+ VERSION = "4.7.3"
3
3
  end
@@ -19,8 +19,6 @@ Gem::Specification.new do |gem|
19
19
  gem.add_runtime_dependency 'rails', '>= 3.0'
20
20
  gem.add_development_dependency 'appraisal'
21
21
  gem.add_development_dependency 'guard-minitest'
22
- gem.add_development_dependency 'minitest-emoji'
23
- gem.add_development_dependency 'minitest-focus'
24
22
  gem.add_development_dependency 'rake'
25
23
  gem.add_development_dependency 'sqlite3'
26
24
  end
@@ -4,7 +4,7 @@ class ModelsController < ApplicationController; end
4
4
 
5
5
  class ActionControllerTest < MiniTestSpecRails::TestCase
6
6
 
7
- it 'resolves spect type for matching acceptance strings' do
7
+ it 'resolves spec type for matching acceptance strings' do
8
8
  assert_dispatch MiniTest::Spec.spec_type("WidgetAcceptanceTest")
9
9
  assert_dispatch MiniTest::Spec.spec_type("Widget Acceptance Test")
10
10
  assert_dispatch MiniTest::Spec.spec_type("widgetacceptancetest")
@@ -4,12 +4,12 @@ class SomeRandomModel < ActiveRecord::Base; end
4
4
 
5
5
  class ActiveSupportTest < MiniTestSpecRails::TestCase
6
6
 
7
- it 'resolves spect type for active record constants' do
7
+ it 'resolves spec type for active record constants' do
8
8
  assert_support MiniTest::Spec.spec_type(SomeRandomModel)
9
9
  assert_support MiniTest::Spec.spec_type(User)
10
10
  end
11
11
 
12
- it 'wont resolve spect type for random strings' do
12
+ it 'wont resolve spec type for random strings' do
13
13
  assert_spec MiniTest::Spec.spec_type("Unmatched String")
14
14
  end
15
15
 
@@ -11,6 +11,10 @@ module IntegrationTests
11
11
  status.must_equal 200
12
12
  end
13
13
 
14
+ it 'works with assert_routing' do
15
+ assert_routing '/', :controller => 'application', :action => 'index'
16
+ end
17
+
14
18
  it 'can find the app' do
15
19
  app.must_be_instance_of Dummy::Application
16
20
  end
@@ -37,3 +41,9 @@ end
37
41
  class IntegrationTest < ActionDispatch::IntegrationTest
38
42
  include IntegrationTests
39
43
  end
44
+
45
+ class AppTest < ActionDispatch::IntegrationTest
46
+ def test_homepage
47
+ assert_routing '/', :controller => 'application', :action => 'index'
48
+ end
49
+ end
@@ -8,6 +8,10 @@ module UserTests
8
8
  user_ken.must_be_instance_of User
9
9
  end
10
10
 
11
+ test 'works with test' do
12
+ user_ken.must_be_instance_of User
13
+ end
14
+
11
15
  it 'allows custom assertions' do
12
16
  assert_blank '' if MiniTestSpecRails::Util.rails3?
13
17
  end
@@ -22,6 +26,10 @@ module UserTests
22
26
 
23
27
  end
24
28
 
29
+ test 'works with test' do
30
+ user_ken.must_be_instance_of User
31
+ end
32
+
25
33
  end
26
34
 
27
35
  end
@@ -1,7 +1 @@
1
- require 'minitest/emoji'
2
1
 
3
- if ENV['CI'].blank? && RUBY_VERSION >= '1.9'
4
- MiniTest::Emoji::DEFAULT.merge! '.' => "\u{1f49A} ", 'F' => "\u{1f494} ", 'E' => "\u{1f480} ", 'S' => "\u{1f49B} "
5
- else
6
- MiniTest::Emoji::DEFAULT.merge! '.' => ".", 'F' => "F", 'E' => "E", 'S' => "S"
7
- end
metadata CHANGED
@@ -1,146 +1,120 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: minitest-spec-rails
3
- version: !ruby/object:Gem::Version
4
- hash: 39
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
6
- segments:
7
- - 4
8
- - 7
9
- - 2
10
- version: 4.7.2
5
+ version: 4.7.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ken Collins
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-03-20 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- prerelease: false
22
- type: :runtime
12
+ date: 2013-05-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: minitest
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ type: :runtime
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '4.7'
25
22
  none: false
26
- requirements:
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
27
25
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 21
30
- segments:
31
- - 4
32
- - 7
33
- version: "4.7"
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
26
+ - !ruby/object:Gem::Version
27
+ version: '4.7'
28
+ none: false
36
29
  prerelease: false
37
- type: :runtime
30
+ - !ruby/object:Gem::Dependency
38
31
  name: rails
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
32
+ type: :runtime
33
+ requirement: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '3.0'
40
38
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 7
45
- segments:
46
- - 3
47
- - 0
48
- version: "3.0"
49
- requirement: *id002
50
- - !ruby/object:Gem::Dependency
51
- prerelease: false
52
- type: :development
53
- name: appraisal
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '3.0'
55
44
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
63
- requirement: *id003
64
- - !ruby/object:Gem::Dependency
65
45
  prerelease: false
46
+ - !ruby/object:Gem::Dependency
47
+ name: appraisal
66
48
  type: :development
67
- name: guard-minitest
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
69
54
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
- version: "0"
77
- requirement: *id004
78
- - !ruby/object:Gem::Dependency
79
- prerelease: false
80
- type: :development
81
- name: minitest-emoji
82
- version_requirements: &id005 !ruby/object:Gem::Requirement
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
83
60
  none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
- version: "0"
91
- requirement: *id005
92
- - !ruby/object:Gem::Dependency
93
61
  prerelease: false
62
+ - !ruby/object:Gem::Dependency
63
+ name: guard-minitest
94
64
  type: :development
95
- name: minitest-focus
96
- version_requirements: &id006 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ none: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
97
76
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
105
- requirement: *id006
106
- - !ruby/object:Gem::Dependency
107
77
  prerelease: false
108
- type: :development
78
+ - !ruby/object:Gem::Dependency
109
79
  name: rake
110
- version_requirements: &id007 !ruby/object:Gem::Requirement
80
+ type: :development
81
+ requirement: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ none: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
111
92
  none: false
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- hash: 3
116
- segments:
117
- - 0
118
- version: "0"
119
- requirement: *id007
120
- - !ruby/object:Gem::Dependency
121
93
  prerelease: false
122
- type: :development
94
+ - !ruby/object:Gem::Dependency
123
95
  name: sqlite3
124
- version_requirements: &id008 !ruby/object:Gem::Requirement
96
+ type: :development
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ none: false
103
+ version_requirements: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
125
108
  none: false
126
- requirements:
127
- - - ">="
128
- - !ruby/object:Gem::Version
129
- hash: 3
130
- segments:
131
- - 0
132
- version: "0"
133
- requirement: *id008
134
- description: The minitest-spec-rails gem makes it easy to use the MiniTest::Spec DSL within your existing Rails 3 or 4 test suite.
135
- email:
109
+ prerelease: false
110
+ description: The minitest-spec-rails gem makes it easy to use the MiniTest::Spec DSL
111
+ within your existing Rails 3 or 4 test suite.
112
+ email:
136
113
  - ken@metaskills.net
137
114
  executables: []
138
-
139
115
  extensions: []
140
-
141
116
  extra_rdoc_files: []
142
-
143
- files:
117
+ files:
144
118
  - .gitignore
145
119
  - .travis.yml
146
120
  - Appraisals
@@ -196,38 +170,35 @@ files:
196
170
  - test/test_helper_dummy.rb
197
171
  homepage: http://github.com/metaskills/minitest-spec-rails
198
172
  licenses: []
199
-
200
173
  post_install_message:
201
174
  rdoc_options: []
202
-
203
- require_paths:
175
+ require_paths:
204
176
  - lib
205
- required_ruby_version: !ruby/object:Gem::Requirement
206
- none: false
207
- requirements:
208
- - - ">="
209
- - !ruby/object:Gem::Version
210
- hash: 3
211
- segments:
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ segments:
212
182
  - 0
213
- version: "0"
214
- required_rubygems_version: !ruby/object:Gem::Requirement
183
+ hash: 3140459503075667103
184
+ version: '0'
215
185
  none: false
216
- requirements:
217
- - - ">="
218
- - !ruby/object:Gem::Version
219
- hash: 3
220
- segments:
186
+ required_rubygems_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ! '>='
189
+ - !ruby/object:Gem::Version
190
+ segments:
221
191
  - 0
222
- version: "0"
192
+ hash: 3140459503075667103
193
+ version: '0'
194
+ none: false
223
195
  requirements: []
224
-
225
196
  rubyforge_project:
226
197
  rubygems_version: 1.8.25
227
198
  signing_key:
228
199
  specification_version: 3
229
200
  summary: Make Rails Use MiniTest::Spec!
230
- test_files:
201
+ test_files:
231
202
  - test/cases/action_controller_test.rb
232
203
  - test/cases/action_dispatch_test.rb
233
204
  - test/cases/action_mailer_test.rb