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 +4 -4
- data/Gemfile.lock +18 -17
- data/allure-rspec.gemspec +2 -2
- data/lib/allure-rspec/formatter.rb +9 -4
- data/lib/allure-rspec/hooks.rb +47 -25
- data/lib/allure-rspec/version.rb +1 -1
- data/spec/shared_example_spec.rb +3 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32a710da1f1bf8cf4be4260c74b752e765817dbb
|
4
|
+
data.tar.gz: b827a5863b6e51184152a8b6296f6053c60f2cc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
5
|
-
allure-ruby-adaptor-api (= 0.6.
|
6
|
-
rspec (~> 3.
|
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.
|
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.
|
20
|
+
nokogiri (1.6.6.2)
|
21
21
|
mini_portile (~> 0.6.0)
|
22
|
-
rake (10.
|
23
|
-
rspec (3.
|
24
|
-
rspec-core (~> 3.
|
25
|
-
rspec-expectations (~> 3.
|
26
|
-
rspec-mocks (~> 3.
|
27
|
-
rspec-core (3.
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-expectations (3.
|
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.
|
32
|
-
rspec-mocks (3.
|
33
|
-
|
34
|
-
|
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.
|
22
|
-
s.add_dependency 'allure-ruby-adaptor-api', '0.6.
|
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
|
99
|
+
parent = (method_or_key(metadata, :parent_example_group))
|
96
100
|
if labels[:feature] === true
|
97
|
-
description = (!is_group && parent) ? parent
|
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
|
102
|
-
labels[:feature] = (!is_group && grandparent) ? grandparent
|
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
|
data/lib/allure-rspec/hooks.rb
CHANGED
@@ -11,46 +11,68 @@ module AllureRSpec
|
|
11
11
|
alias_method :old_hooks, :hooks
|
12
12
|
|
13
13
|
def hooks
|
14
|
-
|
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
|
-
|
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
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
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
|
data/lib/allure-rspec/version.rb
CHANGED
data/spec/shared_example_spec.rb
CHANGED
@@ -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.
|
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).
|
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).
|
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.
|
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-
|
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.
|
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.
|
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.
|
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.
|
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.
|
116
|
+
summary: allure-rspec-0.6.9
|
117
117
|
test_files: []
|
118
118
|
has_rdoc:
|