minitest-around 0.3.1 → 0.3.2

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
  SHA1:
3
- metadata.gz: 713334daf3b3e114e8d5bf5aa6a4767fe8cfddef
4
- data.tar.gz: 4c485989c943ccddc3b3aa515ddc2923a590770a
3
+ metadata.gz: 58fd3c77c52798c76e4b1ee4ea7c52e48cc38d2b
4
+ data.tar.gz: e640ebafb486d4c355e850679ad68d9472b3b6f8
5
5
  SHA512:
6
- metadata.gz: 601fbba788d9d5983ea09cecd1d7658d7ce913636f87014d3691e0a5484e5c07427901f475ff45015bfd50ea0c02edfc7621ec2a49341e31c812c78a0dfab111
7
- data.tar.gz: 5d67a70bf24e57b8d3a9e8af8be0e70bbba37b3afec9d14b507d882d43fc4c0bdfb763e547dbdfda43157271ca8f22b45fd34cd5384abe85c719b63c1c6f864c
6
+ metadata.gz: bceba5d95427bffd1fc6488fc36d8f1e259d1084b5648ec2c080b9adf6da079a14d35c983c3a670d6cc1db8b0044ef59c483e7fb2ef28ff9c68873a36d632407
7
+ data.tar.gz: 8915f7bc547c3b2db4481f1038d943bbc0c98d6740123805e5647df7f6bef11b3279b7ed15ddaad7ebbc8b7b8872f0377eab3dbab025dca4ac4ac093ba64972e
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'bundler/gem_tasks'
3
3
  require 'cucumber/rake/task'
4
4
 
5
5
  desc 'Default: run unit tests.'
6
- task :default => [:test, :features]
6
+ task :default => [:test, :"test:isolated", :features]
7
7
 
8
8
  # Test
9
9
  TEST_FILES = FileList.new('test/*_{test,spec}.rb')
@@ -86,6 +86,29 @@ Feature: `around` hooks
86
86
  When I run `rspec example_spec.rb`
87
87
  Then the output should contain "this should show up in the output"
88
88
 
89
+ Scenario: An around hook continues to run even if the example throws an exception
90
+ Given a file named "example_spec.rb" with:
91
+ """ruby
92
+ RSpec.describe "something" do
93
+ around(:example) do |example|
94
+ puts "around example setup"
95
+ example.run
96
+ puts "around example cleanup"
97
+ end
98
+
99
+ it "still executes the entire around hook" do
100
+ fail "the example blows up"
101
+ end
102
+ end
103
+ """
104
+ When I run `rspec example_spec.rb`
105
+ Then the output should contain "1 example, 1 error"
106
+ And the output should contain:
107
+ """
108
+ around example setup
109
+ around example cleanup
110
+ """
111
+
89
112
  @rspec
90
113
  Scenario: Define a global `around` hook
91
114
  Given a file named "example_spec.rb" with:
@@ -220,9 +243,11 @@ Feature: `around` hooks
220
243
  Then the output should contain "1 example, 0 failures, 1 pending"
221
244
  And the output should contain:
222
245
  """
223
- Pending:
224
- implicit pending example should be detected as Not yet implemented
225
- # Not yet implemented
246
+ Pending: (Failures listed here are expected and do not affect your suite's status)
247
+
248
+ 1) implicit pending example should be detected as Not yet implemented
249
+ # Not yet implemented
250
+ # ./example_spec.rb:6
226
251
  """
227
252
 
228
253
 
@@ -245,8 +270,10 @@ Feature: `around` hooks
245
270
  Then the output should contain "1 example, 0 failures, 1 pending"
246
271
  And the output should contain:
247
272
  """
248
- explicit pending example should be detected as pending
249
- # No reason given
273
+ Pending: (Failures listed here are expected and do not affect your suite's status)
274
+
275
+ 1) explicit pending example should be detected as pending
276
+ # No reason given
250
277
  """
251
278
 
252
279
  Scenario: Multiple `around` hooks in the same scope
@@ -10,14 +10,15 @@ When(/^I run `rspec.*?(\S+)`$/) do |filename|
10
10
  end
11
11
 
12
12
  Then(/^the output should contain:$/) do |content|
13
- assert_includes @output, content
13
+ assert_includes @output, content, @output
14
14
  end
15
15
 
16
16
  Then(/^the output should contain "(.*?)"$/) do |content|
17
17
  # 1 runs, 0 assertions, 0 failures, 0 errors, 0 skips
18
18
  runs = $1 if content =~ /(\d+) examples?/
19
+ errors = $1 if content =~ /(\d+) errors?/
19
20
  failures = $1 if content =~ /(\d+) failures?/
20
21
  skips = $1 if content =~ /(\d+) pending/
21
- content = /#{runs} runs, \d+ assertions, #{failures} failures, 0 errors, #{skips || 0} skips/
22
- assert_match content, @output
22
+ content = /#{runs} runs, \d+ assertions, #{failures || 0} failures, #{errors || 0} errors, #{skips || 0} skips/
23
+ assert_match content, @output, @output
23
24
  end
@@ -15,12 +15,12 @@ class MyWorld
15
15
  content.gsub!("RSpec.describe", "describe")
16
16
  # example.run -> example.call
17
17
  content.gsub!("example.run", "example.call")
18
+ # expect(..).to .. -> expect(..).must_equal ..
19
+ content.gsub!("to eq", "must_equal")
18
20
 
19
21
  content = <<-RUBY + content
20
22
  require 'minitest/autorun'
21
- require "#{File.expand_path("../../../lib/minitest/around/spec", __FILE__)}"
22
-
23
- require 'rspec/expectations/minitest_integration'
23
+ require '#{File.expand_path("../../../lib/minitest/around/spec", __FILE__)}'
24
24
  RUBY
25
25
  write_file(filename, content)
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module MinitestAround
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -14,5 +14,4 @@ Gem::Specification.new "minitest-around", MinitestAround::VERSION do |s|
14
14
  s.add_development_dependency 'rdoc'
15
15
  s.add_development_dependency 'rake'
16
16
  s.add_development_dependency 'cucumber'
17
- s.add_development_dependency 'rspec-expectations'
18
17
  end
data/test/nested_spec.rb CHANGED
@@ -1,36 +1,36 @@
1
1
  require_relative 'helper'
2
2
  require 'minitest/around'
3
3
 
4
- $var = []
5
-
6
4
  describe 'Outer' do
5
+ let(:var) { [] }
6
+
7
7
  before do
8
- $var << :before
8
+ var << :before
9
9
  end
10
10
  after do
11
- $var << :after
12
- $var.must_equal [:before, :begin, :ibefore, :ibegin, :during, :iend, :iafter, :end, :after]
11
+ var << :after
12
+ var.must_equal [:before, :begin, :ibefore, :ibegin, :during, :iend, :iafter, :end, :after]
13
13
  end
14
14
  around do |test|
15
- $var << :begin
15
+ var << :begin
16
16
  test.call
17
- $var << :end
17
+ var << :end
18
18
  end
19
19
 
20
20
  describe 'Inner' do
21
21
  before do
22
- $var << :ibefore
22
+ var << :ibefore
23
23
  end
24
24
  after do
25
- $var << :iafter
25
+ var << :iafter
26
26
  end
27
27
  around do |test|
28
- $var << :ibegin
28
+ var << :ibegin
29
29
  test.call
30
- $var << :iend
30
+ var << :iend
31
31
  end
32
32
  it 'testing' do
33
- $var << :during
33
+ var << :during
34
34
  end
35
35
  end
36
36
  end
data/test/nested_test.rb CHANGED
@@ -1,36 +1,35 @@
1
1
  require_relative 'helper'
2
2
  require 'minitest/around/unit'
3
3
 
4
- $var = []
5
-
6
4
  class OuterNestedTest < Minitest::Test
5
+ @@var = []
7
6
  def setup
8
- $var << :before
7
+ @@var << :before
9
8
  end
10
9
  def teardown
11
- $var << :after
12
- $var.must_equal [:before, :ibefore, :begin, :ibegin, :during, :iend, :end, :iafter, :after]
10
+ @@var << :after
11
+ @@var.must_equal [:before, :ibefore, :begin, :ibegin, :during, :iend, :end, :iafter, :after]
13
12
  end
14
13
  def around
15
- $var << :begin
14
+ @@var << :begin
16
15
  yield
17
- $var << :end
16
+ @@var << :end
18
17
  end
19
18
  end
20
19
 
21
20
  class InnerNestedTest < OuterNestedTest
22
21
  def setup
23
- $var << :ibefore
22
+ @@var << :ibefore
24
23
  end
25
24
  def teardown
26
- $var << :iafter
25
+ @@var << :iafter
27
26
  end
28
27
  def around
29
- $var << :ibegin
28
+ @@var << :ibegin
30
29
  yield
31
- $var << :iend
30
+ @@var << :iend
32
31
  end
33
32
  def test_nesting
34
- $var << :during
33
+ @@var << :during
35
34
  end
36
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-around
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Suschlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-15 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec-expectations
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  description: Alternative for setup/teardown dance.
84
70
  email:
85
71
  - peter-minitest-around@suschlik.de
@@ -128,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
114
  version: '0'
129
115
  requirements: []
130
116
  rubyforge_project:
131
- rubygems_version: 2.4.5
117
+ rubygems_version: 2.4.8
132
118
  signing_key:
133
119
  specification_version: 4
134
120
  summary: Around block for minitest.