shoulda-context 2.0.0.rc1 → 2.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51bde035855288943372f8d9fc71310416ae02ddacbab30f912e5abbce21ab5f
4
- data.tar.gz: ce5ee8ece26119b829ab2851b3607ed1f62c00478115ede3e3a987dc86455e16
3
+ metadata.gz: 0e793247da34487c30f2d2f21bbf192ad399dcd893e1b4ab24088b7efda7ed2e
4
+ data.tar.gz: 93d6d5ad309c9a190ec8e317b041be600420409f59c12fc033f901b7f492b8b7
5
5
  SHA512:
6
- metadata.gz: ef854338d26cb4613673c019d38fd66411899e5ab983421ed3d0db45449ac527c982faa8910b831421fd1a1edfbfa6f1e8572bba6d191ba17809b6b8aef4a338
7
- data.tar.gz: e2854aad28db7d53de92728d00df9b51395e142d3f74a41da75883e8febc2a2e062c48d84e96879b9bae88f49bbce9002fd29442da33068e7d44d8042eea2e75
6
+ metadata.gz: a735ff40fc334bc9488c4b2a4daa8ecaf59fa8c233e1c2e0e63f2f238dc6c289e88c7cad7fd8571b9a06f92cd300835b0c86d41a426097a8a9377a6af8642463
7
+ data.tar.gz: 5a1f213846b5a09efe5cda27d09af30a96a6ba2d6ba7f47f020914469b6426228a766ed18c56b990555a456004c966bba93ef391678733b690b76578b69ef912
@@ -0,0 +1,3 @@
1
+ rubocop:
2
+ version: 0.64.0
3
+ config_file: .rubocop.yml
@@ -25,3 +25,6 @@
25
25
  framework's automatically.
26
26
  * Restore compatibility with Shoulda Matchers, starting from 3.0.
27
27
  * Fix some compatibility issues with Minitest 5.
28
+ * Fix running tests within a Rails < 5.2 environment so that when tests fail, an
29
+ error is not produced claiming that Minitest::Result cannot find a test
30
+ method.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shoulda-context (2.0.0.rc1)
4
+ shoulda-context (2.0.0.rc2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -22,8 +22,8 @@ GEM
22
22
  minitest (5.11.3)
23
23
  mocha (1.8.0)
24
24
  metaclass (~> 0.0.1)
25
- parallel (1.14.0)
26
- parser (2.6.0.0)
25
+ parallel (1.17.0)
26
+ parser (2.6.2.1)
27
27
  ast (~> 2.4.0)
28
28
  power_assert (1.1.3)
29
29
  powerpack (0.1.2)
@@ -33,20 +33,18 @@ GEM
33
33
  pry-byebug (3.6.0)
34
34
  byebug (~> 10.0)
35
35
  pry (~> 0.10)
36
- psych (3.1.0)
37
36
  rainbow (3.0.0)
38
37
  rake (12.3.2)
39
- rubocop (0.65.0)
38
+ rubocop (0.64.0)
40
39
  jaro_winkler (~> 1.5.1)
41
40
  parallel (~> 1.10)
42
41
  parser (>= 2.5, != 2.5.1.1)
43
42
  powerpack (~> 0.1)
44
- psych (>= 3.1.0)
45
43
  rainbow (>= 2.2.2, < 4.0)
46
44
  ruby-progressbar (~> 1.7)
47
45
  unicode-display_width (~> 1.4.0)
48
46
  ruby-progressbar (1.10.0)
49
- snowglobe (0.1.0)
47
+ snowglobe (0.3.0)
50
48
  test-unit (3.3.0)
51
49
  power_assert
52
50
  thor (0.20.3)
@@ -63,9 +61,9 @@ DEPENDENCIES
63
61
  mocha
64
62
  pry-byebug
65
63
  rake
66
- rubocop
64
+ rubocop (= 0.64.0)
67
65
  shoulda-context!
68
- snowglobe
66
+ snowglobe (>= 0.3.0)
69
67
  test-unit
70
68
 
71
69
  BUNDLED WITH
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- shoulda-context (2.0.0.rc1)
4
+ shoulda-context (2.0.0.rc2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -74,8 +74,8 @@ GEM
74
74
  metaclass (~> 0.0.1)
75
75
  nokogiri (1.10.1)
76
76
  mini_portile2 (~> 2.4.0)
77
- parallel (1.14.0)
78
- parser (2.6.0.0)
77
+ parallel (1.17.0)
78
+ parser (2.6.2.1)
79
79
  ast (~> 2.4.0)
80
80
  power_assert (1.1.3)
81
81
  powerpack (0.1.2)
@@ -85,7 +85,6 @@ GEM
85
85
  pry-byebug (3.6.0)
86
86
  byebug (~> 10.0)
87
87
  pry (~> 0.10)
88
- psych (3.1.0)
89
88
  rack (1.6.8)
90
89
  rack-test (0.6.3)
91
90
  rack (>= 1.0)
@@ -115,17 +114,16 @@ GEM
115
114
  thor (>= 0.18.1, < 2.0)
116
115
  rainbow (3.0.0)
117
116
  rake (12.3.2)
118
- rubocop (0.65.0)
117
+ rubocop (0.64.0)
119
118
  jaro_winkler (~> 1.5.1)
120
119
  parallel (~> 1.10)
121
120
  parser (>= 2.5, != 2.5.1.1)
122
121
  powerpack (~> 0.1)
123
- psych (>= 3.1.0)
124
122
  rainbow (>= 2.2.2, < 4.0)
125
123
  ruby-progressbar (~> 1.7)
126
124
  unicode-display_width (~> 1.4.0)
127
125
  ruby-progressbar (1.10.0)
128
- snowglobe (0.1.0)
126
+ snowglobe (0.3.0)
129
127
  sprockets (3.7.2)
130
128
  concurrent-ruby (~> 1.0)
131
129
  rack (> 1, < 3)
@@ -154,9 +152,9 @@ DEPENDENCIES
154
152
  pry-byebug
155
153
  rails (~> 4.2.0)
156
154
  rake
157
- rubocop
155
+ rubocop (= 0.64.0)
158
156
  shoulda-context!
159
- snowglobe
157
+ snowglobe (>= 0.3.0)
160
158
  sqlite3 (~> 1.3.6)
161
159
  test-unit
162
160
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- shoulda-context (2.0.0.rc1)
4
+ shoulda-context (2.0.0.rc2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -78,8 +78,8 @@ GEM
78
78
  nio4r (2.3.1)
79
79
  nokogiri (1.10.1)
80
80
  mini_portile2 (~> 2.4.0)
81
- parallel (1.14.0)
82
- parser (2.6.0.0)
81
+ parallel (1.17.0)
82
+ parser (2.6.2.1)
83
83
  ast (~> 2.4.0)
84
84
  power_assert (1.1.3)
85
85
  powerpack (0.1.2)
@@ -89,7 +89,6 @@ GEM
89
89
  pry-byebug (3.6.0)
90
90
  byebug (~> 10.0)
91
91
  pry (~> 0.10)
92
- psych (3.1.0)
93
92
  rack (2.0.6)
94
93
  rack-test (0.6.3)
95
94
  rack (>= 1.0)
@@ -118,17 +117,16 @@ GEM
118
117
  thor (>= 0.18.1, < 2.0)
119
118
  rainbow (3.0.0)
120
119
  rake (12.3.2)
121
- rubocop (0.65.0)
120
+ rubocop (0.64.0)
122
121
  jaro_winkler (~> 1.5.1)
123
122
  parallel (~> 1.10)
124
123
  parser (>= 2.5, != 2.5.1.1)
125
124
  powerpack (~> 0.1)
126
- psych (>= 3.1.0)
127
125
  rainbow (>= 2.2.2, < 4.0)
128
126
  ruby-progressbar (~> 1.7)
129
127
  unicode-display_width (~> 1.4.0)
130
128
  ruby-progressbar (1.10.0)
131
- snowglobe (0.1.0)
129
+ snowglobe (0.3.0)
132
130
  sprockets (3.7.2)
133
131
  concurrent-ruby (~> 1.0)
134
132
  rack (> 1, < 3)
@@ -160,9 +158,9 @@ DEPENDENCIES
160
158
  pry-byebug
161
159
  rails (~> 5.0.0)
162
160
  rake
163
- rubocop
161
+ rubocop (= 0.64.0)
164
162
  shoulda-context!
165
- snowglobe
163
+ snowglobe (>= 0.3.0)
166
164
  sqlite3 (~> 1.3.6)
167
165
  test-unit
168
166
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- shoulda-context (2.0.0.rc1)
4
+ shoulda-context (2.0.0.rc2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -78,8 +78,8 @@ GEM
78
78
  nio4r (2.3.1)
79
79
  nokogiri (1.10.1)
80
80
  mini_portile2 (~> 2.4.0)
81
- parallel (1.14.0)
82
- parser (2.6.0.0)
81
+ parallel (1.17.0)
82
+ parser (2.6.2.1)
83
83
  ast (~> 2.4.0)
84
84
  power_assert (1.1.3)
85
85
  powerpack (0.1.2)
@@ -89,7 +89,6 @@ GEM
89
89
  pry-byebug (3.6.0)
90
90
  byebug (~> 10.0)
91
91
  pry (~> 0.10)
92
- psych (3.1.0)
93
92
  rack (2.0.6)
94
93
  rack-test (1.1.0)
95
94
  rack (>= 1.0, < 3)
@@ -118,17 +117,16 @@ GEM
118
117
  thor (>= 0.18.1, < 2.0)
119
118
  rainbow (3.0.0)
120
119
  rake (12.3.2)
121
- rubocop (0.65.0)
120
+ rubocop (0.64.0)
122
121
  jaro_winkler (~> 1.5.1)
123
122
  parallel (~> 1.10)
124
123
  parser (>= 2.5, != 2.5.1.1)
125
124
  powerpack (~> 0.1)
126
- psych (>= 3.1.0)
127
125
  rainbow (>= 2.2.2, < 4.0)
128
126
  ruby-progressbar (~> 1.7)
129
127
  unicode-display_width (~> 1.4.0)
130
128
  ruby-progressbar (1.10.0)
131
- snowglobe (0.1.0)
129
+ snowglobe (0.3.0)
132
130
  sprockets (3.7.2)
133
131
  concurrent-ruby (~> 1.0)
134
132
  rack (> 1, < 3)
@@ -160,9 +158,9 @@ DEPENDENCIES
160
158
  pry-byebug
161
159
  rails (~> 5.1.0)
162
160
  rake
163
- rubocop
161
+ rubocop (= 0.64.0)
164
162
  shoulda-context!
165
- snowglobe
163
+ snowglobe (>= 0.3.0)
166
164
  sqlite3 (~> 1.3.6)
167
165
  test-unit
168
166
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- shoulda-context (2.0.0.rc1)
4
+ shoulda-context (2.0.0.rc2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -85,8 +85,8 @@ GEM
85
85
  nio4r (2.3.1)
86
86
  nokogiri (1.10.1)
87
87
  mini_portile2 (~> 2.4.0)
88
- parallel (1.14.0)
89
- parser (2.6.0.0)
88
+ parallel (1.17.0)
89
+ parser (2.6.2.1)
90
90
  ast (~> 2.4.0)
91
91
  power_assert (1.1.3)
92
92
  powerpack (0.1.2)
@@ -96,7 +96,6 @@ GEM
96
96
  pry-byebug (3.6.0)
97
97
  byebug (~> 10.0)
98
98
  pry (~> 0.10)
99
- psych (3.1.0)
100
99
  rack (2.0.6)
101
100
  rack-test (1.1.0)
102
101
  rack (>= 1.0, < 3)
@@ -126,17 +125,16 @@ GEM
126
125
  thor (>= 0.19.0, < 2.0)
127
126
  rainbow (3.0.0)
128
127
  rake (12.3.2)
129
- rubocop (0.65.0)
128
+ rubocop (0.64.0)
130
129
  jaro_winkler (~> 1.5.1)
131
130
  parallel (~> 1.10)
132
131
  parser (>= 2.5, != 2.5.1.1)
133
132
  powerpack (~> 0.1)
134
- psych (>= 3.1.0)
135
133
  rainbow (>= 2.2.2, < 4.0)
136
134
  ruby-progressbar (~> 1.7)
137
135
  unicode-display_width (~> 1.4.0)
138
136
  ruby-progressbar (1.10.0)
139
- snowglobe (0.1.0)
137
+ snowglobe (0.3.0)
140
138
  sprockets (3.7.2)
141
139
  concurrent-ruby (~> 1.0)
142
140
  rack (> 1, < 3)
@@ -168,9 +166,9 @@ DEPENDENCIES
168
166
  pry-byebug
169
167
  rails (~> 5.2.0)
170
168
  rake
171
- rubocop
169
+ rubocop (= 0.64.0)
172
170
  shoulda-context!
173
- snowglobe
171
+ snowglobe (>= 0.3.0)
174
172
  sqlite3 (~> 1.3.6)
175
173
  test-unit
176
174
 
@@ -9,6 +9,7 @@ require "shoulda/context/world"
9
9
 
10
10
  if defined?(Rails)
11
11
  require "shoulda/context/railtie"
12
+ require "shoulda/context/rails_test_unit_reporter_patch"
12
13
  end
13
14
 
14
15
  Shoulda::Context.configure do |config|
@@ -112,22 +112,26 @@ module Shoulda
112
112
  "'#{test_name}' is defined more than once."
113
113
  )
114
114
  end
115
- test_methods[test_unit_class][test_name.to_s] = true
116
115
 
116
+ test_methods[test_unit_class][test_name.to_s] = true
117
+ file, line_no = should[:block].source_location
117
118
  context = self
118
- test_unit_class.__send__(:define_method, test_name) do
119
- @shoulda_context = context
120
- begin
121
- context.run_parent_setup_blocks(self)
122
- if should[:before]
123
- instance_exec(&should[:before])
119
+
120
+ test_unit_class.class_eval <<-end_eval, file, line_no
121
+ define_method test_name do
122
+ @shoulda_context = context
123
+ begin
124
+ context.run_parent_setup_blocks(self)
125
+ if should[:before]
126
+ instance_exec(&should[:before])
127
+ end
128
+ context.run_current_setup_blocks(self)
129
+ instance_exec(&should[:block])
130
+ ensure
131
+ context.run_all_teardown_blocks(self)
124
132
  end
125
- context.run_current_setup_blocks(self)
126
- instance_exec(&should[:block])
127
- ensure
128
- context.run_all_teardown_blocks(self)
129
133
  end
130
- end
134
+ end_eval
131
135
  end
132
136
 
133
137
  def build_test_name_from(should)
@@ -0,0 +1,21 @@
1
+ begin
2
+ require "rails/test_unit/reporter"
3
+
4
+ Rails::TestUnitReporter.class_eval do
5
+ # Fix #format_rerun_snippet so that it works with recent versions of Minitest.
6
+ # This was cribbed from:
7
+ # <https://github.com/rails/rails/commit/ff0d5f14504f1aa29ad908ab15bab66b101427b7#diff-a071a1c8f51ce3b8bcb17ca59c79fc70>
8
+ def format_rerun_snippet(result)
9
+ location, line =
10
+ if result.respond_to?(:source_location)
11
+ result.source_location
12
+ else
13
+ result.method(result.name).source_location
14
+ end
15
+
16
+ "#{executable} #{relative_path_for(location)}:#{line}"
17
+ end
18
+ end
19
+ rescue LoadError
20
+ # Rails::TestUnitReporter was introduced in Rails 5
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Shoulda
2
2
  module Context
3
- VERSION = "2.0.0.rc1".freeze
3
+ VERSION = "2.0.0.rc2".freeze
4
4
  end
5
5
  end
@@ -27,6 +27,6 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency "mocha"
28
28
  s.add_development_dependency "pry-byebug"
29
29
  s.add_development_dependency "rake"
30
- s.add_development_dependency "rubocop"
31
- s.add_development_dependency "snowglobe"
30
+ s.add_development_dependency "rubocop", "0.64.0"
31
+ s.add_development_dependency "snowglobe", ">= 0.3.0"
32
32
  end
@@ -33,7 +33,7 @@ class RailtieTest < PARENT_TEST_CASE
33
33
  end
34
34
  RUBY
35
35
 
36
- app.run_command!("bundle exec rake test")
36
+ app.run_n_unit_test_suite
37
37
  end
38
38
  end
39
39
 
@@ -0,0 +1,33 @@
1
+ require "test_helper"
2
+
3
+ class RerunSnippetTest < PARENT_TEST_CASE
4
+ context "A Rails application with shoulda-context added to it" do
5
+ should "display the correct rerun snippet when a test fails" do
6
+ if app.rails_version >= 5 && TEST_FRAMEWORK == "minitest"
7
+ app.create
8
+
9
+ app.write_file("test/models/failing_test.rb", <<~RUBY)
10
+ ENV["RAILS_ENV"] = "test"
11
+ require_relative "../../config/environment"
12
+
13
+ class FailingTest < #{PARENT_TEST_CASE}
14
+ should "fail" do
15
+ assert false
16
+ end
17
+ end
18
+ RUBY
19
+
20
+ command_runner = app.run_n_unit_test_suite
21
+
22
+ assert_includes(
23
+ command_runner.output,
24
+ "bin/rails test test/models/failing_test.rb:5"
25
+ )
26
+ end
27
+ end
28
+ end
29
+
30
+ def app
31
+ @_app ||= RailsApplicationWithShouldaContext.new
32
+ end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoulda-context
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc1
4
+ version: 2.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot, inc.
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: exe
15
15
  cert_chain: []
16
- date: 2019-04-20 00:00:00.000000000 Z
16
+ date: 2019-04-21 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: appraisal
@@ -103,30 +103,30 @@ dependencies:
103
103
  name: rubocop
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - ">="
106
+ - - '='
107
107
  - !ruby/object:Gem::Version
108
- version: '0'
108
+ version: 0.64.0
109
109
  type: :development
110
110
  prerelease: false
111
111
  version_requirements: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - ">="
113
+ - - '='
114
114
  - !ruby/object:Gem::Version
115
- version: '0'
115
+ version: 0.64.0
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: snowglobe
118
118
  requirement: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: '0'
122
+ version: 0.3.0
123
123
  type: :development
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - ">="
128
128
  - !ruby/object:Gem::Version
129
- version: '0'
129
+ version: 0.3.0
130
130
  description: Context framework extracted from Shoulda
131
131
  email: support@thoughtbot.com
132
132
  executables:
@@ -135,6 +135,7 @@ extensions: []
135
135
  extra_rdoc_files: []
136
136
  files:
137
137
  - ".gitignore"
138
+ - ".hound.yml"
138
139
  - ".rubocop.yml"
139
140
  - ".ruby-version"
140
141
  - ".travis.yml"
@@ -169,6 +170,7 @@ files:
169
170
  - lib/shoulda/context/context.rb
170
171
  - lib/shoulda/context/dsl.rb
171
172
  - lib/shoulda/context/proc_extensions.rb
173
+ - lib/shoulda/context/rails_test_unit_reporter_patch.rb
172
174
  - lib/shoulda/context/railtie.rb
173
175
  - lib/shoulda/context/tasks.rb
174
176
  - lib/shoulda/context/tasks/list_tests.rake
@@ -187,6 +189,7 @@ files:
187
189
  - test/shoulda/convert_to_should_syntax_test.rb
188
190
  - test/shoulda/helpers_test.rb
189
191
  - test/shoulda/railtie_test.rb
192
+ - test/shoulda/rerun_snippet_test.rb
190
193
  - test/shoulda/should_test.rb
191
194
  - test/shoulda/test_framework_detection_test.rb
192
195
  - test/support/current_bundle.rb
@@ -227,6 +230,7 @@ test_files:
227
230
  - test/shoulda/convert_to_should_syntax_test.rb
228
231
  - test/shoulda/helpers_test.rb
229
232
  - test/shoulda/railtie_test.rb
233
+ - test/shoulda/rerun_snippet_test.rb
230
234
  - test/shoulda/should_test.rb
231
235
  - test/shoulda/test_framework_detection_test.rb
232
236
  - test/support/current_bundle.rb