allure-rspec 0.6.8 → 0.6.9

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: 0f8f7bec6b49c04903d8562724627fd7fcdc02e2
4
- data.tar.gz: e6206e6c334bacb9ca863cbfc893b52cd964edc0
3
+ metadata.gz: 32a710da1f1bf8cf4be4260c74b752e765817dbb
4
+ data.tar.gz: b827a5863b6e51184152a8b6296f6053c60f2cc2
5
5
  SHA512:
6
- metadata.gz: 5150e93eecca7f35af59d145f7710607a38069a26282b1e8e25e9d9ff6106c9feb6ecfaa0225915ffcfe8160feb9907bcd1ce3991933ddd869a3b767800c553e
7
- data.tar.gz: 9a5c4867d4f6d8afb64974740e19be21f5e9183f8b227779bf411e3e3063a9c7bf5c4bfff001b57aeea5db2dcb514b3cdbb0ceadf283379ceb05bcd50b8e80e1
6
+ metadata.gz: 3e7ec5812c7c6dcaacbe46b487c20961812156cf00cedd23033cf1b674107ff4b91c228284504021200b90a88851216fc4ee43f2fb3f06e6b680a7968fdb816e
7
+ data.tar.gz: 9d274c2a559284d5c381616ba06a37d5e3be0270376ec97d6e91f208d47fb0e9819ebc10b46b8c5f224b542e6091579e6ee30ddf00bcf490197d89a42a8107ae
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- allure-rspec (0.6.8)
5
- allure-ruby-adaptor-api (= 0.6.5)
6
- rspec (~> 3.0)
4
+ allure-rspec (0.6.9)
5
+ allure-ruby-adaptor-api (= 0.6.6)
6
+ rspec (~> 3.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- allure-ruby-adaptor-api (0.6.5)
11
+ allure-ruby-adaptor-api (0.6.6)
12
12
  mimemagic
13
13
  nokogiri (~> 1.6.0)
14
14
  uuid
@@ -17,21 +17,22 @@ GEM
17
17
  systemu (~> 2.6.2)
18
18
  mimemagic (0.2.1)
19
19
  mini_portile (0.6.2)
20
- nokogiri (1.6.5)
20
+ nokogiri (1.6.6.2)
21
21
  mini_portile (~> 0.6.0)
22
- rake (10.3.2)
23
- rspec (3.1.0)
24
- rspec-core (~> 3.1.0)
25
- rspec-expectations (~> 3.1.0)
26
- rspec-mocks (~> 3.1.0)
27
- rspec-core (3.1.7)
28
- rspec-support (~> 3.1.0)
29
- rspec-expectations (3.1.2)
22
+ rake (10.4.2)
23
+ rspec (3.2.0)
24
+ rspec-core (~> 3.2.0)
25
+ rspec-expectations (~> 3.2.0)
26
+ rspec-mocks (~> 3.2.0)
27
+ rspec-core (3.2.0)
28
+ rspec-support (~> 3.2.0)
29
+ rspec-expectations (3.2.0)
30
30
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.1.0)
32
- rspec-mocks (3.1.3)
33
- rspec-support (~> 3.1.0)
34
- rspec-support (3.1.2)
31
+ rspec-support (~> 3.2.0)
32
+ rspec-mocks (3.2.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.2.0)
35
+ rspec-support (3.2.1)
35
36
  systemu (2.6.4)
36
37
  uuid (2.3.7)
37
38
  macaddr (~> 1.0)
data/allure-rspec.gemspec CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ['lib']
20
20
 
21
- s.add_dependency 'rspec', '~> 3.0'
22
- s.add_dependency 'allure-ruby-adaptor-api', '0.6.5'
21
+ s.add_dependency 'rspec', '~> 3.2'
22
+ s.add_dependency 'allure-ruby-adaptor-api', '0.6.6'
23
23
 
24
24
  s.add_development_dependency 'bundler'
25
25
  s.add_development_dependency 'rake'
@@ -89,17 +89,22 @@ module AllureRSpec
89
89
  labels
90
90
  end
91
91
 
92
+ def method_or_key(metadata, key)
93
+ metadata.respond_to?(key) ? metadata.send(key) : metadata[key]
94
+ end
95
+
92
96
  def detect_feature_story(labels, example_or_group)
93
97
  metadata = metadata(example_or_group)
94
98
  is_group = group?(example_or_group)
95
- parent = metadata[:parent_example_group] || metadata[:example_group]
99
+ parent = (method_or_key(metadata, :parent_example_group))
96
100
  if labels[:feature] === true
97
- description = (!is_group && parent) ? parent[:description] : metadata[:description]
101
+ description = (!is_group && parent) ? method_or_key(parent, :description) : method_or_key(metadata, :description)
98
102
  labels[:feature] = description
99
103
  if labels[:story] === true
100
104
  if parent
101
- grandparent = parent && parent[:parent_example_group]
102
- labels[:feature] = (!is_group && grandparent) ? grandparent[:description] : parent[:description]
105
+ grandparent = parent && method_or_key(parent, :parent_example_group)
106
+ labels[:feature] = (!is_group && grandparent) ? method_or_key(grandparent, :description) :
107
+ method_or_key(parent, :description)
103
108
  end
104
109
  labels[:story] = description
105
110
  end
@@ -11,46 +11,68 @@ module AllureRSpec
11
11
  alias_method :old_hooks, :hooks
12
12
 
13
13
  def hooks
14
- if @__hooks.nil?
15
- old = old_hooks
16
- @__hooks ||= OverridenHookCollections.new(old.instance_variable_get(:@owner), old.instance_variable_get(:@data))
17
- [:before, :after].each { |scope|
18
- @__hooks[scope][:step] = HookCollection.new
19
- }
20
- end
21
- @__hooks
14
+ @__hooks ||= OverridenHookCollections.new(self, RSpec::Core::FilterableItemRepository::UpdateOptimized)
22
15
  end
23
16
 
24
17
  private
25
18
 
26
19
  class OverridenHookCollections < RSpec::Core::Hooks::HookCollections
27
- private
20
+ def initialize(*args)
21
+ super
22
+ @before_step_hooks = nil
23
+ @after_step_hooks = nil
24
+ end
28
25
 
29
- SCOPES = [:example, :context, :suite, :step]
30
26
 
31
- def before_step_hooks_for(example)
32
- RSpec::Core::Hooks::HookCollection.new(RSpec::Core::FlatMap.flat_map(@owner.parent_groups.reverse) do |a|
33
- a.hooks[:before][:step]
34
- end).for(example)
27
+ def run(position, scope, example_or_group)
28
+ if scope == :step
29
+ run_owned_hooks_for(position, scope, example_or_group)
30
+ else
31
+ super
32
+ end
35
33
  end
36
34
 
37
- def after_step_hooks_for(example)
38
- RSpec::Core::Hooks::HookCollection.new(RSpec::Core::FlatMap.flat_map(@owner.parent_groups) do |a|
39
- a.hooks[:after][:step]
40
- end).for(example)
35
+ protected
36
+
37
+ # TODO: This code is highly related to the RSpec internals.
38
+ # It should be supported with every new RSpec version
39
+ def matching_hooks_for(position, scope, example_or_group)
40
+ if scope == :step
41
+ repo = hooks_for(position, scope) || example_or_group.example_group.hooks.hooks_for(position, scope)
42
+ metadata = case example_or_group
43
+ when RSpec::Core::ExampleGroup then
44
+ example_or_group.class.metadata
45
+ else
46
+ example_or_group.metadata
47
+ end
48
+ repo.nil? ? EMPTY_HOOK_ARRAY : repo.items_for(metadata)
49
+ else
50
+ super
51
+ end
41
52
  end
42
53
 
43
- def find_hook(hook, scope, example_or_group, initial_procsy)
44
- case [hook, scope]
45
- when [:before, :step]
46
- before_step_hooks_for(example_or_group)
47
- when [:after, :step]
48
- after_step_hooks_for(example_or_group)
54
+ def hooks_for(position, scope)
55
+ if scope == :step
56
+ position == :before ? @before_step_hooks : @after_step_hooks
57
+ else
58
+ super
59
+ end
60
+ end
61
+
62
+ def ensure_hooks_initialized_for(position, scope)
63
+ if scope == :step
64
+ if position == :before
65
+ @before_step_hooks ||= @filterable_item_repo_class.new(:all?)
49
66
  else
50
- super(hook, scope, example_or_group, initial_procsy)
67
+ @after_step_hooks ||= @filterable_item_repo_class.new(:all?)
68
+ end
69
+ else
70
+ super
51
71
  end
52
72
  end
53
73
 
74
+ SCOPES = [:example, :context, :step]
75
+
54
76
  def known_scope?(scope)
55
77
  SCOPES.include?(scope) || super(scope)
56
78
  end
@@ -1,5 +1,5 @@
1
1
  module AllureRSpec # :nodoc:
2
2
  module Version # :nodoc:
3
- STRING = '0.6.8'
3
+ STRING = '0.6.9'
4
4
  end
5
5
  end
@@ -6,20 +6,20 @@ shared_examples_for "a collection" do
6
6
 
7
7
  context "initialized with 3 items" do
8
8
  it "says it has three items" do
9
- collection.size.should eq(3)
9
+ expect(collection.size).to be 3
10
10
  end
11
11
  end
12
12
 
13
13
  describe "#include?" do
14
14
  context "with an an item that is in the collection" do
15
15
  it "returns true" do
16
- collection.include?(7).should be_true
16
+ expect(collection.include?(7)).to be true
17
17
  end
18
18
  end
19
19
 
20
20
  context "with an an item that is not in the collection" do
21
21
  it "returns false" do
22
- collection.include?(9).should be_false
22
+ expect(collection.include?(9)).to be false
23
23
  end
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allure-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Sadykov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-19 00:00:00.000000000 Z
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: allure-ruby-adaptor-api
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.5
33
+ version: 0.6.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.6.5
40
+ version: 0.6.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -113,6 +113,6 @@ rubyforge_project:
113
113
  rubygems_version: 2.0.3
114
114
  signing_key:
115
115
  specification_version: 4
116
- summary: allure-rspec-0.6.8
116
+ summary: allure-rspec-0.6.9
117
117
  test_files: []
118
118
  has_rdoc: