specify 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +10 -0
- data/Rakefile +18 -0
- data/lib/specify/rspec/example_group.rb +5 -1
- data/lib/specify/rspec/shared_steps.rb +2 -2
- data/lib/specify/version.rb +1 -1
- data/spec/shared_steps_spec.rb +76 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/steps_spec.rb +47 -0
- data/specify.gemspec +1 -0
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51a6a40ea1a8835716239602449fa4b8feb22a8f
|
4
|
+
data.tar.gz: c96cf0c60973e219a2546ec7ff04a5767392a855
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34052922c3cbc64d2fc96215996ce4b23f44c3abea5e2b9e6480322f2da1be17755e71d53198b29e75143b837bf23d54498aa6e31b5739e865e253bd69e27926
|
7
|
+
data.tar.gz: c7df422b9314f06096b123549c949aaa1652580bcd28d1d6d6f6e198500ce494040734fa366399c5c06569bc1f288df50b8d4c24d7a3c26d7965ca54eef08e53
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Specify
|
2
2
|
|
3
|
+
[](https://www.codeship.io/projects/42264)
|
4
|
+
|
5
|
+
[](http://badge.fury.io/rb/specify)
|
6
|
+
[](https://gemnasium.com/jnyman/specify)
|
7
|
+
[](https://codeclimate.com/github/jnyman/specify)
|
8
|
+
|
9
|
+
[](https://gitter.im/jnyman/specify)
|
10
|
+
[](https://coderwall.com/jnyman)
|
11
|
+
[](https://waffle.io/jnyman/specify)
|
12
|
+
|
3
13
|
Specify is a BDD-style micro-framework.
|
4
14
|
|
5
15
|
Specify is a very thin wrapper around RSpec that provides a Gherkin-style syntax for use with test examples.
|
data/Rakefile
CHANGED
@@ -1,2 +1,20 @@
|
|
1
|
+
#!/usr/bin/env rake
|
1
2
|
require 'bundler/gem_tasks'
|
3
|
+
require 'rspec/core/rake_task'
|
2
4
|
|
5
|
+
namespace :spec do
|
6
|
+
desc 'Clean all generated reports'
|
7
|
+
task :clean do
|
8
|
+
system('rm -rf spec/reports')
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec::Core::RakeTask.new(:all => :clean) do |config|
|
12
|
+
options = %w(--color)
|
13
|
+
options += %w(--format documentation)
|
14
|
+
options += %w(--format html --out spec/reports/unit-test-report.html)
|
15
|
+
|
16
|
+
config.rspec_opts = options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
task default: %w(spec:all)
|
@@ -3,7 +3,7 @@ module RSpec
|
|
3
3
|
module ExampleGroup
|
4
4
|
def include_steps(*args)
|
5
5
|
name = args.shift
|
6
|
-
shared_block = RSpec.world.shared_example_steps[name]
|
6
|
+
shared_block = ::RSpec.world.shared_example_steps[name]
|
7
7
|
shared_block or raise ArgumentError, "Could not find shared steps #{name.inspect}"
|
8
8
|
instance_exec(*args, &shared_block)
|
9
9
|
end
|
@@ -27,6 +27,10 @@ module RSpec
|
|
27
27
|
def But(message, options = {}, &block)
|
28
28
|
RSpec.world.reporter.process_example_step(self, :but, message, options, &block)
|
29
29
|
end
|
30
|
+
|
31
|
+
def _(message, options = {}, &block)
|
32
|
+
RSpec.world.reporter.process_example_step(self, :_, message, options, &block)
|
33
|
+
end
|
30
34
|
end
|
31
35
|
end
|
32
36
|
end
|
@@ -3,13 +3,13 @@ module RSpec
|
|
3
3
|
module SharedSteps
|
4
4
|
def shared_steps(name, &block)
|
5
5
|
ensure_shared_example_steps_name_not_taken(name)
|
6
|
-
RSpec.world.shared_example_steps[name] = block
|
6
|
+
::RSpec.world.shared_example_steps[name] = block
|
7
7
|
end
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
11
|
def ensure_shared_example_steps_name_not_taken(name)
|
12
|
-
if RSpec.world.shared_example_steps.has_key?(name)
|
12
|
+
if ::RSpec.world.shared_example_steps.has_key?(name)
|
13
13
|
raise ArgumentError.new("Shared step '#{name}' already exists")
|
14
14
|
end
|
15
15
|
end
|
data/lib/specify/version.rb
CHANGED
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_steps 'push steps' do
|
4
|
+
Given 'empty pipe' do
|
5
|
+
pipe.clear
|
6
|
+
end
|
7
|
+
|
8
|
+
When 'push data' do
|
9
|
+
pipe.push 'testing'
|
10
|
+
end
|
11
|
+
|
12
|
+
Then 'pipe should have data' do
|
13
|
+
expect(pipe.items).to eq(['testing'])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
shared_steps 'push with argument steps' do |value|
|
18
|
+
When 'push data' do
|
19
|
+
pipe.push value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
shared_steps 'pull steps' do
|
24
|
+
When 'pull data' do
|
25
|
+
pipe.pull
|
26
|
+
end
|
27
|
+
|
28
|
+
Then 'pipe should be empty' do
|
29
|
+
expect(pipe.items).to eq([])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'shared steps' do
|
34
|
+
let(:pipe) do
|
35
|
+
Class.new do
|
36
|
+
def initialize
|
37
|
+
@values = []
|
38
|
+
end
|
39
|
+
|
40
|
+
def items
|
41
|
+
@values
|
42
|
+
end
|
43
|
+
|
44
|
+
def clear
|
45
|
+
@values = []
|
46
|
+
end
|
47
|
+
|
48
|
+
def push(value)
|
49
|
+
@values << value
|
50
|
+
end
|
51
|
+
|
52
|
+
def pull
|
53
|
+
@values.shift
|
54
|
+
end
|
55
|
+
end.new
|
56
|
+
end
|
57
|
+
|
58
|
+
steps 'push and pull steps' do
|
59
|
+
include_steps 'push steps'
|
60
|
+
include_steps 'pull steps'
|
61
|
+
end
|
62
|
+
|
63
|
+
steps 'push, count and pull' do
|
64
|
+
include_steps 'push steps'
|
65
|
+
Then 'pipe should have one item' do
|
66
|
+
expect(pipe.items.size).to eq(1)
|
67
|
+
end
|
68
|
+
include_steps 'pull steps'
|
69
|
+
end
|
70
|
+
|
71
|
+
steps 'push with arguments and pull' do
|
72
|
+
include_steps 'push with argument steps', 'testing'
|
73
|
+
expect(pipe.items).to eq(['testing'])
|
74
|
+
include_steps 'pull steps'
|
75
|
+
end
|
76
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
4
|
+
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter '/spec/'
|
7
|
+
coverage_dir "#{SimpleCov.root}/spec/reports/coverage"
|
8
|
+
minimum_coverage 90
|
9
|
+
maximum_coverage_drop 5
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'specify'
|
data/spec/steps_spec.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'specify steps' do
|
4
|
+
describe 'Given/When/Then' do
|
5
|
+
steps 'should execute blocks' do
|
6
|
+
Given 'context' do
|
7
|
+
@context = 'Given value'
|
8
|
+
end
|
9
|
+
|
10
|
+
When 'action' do
|
11
|
+
@action = 'When value'
|
12
|
+
end
|
13
|
+
|
14
|
+
Then 'observable' do
|
15
|
+
@result = 'Then value'
|
16
|
+
end
|
17
|
+
|
18
|
+
And 'and' do
|
19
|
+
@and = 'And value'
|
20
|
+
end
|
21
|
+
|
22
|
+
But 'but' do
|
23
|
+
@but = 'But value'
|
24
|
+
end
|
25
|
+
|
26
|
+
_ 'generic' do
|
27
|
+
@generic = 'Generic value'
|
28
|
+
end
|
29
|
+
|
30
|
+
expect(@context).to eq('Given value')
|
31
|
+
expect(@action).to eq('When value')
|
32
|
+
expect(@result).to eq('Then value')
|
33
|
+
expect(@and).to eq('And value')
|
34
|
+
expect(@but).to eq('But value')
|
35
|
+
expect(@generic).to eq('Generic value')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'Steps without blocks' do
|
40
|
+
steps 'will be pending' do
|
41
|
+
Given 'step without block'
|
42
|
+
When 'step without block'
|
43
|
+
Then 'step without block'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/specify.gemspec
CHANGED
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.2.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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec-core
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,13 +89,16 @@ files:
|
|
75
89
|
- lib/specify/rspec/shared_steps.rb
|
76
90
|
- lib/specify/rspec/world.rb
|
77
91
|
- lib/specify/version.rb
|
92
|
+
- spec/shared_steps_spec.rb
|
93
|
+
- spec/spec_helper.rb
|
94
|
+
- spec/steps_spec.rb
|
78
95
|
- specify.gemspec
|
79
96
|
homepage: https://github.com/jnyman/specify
|
80
97
|
licenses:
|
81
98
|
- MIT
|
82
99
|
metadata: {}
|
83
100
|
post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n
|
84
|
-
\ Specify 0.
|
101
|
+
\ Specify 0.2.0 has been installed.\n\n(::) (::) (::) (::) (::) (::) (::) (::) (::)
|
85
102
|
(::) (::) (::)\n "
|
86
103
|
rdoc_options: []
|
87
104
|
require_paths:
|
@@ -102,4 +119,7 @@ rubygems_version: 2.2.2
|
|
102
119
|
signing_key:
|
103
120
|
specification_version: 4
|
104
121
|
summary: Description Language Specification and Execution Engine
|
105
|
-
test_files:
|
122
|
+
test_files:
|
123
|
+
- spec/shared_steps_spec.rb
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
- spec/steps_spec.rb
|