rspec-retry-flaky 0.2.0 → 0.2.1

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: 15ef2b9e60343c399af3125be74b60d0139ad148
4
- data.tar.gz: 6327509a69580d562fdc40053480dbd506d06298
3
+ metadata.gz: 6b94f1bf79fd87ca50dcc474003429df0ace7983
4
+ data.tar.gz: bae8510497ed3c3f42e67b04e82d1346f7d269d6
5
5
  SHA512:
6
- metadata.gz: d092d0960a33c5770b5379b7c7229fe87318c855f34068c9d9090497e09f5d1b6eb94738295bb0cc16b69caf45055f692637630713edf57f5907bcdd4d4ed99a
7
- data.tar.gz: 97d912cc161ee892ebdd99d1347e5a95d3f7b7ec6b50660ea88abaf8d2716b558b8f16dcbcb858f308e547905d6ebcfe9eeb2562b4b4092bfe53bb32c8a5d7c8
6
+ metadata.gz: 9b6d85602068e70486196f965621384ab41ff4159756ac0b4fe1609c010165c824b902ce07de3c3f64030d1b513fbd1dbc3620afc037438037eec09b7cf618a8
7
+ data.tar.gz: 12274871b996fbaf43ad90e2503243a239fb6459661cbb3ad6f611b158a7317438c3d4a9854c175b61b2cb571f7b6c1bfff9bc4b2c709e436a96222f4e9c5bde
data/README.md CHANGED
@@ -51,9 +51,9 @@ It can use in Turnip.
51
51
  ```
52
52
  @off_flaky_test
53
53
  Feature: example
54
- Scenario: attack the monster
55
- When I attack it
56
- Then it should die
54
+ Scenario: sample scenario
55
+ When example step
56
+ Then example expected
57
57
  ```
58
58
 
59
59
  ### progress message when the example retry
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  class Flaky
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -10,12 +10,21 @@ module RSpec
10
10
  conf.add_setting :flaky_retry_count, :default => 1
11
11
  conf.add_setting :flaky_sleep_interval, :default => 0
12
12
 
13
+ # from rspec/rspec-core
14
+ # context.example is deprecated, but RSpec.current_example is not
15
+ # available until RSpec 3.0.
16
+ fetch_current_example = RSpec.respond_to?(:current_example) ?
17
+ proc { RSpec.current_example } : proc { |context| context.example }
18
+
13
19
  conf.around(:example) do |example|
14
20
  retry_count = RSpec.configuration.flaky_retry_count
15
21
  sleep_interval = RSpec.configuration.flaky_sleep_interval
16
22
 
23
+ # from rspec/rspec-core
24
+ current_example = fetch_current_example.call(self)
25
+
17
26
  if example.metadata[:off_flaky_test]
18
- RSpec.configuration.reporter.message "\nTurn retry flaky off: #{example.location}"
27
+ RSpec.configuration.reporter.message "\n[Tag]off_flaky_test: #{current_example.location}"
19
28
  retry_count = 1 # make retry_count default
20
29
  end
21
30
 
@@ -25,10 +34,10 @@ module RSpec
25
34
  RSpec.configuration.reporter.message msg
26
35
  end
27
36
 
28
- example.clear_exception
37
+ current_example.clear_exception
29
38
  example.run
30
39
 
31
- break if example.exception.nil?
40
+ break if current_example.exception.nil?
32
41
 
33
42
  sleep sleep_interval if sleep_interval.to_i > 0
34
43
 
@@ -1,10 +1,8 @@
1
1
  module RSpec
2
2
  module Core
3
3
  class Example
4
- class Procsy
5
- def clear_exception
6
- @exception = nil
7
- end
4
+ def clear_exception
5
+ @exception = nil
8
6
  end
9
7
  end
10
8
  end
@@ -44,9 +44,6 @@ describe RSpec::Flaky do
44
44
  end
45
45
  end
46
46
 
47
- # raise error at rspec-expectations-3.1.2/lib/rspec/expectations/fail_with.rb:30:in `fail_with'
48
- # But count and expectations are expected.
49
- # TODO Should make stable.
50
47
  context 'with retry count' do
51
48
  let(:retry_count) { 3 }
52
49
  before(:all) { RSpec.configure { |c| c.flaky_retry_count = 3 } }
@@ -59,7 +56,6 @@ describe RSpec::Flaky do
59
56
  end
60
57
  end
61
58
 
62
- =begin
63
59
  context do
64
60
  before(:all) { set_expectations([false, false, true]) }
65
61
 
@@ -78,7 +74,6 @@ describe RSpec::Flaky do
78
74
  expect(count).to eq 2
79
75
  end
80
76
  end
81
- =end
82
77
 
83
78
  end
84
79
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-retry-flaky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-01 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec