specify 0.10.0 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +23 -10
- data/.hound.yml +95 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +18 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +0 -4
- data/LICENSE.txt +1 -1
- data/README.md +11 -6
- data/Rakefile +13 -2
- data/bin/console +10 -0
- data/bin/setup +5 -0
- data/lib/specify/rspec/documentation_formatter.rb +3 -4
- data/lib/specify/rspec/example_group.rb +6 -8
- data/lib/specify/rspec/notification.rb +2 -3
- data/lib/specify/rspec/reporter.rb +0 -1
- data/lib/specify/rspec/shared_steps.rb +5 -3
- data/lib/specify/rspec/world.rb +0 -1
- data/lib/specify/version.rb +1 -1
- data/lib/specify.rb +10 -12
- data/specify.gemspec +9 -12
- metadata +22 -61
- data/lib/specify/rspec/parameterized.rb +0 -138
- data/lib/specify/rspec/table.rb +0 -54
- data/lib/specify/rspec/tabular.rb +0 -45
- data/spec/api_spec.rb +0 -45
- data/spec/parameterized_spec.rb +0 -229
- data/spec/pending_spec.rb +0 -12
- data/spec/shared_steps_spec.rb +0 -92
- data/spec/spec_helper.rb +0 -18
- data/spec/steps_spec.rb +0 -83
- data/spec/top_level_spec.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87785f51fa0d7d5c529b7856afdeec58b5fb33f2
|
4
|
+
data.tar.gz: 76ec7120adbd2fb1f2e0976756f9f9a7990bb825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d0045e2c22929aff89fb8e34a707a4bc5dc2c62e5a9cee5f5eed38d04e50f382f86e22e3e90c8ec0241047f81e053d215d9a344668bba0535fe0d99bdf04ce9
|
7
|
+
data.tar.gz: 0904c0da9c04efc6cf88d3b056a1f58fdf8859f20cf1c41ed3b2d6f1151c5f005c27598076bc543e838c4222b19d0906024babf552f0a916f2a254f67ac808f5
|
data/.gitignore
CHANGED
@@ -1,16 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.idea
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
.yardoc
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
spec/examples.txt
|
17
|
+
test/tmp
|
18
|
+
test/version_tmp
|
19
|
+
tmp
|
11
20
|
*.bundle
|
12
21
|
*.so
|
13
22
|
*.o
|
14
23
|
*.a
|
24
|
+
._*
|
15
25
|
mkmf.log
|
16
26
|
.DS_Store
|
27
|
+
.DS_Store?
|
28
|
+
.Trashes
|
29
|
+
.thumbs.db
|
data/.hound.yml
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- specify.gemspec
|
4
|
+
- test/*.rb
|
5
|
+
- spec/**/*
|
6
|
+
|
7
|
+
# missing top-level module documentation comment
|
8
|
+
Style/Documentation:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
# prefer reduce over inject
|
12
|
+
Style/CollectionMethods:
|
13
|
+
PreferredMethods:
|
14
|
+
reduce: 'inject'
|
15
|
+
|
16
|
+
# use each_with_object instead of inject
|
17
|
+
Style/EachWithObject:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
# removing the preference for string single quotes
|
21
|
+
Style/StringLiterals:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
# prefer fail over raise
|
25
|
+
Style/SignalException:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/TrailingComma:
|
29
|
+
EnforcedStyleForMultiline: comma
|
30
|
+
|
31
|
+
# this never works for validations
|
32
|
+
Style/AlignHash:
|
33
|
+
EnforcedLastArgumentHashStyle: ignore_implicit
|
34
|
+
|
35
|
+
# align multi-line params with previous line
|
36
|
+
Style/AlignParameters:
|
37
|
+
EnforcedStyle: with_fixed_indentation
|
38
|
+
|
39
|
+
# indent `when` clause one step from `case`
|
40
|
+
Style/CaseIndentation:
|
41
|
+
IndentOneStep: true
|
42
|
+
|
43
|
+
# don't force crappy var names for reduce/inject loops
|
44
|
+
Style/SingleLineBlockParams:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
# for method chains, keep the dot with the method name
|
48
|
+
Style/DotPosition:
|
49
|
+
EnforcedStyle: leading
|
50
|
+
|
51
|
+
Style/AccessorMethodName:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/PredicateName:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/MethodName:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/Alias:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/Next:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
# stop nesting so hard
|
67
|
+
Metrics/BlockNesting:
|
68
|
+
Max: 2
|
69
|
+
|
70
|
+
# short methods
|
71
|
+
Metrics/MethodLength:
|
72
|
+
Max: 25
|
73
|
+
|
74
|
+
Metrics/LineLength:
|
75
|
+
Enabled: false
|
76
|
+
#Max: 115
|
77
|
+
|
78
|
+
# fewer parameters
|
79
|
+
Metrics/ParameterLists:
|
80
|
+
Max: 5
|
81
|
+
|
82
|
+
Metrics/AbcSize:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Metrics/ModuleLength:
|
86
|
+
Max: 130
|
87
|
+
|
88
|
+
Metrics/CyclomaticComplexity:
|
89
|
+
Max: 12
|
90
|
+
|
91
|
+
Metrics/PerceivedComplexity:
|
92
|
+
Max: 12
|
93
|
+
|
94
|
+
Lint/RescueException:
|
95
|
+
Enabled: false
|
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Specify
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Build Status](https://travis-ci.org/jnyman/specify.svg)](https://travis-ci.org/jnyman/specify)
|
4
4
|
|
5
5
|
[![Coverage Status](https://img.shields.io/coveralls/jnyman/specify.svg)](https://coveralls.io/r/jnyman/specify?branch=master)
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/specify.svg)](http://badge.fury.io/rb/specify)
|
@@ -19,17 +19,23 @@ Specify provides a very thin wrapper around RSpec that provides a Gherkin-style
|
|
19
19
|
|
20
20
|
## Installation
|
21
21
|
|
22
|
-
|
22
|
+
To get the latest stable release, add this line to your application's Gemfile:
|
23
23
|
|
24
24
|
```ruby
|
25
25
|
gem 'specify'
|
26
26
|
```
|
27
27
|
|
28
|
-
|
28
|
+
To get the latest code:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
gem 'specify', git: https://github.com/jnyman/specify
|
32
|
+
```
|
33
|
+
|
34
|
+
After doing one of the above, execute the following command:
|
29
35
|
|
30
36
|
$ bundle
|
31
37
|
|
32
|
-
|
38
|
+
You can also install Specify just as you would any other gem:
|
33
39
|
|
34
40
|
$ gem install specify
|
35
41
|
|
@@ -72,6 +78,7 @@ To work on Specify:
|
|
72
78
|
## License
|
73
79
|
|
74
80
|
Specify is distributed under the [MIT](http://www.opensource.org/licenses/MIT) license.
|
81
|
+
See the [LICENSE](https://github.com/jnyman/symbiont/blob/master/LICENSE.txt) file for details.
|
75
82
|
|
76
83
|
## Credits
|
77
84
|
|
@@ -81,5 +88,3 @@ Specify has been inspired by the following projects:
|
|
81
88
|
* [rspec-gherkin](https://github.com/sheerun/rspec-gherkin)
|
82
89
|
* [rspec example steps](https://github.com/railsware/rspec-example_steps)
|
83
90
|
* [XSpec](https://github.com/xaviershay/xspec)
|
84
|
-
|
85
|
-
The parameterized and table logic is pulled directly from [RSpec::Parameterized](https://github.com/tomykaira/rspec-parameterized) with just a few cosmetic changes.
|
data/Rakefile
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require 'bundler/gem_tasks'
|
3
|
+
require 'rdoc/task'
|
4
|
+
require 'rubocop/rake_task'
|
3
5
|
require 'rspec/core/rake_task'
|
4
6
|
|
7
|
+
RuboCop::RakeTask.new
|
8
|
+
|
5
9
|
namespace :spec do
|
6
10
|
desc 'Clean all generated reports'
|
7
11
|
task :clean do
|
8
12
|
system('rm -rf spec/reports')
|
9
13
|
end
|
10
14
|
|
11
|
-
RSpec::Core::RakeTask.new(:
|
15
|
+
RSpec::Core::RakeTask.new(all: :clean) do |config|
|
12
16
|
options = %w(--color)
|
13
17
|
options += %w(--format documentation)
|
14
18
|
options += %w(--format html --out spec/reports/unit-test-report.html)
|
@@ -17,4 +21,11 @@ namespace :spec do
|
|
17
21
|
end
|
18
22
|
end
|
19
23
|
|
20
|
-
|
24
|
+
Rake::RDocTask.new do |rdoc|
|
25
|
+
rdoc.rdoc_dir = 'doc'
|
26
|
+
rdoc.main = 'README.md'
|
27
|
+
rdoc.title = "Specify #{Specify::VERSION}"
|
28
|
+
rdoc.rdoc_files.include('README*', 'lib/**/*.rb')
|
29
|
+
end
|
30
|
+
|
31
|
+
task default: ['spec:all', :rubocop]
|
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -57,10 +57,9 @@ module RSpec
|
|
57
57
|
def example_started_with_steps(notification)
|
58
58
|
example_started_without_steps(notification)
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
60
|
+
return unless notification.example.metadata[:with_steps]
|
61
|
+
full_message = "#{current_indentation}#{notification.example.description}"
|
62
|
+
output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :default)
|
64
63
|
end
|
65
64
|
|
66
65
|
def example_passed_with_steps(notification)
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RSpec
|
2
2
|
module Specify
|
3
3
|
module ExampleGroup
|
4
|
-
|
5
4
|
# In Rspec, example group bodies are delimited by 'describe' and
|
6
5
|
# 'context' methods. These encapsulate examples, which are
|
7
6
|
# delimited by 'it' methods. Example groups are evaluated in the
|
@@ -12,19 +11,19 @@ module RSpec
|
|
12
11
|
def include_steps(*args)
|
13
12
|
name = args.shift
|
14
13
|
shared_block = ::RSpec.world.shared_example_steps[name]
|
15
|
-
shared_block
|
14
|
+
shared_block || raise(ArgumentError, "Could not find shared steps #{name.inspect}")
|
16
15
|
instance_exec(*args, &shared_block)
|
17
16
|
end
|
18
17
|
|
19
|
-
def Given(message, options={}, &block)
|
18
|
+
def Given(message, options = {}, &block)
|
20
19
|
Action :given, message, options, &block
|
21
20
|
end
|
22
21
|
|
23
|
-
def When(message, options={}, &block)
|
22
|
+
def When(message, options = {}, &block)
|
24
23
|
Action :when, message, options, &block
|
25
24
|
end
|
26
25
|
|
27
|
-
def Then(message, options={}, &block)
|
26
|
+
def Then(message, options = {}, &block)
|
28
27
|
Action :then, message, options, &block
|
29
28
|
end
|
30
29
|
|
@@ -66,9 +65,9 @@ module RSpec
|
|
66
65
|
|
67
66
|
private
|
68
67
|
|
69
|
-
def Action(type, message, options = {}, &
|
68
|
+
def Action(type, message, options = {}, &_block)
|
70
69
|
::RSpec.world.reporter.example_step_started(self, type, message, options)
|
71
|
-
options = {:
|
70
|
+
options = { pending: true } if options == :pending
|
72
71
|
|
73
72
|
if block_given? && !options[:pending]
|
74
73
|
begin
|
@@ -81,7 +80,6 @@ module RSpec
|
|
81
80
|
else
|
82
81
|
::RSpec.world.reporter.example_step_pending(self, type, message, options)
|
83
82
|
end
|
84
|
-
|
85
83
|
end
|
86
84
|
end
|
87
85
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
module RSpec
|
2
2
|
module Specify
|
3
|
-
|
4
3
|
# In RSpec, notifications are value objects that are passed to formatters
|
5
4
|
# to provide those formatters with information about a particular event.
|
6
|
-
|
7
|
-
|
5
|
+
|
6
|
+
Notification = Struct.new(:example, :type, :message, :options)
|
8
7
|
end
|
9
8
|
end
|
@@ -9,9 +9,11 @@ module RSpec
|
|
9
9
|
private
|
10
10
|
|
11
11
|
def ensure_shared_example_steps_name_not_taken(name)
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
return unless ::RSpec.world.shared_example_steps.key?(name)
|
13
|
+
raise(ArgumentError, "Shared step '#{name}' already exists")
|
14
|
+
# if ::RSpec.world.shared_example_steps.key?(name)
|
15
|
+
# raise ArgumentError.new("Shared step '#{name}' already exists")
|
16
|
+
# end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
data/lib/specify/rspec/world.rb
CHANGED
data/lib/specify/version.rb
CHANGED
data/lib/specify.rb
CHANGED
@@ -12,24 +12,22 @@ require 'specify/rspec/world'
|
|
12
12
|
require 'specify/rspec/reporter'
|
13
13
|
require 'specify/rspec/notification'
|
14
14
|
require 'specify/rspec/example_group'
|
15
|
-
require 'specify/rspec/parameterized'
|
16
15
|
require 'specify/rspec/documentation_formatter'
|
17
16
|
|
18
17
|
RSpec::Core::ExampleGroup.send :include, RSpec::Specify::ExampleGroup
|
19
|
-
RSpec::Core::Reporter.send
|
20
|
-
RSpec::Core::World.send
|
18
|
+
RSpec::Core::Reporter.send :include, RSpec::Specify::Reporter
|
19
|
+
RSpec::Core::World.send :include, RSpec::Specify::World
|
21
20
|
|
22
21
|
RSpec::Core::Formatters::DocumentationFormatter.send :include, RSpec::Specify::DocumentationFormatter
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
23
|
+
formatter = RSpec.world.reporter.find_registered_formatter(RSpec::Core::Formatters::DocumentationFormatter)
|
24
|
+
RSpec.world.reporter.register_listener(
|
25
|
+
formatter,
|
26
|
+
:example_started,
|
27
|
+
:example_step_passed,
|
28
|
+
:example_step_pending,
|
29
|
+
:example_step_failed,
|
30
|
+
) if formatter
|
33
31
|
|
34
32
|
RSpec::Core::ExampleGroup.define_example_method :Scenario, with_steps: true
|
35
33
|
RSpec::Core::ExampleGroup.define_example_method :Condition, with_steps: true
|
data/specify.gemspec
CHANGED
@@ -18,23 +18,20 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.homepage = 'https://github.com/jnyman/specify'
|
19
19
|
spec.license = 'MIT'
|
20
20
|
|
21
|
-
spec.files = `git ls-files -z`.split("\x0")
|
22
|
-
spec.
|
23
|
-
spec.
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = 'exe'
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
|
-
spec.required_ruby_version = '>= 2.0
|
26
|
+
spec.required_ruby_version = '>= 2.0'
|
27
27
|
spec.required_rubygems_version = '>= 1.8.29'
|
28
28
|
|
29
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
30
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
31
|
-
spec.add_development_dependency 'rspec'
|
32
|
-
|
33
|
-
spec.
|
34
|
-
spec.
|
35
|
-
spec.add_runtime_dependency 'unparser'
|
36
|
-
spec.add_runtime_dependency 'proc_to_ast'
|
37
|
-
spec.add_runtime_dependency 'binding_of_caller'
|
31
|
+
spec.add_development_dependency 'rspec'
|
32
|
+
spec.add_development_dependency 'pry'
|
33
|
+
spec.add_development_dependency 'simplecov'
|
34
|
+
spec.add_development_dependency 'rubocop'
|
38
35
|
|
39
36
|
spec.post_install_message = %{
|
40
37
|
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
|