specify 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +1 -0
- data/lib/specify/rspec/example_group.rb +33 -6
- data/lib/specify/rspec/notification.rb +3 -0
- data/lib/specify/rspec/reporter.rb +2 -14
- data/lib/specify/rspec/world.rb +4 -0
- data/lib/specify/spec.rb +19 -0
- data/lib/specify/version.rb +1 -1
- data/lib/specify.rb +1 -0
- data/spec/shared_steps_spec.rb +22 -6
- data/spec/spec_helper.rb +7 -1
- data/spec/steps_spec.rb +14 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c481008f53c158790b8973606e46818aa144aa2
|
4
|
+
data.tar.gz: d1650d893f25b1c2a58084d1309d25f159df06d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37b8be3fed44a9fea07ddf144bc20f80488ac04990d35176c3274467707fcc30bed0114d7bc28c4b79f823728df92f1680f08ecef1f53af6f6957c3b0f6656e0
|
7
|
+
data.tar.gz: ef72dc01b56e3deee8709ce44a0138f2f6a97b414a9a61c3a1832bf4879cee29357c1fe414ca15b1014a62bc551e411eb9d6a7ad25e972c5a17fc720ed2f9440
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Codeship Status for jnyman/specify](https://www.codeship.io/projects/6fd98900-39d1-0132-7358-4e57ec3927cd/status)](https://www.codeship.io/projects/42264)
|
4
4
|
|
5
|
+
[![Coverage Status](https://img.shields.io/coveralls/jnyman/specify.svg)](https://coveralls.io/r/jnyman/specify?branch=master)
|
5
6
|
[![Gem Version](https://badge.fury.io/rb/specify.svg)](http://badge.fury.io/rb/specify)
|
6
7
|
[![Dependency Status](https://gemnasium.com/jnyman/specify.svg)](https://gemnasium.com/jnyman/specify)
|
7
8
|
[![Code Climate](https://codeclimate.com/github/jnyman/specify/badges/gpa.svg)](https://codeclimate.com/github/jnyman/specify)
|
@@ -1,6 +1,14 @@
|
|
1
1
|
module RSpec
|
2
2
|
module Specify
|
3
3
|
module ExampleGroup
|
4
|
+
|
5
|
+
# In Rspec, example group bodies are delimited by 'describe' and
|
6
|
+
# 'context' methods. These encapsulate examples, which are
|
7
|
+
# delimited by 'it' methods. Example groups are evaluated in the
|
8
|
+
# context of an ExampleGroup instance. Individual examples are
|
9
|
+
# evaluated in the context of an instance of the ExampleGroup
|
10
|
+
# to which they belong.
|
11
|
+
|
4
12
|
def include_steps(*args)
|
5
13
|
name = args.shift
|
6
14
|
shared_block = ::RSpec.world.shared_example_steps[name]
|
@@ -9,27 +17,46 @@ module RSpec
|
|
9
17
|
end
|
10
18
|
|
11
19
|
def Given(message, options={}, &block)
|
12
|
-
|
20
|
+
Step :given, message, options, &block
|
13
21
|
end
|
14
22
|
|
15
23
|
def When(message, options={}, &block)
|
16
|
-
|
24
|
+
Step :when, message, options, &block
|
17
25
|
end
|
18
26
|
|
19
27
|
def Then(message, options={}, &block)
|
20
|
-
|
28
|
+
Step :then, message, options, &block
|
21
29
|
end
|
22
30
|
|
23
31
|
def And(message, options = {}, &block)
|
24
|
-
|
32
|
+
Step :and, message, options, &block
|
25
33
|
end
|
26
34
|
|
27
35
|
def But(message, options = {}, &block)
|
28
|
-
|
36
|
+
Step :but, message, options, &block
|
29
37
|
end
|
30
38
|
|
31
39
|
def _(message, options = {}, &block)
|
32
|
-
|
40
|
+
Step :_, message, options, &block
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def Step(type, message, options = {}, &block)
|
46
|
+
::RSpec.world.reporter.example_step_started(self, type, message, options)
|
47
|
+
|
48
|
+
if block_given? && !options[:pending]
|
49
|
+
begin
|
50
|
+
yield
|
51
|
+
rescue Exception => e
|
52
|
+
::RSpec.world.reporter.example_step_failed(self, type, message, options)
|
53
|
+
raise e
|
54
|
+
end
|
55
|
+
::RSpec.world.reporter.example_step_passed(self, type, message, options)
|
56
|
+
else
|
57
|
+
::RSpec.world.reporter.example_step_pending(self, type, message, options)
|
58
|
+
end
|
59
|
+
|
33
60
|
end
|
34
61
|
end
|
35
62
|
end
|
@@ -1,21 +1,9 @@
|
|
1
1
|
module RSpec
|
2
2
|
module Specify
|
3
3
|
module Reporter
|
4
|
-
def process_example_step(example, type, message, options)
|
5
|
-
example_step_started(self, type, message, options)
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
yield
|
10
|
-
rescue Exception => e
|
11
|
-
example_step_failed(self, type, message, options)
|
12
|
-
raise e
|
13
|
-
end
|
14
|
-
example_step_passed(self, type, message, options)
|
15
|
-
else
|
16
|
-
example_step_pending(self, type, message, options)
|
17
|
-
end
|
18
|
-
end
|
5
|
+
# An RSpec reporter sends notifications to listeners. The listeners
|
6
|
+
# are usually formatters for a specific test run.
|
19
7
|
|
20
8
|
def example_step_started(example, type, message, options)
|
21
9
|
notify :example_step_started, Notification.new(example, type, message, options)
|
data/lib/specify/rspec/world.rb
CHANGED
data/lib/specify/spec.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Specify
|
2
|
+
module Spec
|
3
|
+
def self.included(base)
|
4
|
+
base.instance_eval do
|
5
|
+
alias :Background :before
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.Feature(*args, &block)
|
12
|
+
describe(*args, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.Ability(*args, &block)
|
16
|
+
describe(*args, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec.configuration.include Specify::Spec
|
data/lib/specify/version.rb
CHANGED
data/lib/specify.rb
CHANGED
@@ -11,6 +11,7 @@ require 'rspec/core/formatters'
|
|
11
11
|
require 'rspec/core/formatters/console_codes'
|
12
12
|
require 'rspec/core/formatters/documentation_formatter'
|
13
13
|
|
14
|
+
require 'specify/spec'
|
14
15
|
require 'specify/rspec/example_group'
|
15
16
|
require 'specify/rspec/notification'
|
16
17
|
require 'specify/rspec/reporter'
|
data/spec/shared_steps_spec.rb
CHANGED
@@ -30,7 +30,19 @@ shared_steps 'pull steps' do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
context 'duplicate shared steps' do
|
34
|
+
it 'will raise an error' do
|
35
|
+
expect {
|
36
|
+
shared_steps 'duplicate' do
|
37
|
+
end
|
38
|
+
|
39
|
+
shared_steps 'duplicate' do
|
40
|
+
end
|
41
|
+
}.to raise_error
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
Feature 'shared steps' do
|
34
46
|
let(:pipe) do
|
35
47
|
Class.new do
|
36
48
|
def initialize
|
@@ -55,22 +67,26 @@ describe 'shared steps' do
|
|
55
67
|
end.new
|
56
68
|
end
|
57
69
|
|
58
|
-
|
70
|
+
Scenario 'push and pull steps' do
|
59
71
|
include_steps 'push steps'
|
60
72
|
include_steps 'pull steps'
|
61
73
|
end
|
62
74
|
|
63
|
-
|
75
|
+
Scenario 'push, count and pull' do
|
64
76
|
include_steps 'push steps'
|
77
|
+
|
65
78
|
Then 'pipe should have one item' do
|
66
79
|
expect(pipe.items.size).to eq(1)
|
67
80
|
end
|
81
|
+
|
68
82
|
include_steps 'pull steps'
|
69
83
|
end
|
70
84
|
|
71
|
-
|
72
|
-
include_steps 'push with argument steps', '
|
73
|
-
|
85
|
+
Scenario 'push with arguments and pull' do
|
86
|
+
include_steps 'push with argument steps', 'specify'
|
87
|
+
|
88
|
+
expect(pipe.items).to eq(['specify'])
|
89
|
+
|
74
90
|
include_steps 'pull steps'
|
75
91
|
end
|
76
92
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require 'simplecov'
|
2
|
+
require 'coveralls'
|
2
3
|
|
3
|
-
|
4
|
+
Coveralls.wear!
|
5
|
+
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
Coveralls::SimpleCov::Formatter
|
9
|
+
]
|
4
10
|
|
5
11
|
SimpleCov.start do
|
6
12
|
add_filter '/spec/'
|
data/spec/steps_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
Ability 'specify steps' do
|
4
4
|
describe 'Given/When/Then' do
|
5
5
|
steps 'should execute blocks' do
|
6
6
|
Given 'context' do
|
@@ -41,6 +41,19 @@ describe 'specify steps' do
|
|
41
41
|
Given 'step without block'
|
42
42
|
When 'step without block'
|
43
43
|
Then 'step without block'
|
44
|
+
|
45
|
+
Given 'step without block and tag', pending: true
|
46
|
+
Given 'step without block and message', pending: 'wip'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe 'Failing steps' do
|
51
|
+
steps 'will fail' do
|
52
|
+
expect {
|
53
|
+
_ 'expectation alerts failure' do
|
54
|
+
expect(2 + 2).to eq 5
|
55
|
+
end
|
56
|
+
}.to raise_error
|
44
57
|
end
|
45
58
|
end
|
46
59
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Nyman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/specify/rspec/reporter.rb
|
89
89
|
- lib/specify/rspec/shared_steps.rb
|
90
90
|
- lib/specify/rspec/world.rb
|
91
|
+
- lib/specify/spec.rb
|
91
92
|
- lib/specify/version.rb
|
92
93
|
- spec/shared_steps_spec.rb
|
93
94
|
- spec/spec_helper.rb
|
@@ -98,7 +99,7 @@ licenses:
|
|
98
99
|
- MIT
|
99
100
|
metadata: {}
|
100
101
|
post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n
|
101
|
-
\ Specify 0.
|
102
|
+
\ Specify 0.3.0 has been installed.\n\n(::) (::) (::) (::) (::) (::) (::) (::) (::)
|
102
103
|
(::) (::) (::)\n "
|
103
104
|
rdoc_options: []
|
104
105
|
require_paths:
|