allure-rspec 0.8.0 → 2.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +192 -42
- data/lib/allure-rspec.rb +19 -47
- data/lib/allure_rspec/_utils.rb +12 -0
- data/lib/allure_rspec/config.rb +106 -0
- data/lib/allure_rspec/formatter.rb +141 -0
- data/lib/allure_rspec/metadata_parser.rb +186 -0
- data/lib/allure_rspec/suite_labels.rb +50 -0
- metadata +32 -63
- data/.gitignore +0 -15
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -49
- data/allure-rspec.gemspec +0 -26
- data/lib/allure-rspec/adaptor.rb +0 -15
- data/lib/allure-rspec/dsl.rb +0 -61
- data/lib/allure-rspec/formatter.rb +0 -117
- data/lib/allure-rspec/hooks.rb +0 -86
- data/lib/allure-rspec/version.rb +0 -5
- data/logo.png +0 -0
- data/spec/another_spec.rb +0 -21
- data/spec/extend_steps_spec.rb +0 -86
- data/spec/hooks_spec.rb +0 -12
- data/spec/issue51_spec.rb +0 -11
- data/spec/nometavalue_spec.rb +0 -11
- data/spec/shared_example_spec.rb +0 -34
- data/spec/spec_helper.rb +0 -20
data/lib/allure-rspec/hooks.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
module AllureRSpec
|
2
|
-
module Hooks
|
3
|
-
|
4
|
-
def self.included(cls)
|
5
|
-
cls.extend OverrideHooksMethods
|
6
|
-
end
|
7
|
-
|
8
|
-
module OverrideHooksMethods
|
9
|
-
include RSpec::Core::Hooks
|
10
|
-
|
11
|
-
alias_method :old_hooks, :hooks
|
12
|
-
|
13
|
-
def hooks
|
14
|
-
@__hooks ||= OverridenHookCollections.new(old_hooks)
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
class OverridenHookCollections < RSpec::Core::Hooks::HookCollections
|
20
|
-
def initialize(original)
|
21
|
-
super(original.instance_eval("@owner"), original.instance_eval("@filterable_item_repo_class"))
|
22
|
-
[:@before_example_hooks, :@after_example_hooks, :@before_context_hooks, :@after_context_hooks, :@around_example_hooks].each { |var|
|
23
|
-
instance_variable_set(var, original.instance_eval("#{var}"))
|
24
|
-
}
|
25
|
-
@before_step_hooks = nil
|
26
|
-
@after_step_hooks = nil
|
27
|
-
end
|
28
|
-
|
29
|
-
def run(position, scope, example_or_group)
|
30
|
-
if scope == :step
|
31
|
-
run_owned_hooks_for(position, scope, example_or_group)
|
32
|
-
else
|
33
|
-
super
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
protected
|
38
|
-
|
39
|
-
# TODO: This code is highly related to the RSpec internals.
|
40
|
-
# It should be supported with every new RSpec version
|
41
|
-
def matching_hooks_for(position, scope, example_or_group)
|
42
|
-
if scope == :step
|
43
|
-
repo = hooks_for(position, scope) || example_or_group.example_group.hooks.hooks_for(position, scope)
|
44
|
-
metadata = case example_or_group
|
45
|
-
when RSpec::Core::ExampleGroup then
|
46
|
-
example_or_group.class.metadata
|
47
|
-
else
|
48
|
-
example_or_group.metadata
|
49
|
-
end
|
50
|
-
repo.nil? ? EMPTY_HOOK_ARRAY : repo.items_for(metadata)
|
51
|
-
else
|
52
|
-
super
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def hooks_for(position, scope)
|
57
|
-
if scope == :step
|
58
|
-
position == :before ? @before_step_hooks : @after_step_hooks
|
59
|
-
else
|
60
|
-
super
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def ensure_hooks_initialized_for(position, scope)
|
65
|
-
if scope == :step
|
66
|
-
if position == :before
|
67
|
-
@before_step_hooks ||= @filterable_item_repo_class.new(:all?)
|
68
|
-
else
|
69
|
-
@after_step_hooks ||= @filterable_item_repo_class.new(:all?)
|
70
|
-
end
|
71
|
-
else
|
72
|
-
super
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
SCOPES = [:example, :context, :step]
|
77
|
-
|
78
|
-
def known_scope?(scope)
|
79
|
-
SCOPES.include?(scope) || super(scope)
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
data/lib/allure-rspec/version.rb
DELETED
data/logo.png
DELETED
Binary file
|
data/spec/another_spec.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'tempfile'
|
3
|
-
|
4
|
-
describe "Some another spec", :feature => ["Some Feature"], :severity => :normal do
|
5
|
-
|
6
|
-
before(:suite) do
|
7
|
-
puts "before suite"
|
8
|
-
end
|
9
|
-
|
10
|
-
after(:suite) do
|
11
|
-
puts "after suite"
|
12
|
-
end
|
13
|
-
|
14
|
-
it "10 cannot be greater than 19", :story => ["Some story"], :testId => 10 do
|
15
|
-
expect(10).to be > 19
|
16
|
-
end
|
17
|
-
|
18
|
-
it "4 must not be equal to 5", :testId => 20 do
|
19
|
-
expect(5).to be eql(4)
|
20
|
-
end
|
21
|
-
end
|
data/spec/extend_steps_spec.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'tempfile'
|
3
|
-
|
4
|
-
describe AllureRSpec, :feature => "Basics" do
|
5
|
-
|
6
|
-
before(:suite) do
|
7
|
-
puts "before suite"
|
8
|
-
end
|
9
|
-
|
10
|
-
before(:context) do
|
11
|
-
puts "before context"
|
12
|
-
end
|
13
|
-
|
14
|
-
before(:step) do |s|
|
15
|
-
puts "before step #{s.current_step}"
|
16
|
-
end
|
17
|
-
|
18
|
-
before(:example) do
|
19
|
-
puts "before example"
|
20
|
-
end
|
21
|
-
|
22
|
-
after(:step) do |s|
|
23
|
-
puts "after step #{s.current_step}"
|
24
|
-
end
|
25
|
-
|
26
|
-
after(:example) do
|
27
|
-
puts "after example"
|
28
|
-
end
|
29
|
-
|
30
|
-
after(:suite) do
|
31
|
-
puts "after suite"
|
32
|
-
end
|
33
|
-
|
34
|
-
after(:context) do
|
35
|
-
puts "after all"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should build", :story => "Main story" do |e|
|
39
|
-
e.attach_file "test-file1", Tempfile.new("test")
|
40
|
-
e.step "step1" do |step|
|
41
|
-
step.attach_file "test-file2", Tempfile.new("test")
|
42
|
-
end
|
43
|
-
|
44
|
-
e.step "step2" do |step|
|
45
|
-
step.attach_file "logo", File.new("logo.png")
|
46
|
-
expect(5).to be > 1
|
47
|
-
end
|
48
|
-
|
49
|
-
e.step "step3" do
|
50
|
-
expect(0).to eq(1)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should be failed example" do
|
55
|
-
fail_spec "Failure"
|
56
|
-
end
|
57
|
-
|
58
|
-
def fail_spec(desc)
|
59
|
-
raise RSpec::Expectations::ExpectationNotMetError.new(desc)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should raise exception" do |e|
|
63
|
-
|
64
|
-
e.step "step1" do
|
65
|
-
expect(5).to be > 1
|
66
|
-
end
|
67
|
-
|
68
|
-
e.step "step2" do
|
69
|
-
raise "Undesired exception"
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
it "is a pending example"
|
75
|
-
|
76
|
-
context "some context" do
|
77
|
-
it do |e|
|
78
|
-
expect("aa").to eq("aa")
|
79
|
-
end
|
80
|
-
|
81
|
-
it do |e|
|
82
|
-
expect(5).to eq(6)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
data/spec/hooks_spec.rb
DELETED
data/spec/issue51_spec.rb
DELETED
data/spec/nometavalue_spec.rb
DELETED
data/spec/shared_example_spec.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require "set"
|
3
|
-
|
4
|
-
shared_examples_for "a collection" do
|
5
|
-
let(:collection) { described_class.new([7, 2, 4]) }
|
6
|
-
|
7
|
-
context "initialized with 3 items" do
|
8
|
-
it "says it has three items" do
|
9
|
-
expect(collection.size).to be 3
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#include?" do
|
14
|
-
context "with an an item that is in the collection" do
|
15
|
-
it "returns true" do
|
16
|
-
expect(collection.include?(7)).to be true
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "with an an item that is not in the collection" do
|
21
|
-
it "returns false" do
|
22
|
-
expect(collection.include?(9)).to be false
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe Array do
|
29
|
-
it_behaves_like "a collection"
|
30
|
-
end
|
31
|
-
|
32
|
-
describe Set do
|
33
|
-
it_behaves_like "a collection"
|
34
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'allure-rspec'
|
3
|
-
require 'nokogiri'
|
4
|
-
|
5
|
-
RSpec.configure do |c|
|
6
|
-
c.include AllureRSpec::Adaptor
|
7
|
-
|
8
|
-
c.before(:suite) do
|
9
|
-
puts 'Before Suite Spec helper'
|
10
|
-
end
|
11
|
-
|
12
|
-
c.before(:all) do
|
13
|
-
puts 'Before all Spec helper'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
AllureRSpec.configure do |c|
|
18
|
-
c.output_dir = "allure"
|
19
|
-
end
|
20
|
-
|