proverbs 0.1.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 +7 -0
- data/.gitignore +12 -0
- data/.hound.yml +73 -0
- data/.rspec +1 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.md +21 -0
- data/README.md +61 -0
- data/Rakefile +33 -0
- data/bin/console +13 -0
- data/bin/setup +8 -0
- data/lib/proverbs/rspec/documentation_formatter.rb +71 -0
- data/lib/proverbs/rspec/example_group.rb +58 -0
- data/lib/proverbs/rspec/notification.rb +7 -0
- data/lib/proverbs/rspec/reporter.rb +31 -0
- data/lib/proverbs/rspec/shared_steps.rb +17 -0
- data/lib/proverbs/rspec/world.rb +11 -0
- data/lib/proverbs/version.rb +3 -0
- data/lib/proverbs.rb +37 -0
- data/proverbs.gemspec +37 -0
- metadata +157 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5e9a8eac26fbc73b47d7eeef6f7eeec9dad5c276
|
|
4
|
+
data.tar.gz: ee01be7d32988cf29517920342ccf3d67d3226a8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7b34b3b3212d64609d476cc9a675e8d4fd2777cb068e06ccc35a6d02fd8734d0d4691b983890f2e6938b9aa844c3aa7f1def128517b863a3bf06236826dae547
|
|
7
|
+
data.tar.gz: 9ec480382465b2da380005ec0ed9b6032e11d7caad4a193c5faba295dd424df2a7948451fd94fb5c7c1e82f23171c1223a864b15fb8214466fe12648020a4f37
|
data/.gitignore
ADDED
data/.hound.yml
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
Exclude:
|
|
3
|
+
- proverbs.gemspec
|
|
4
|
+
- examples/*.rb
|
|
5
|
+
- spec/**/*
|
|
6
|
+
|
|
7
|
+
# Removing need for frozen string literal comment.
|
|
8
|
+
Style/FrozenStringLiteralComment:
|
|
9
|
+
Enabled: false
|
|
10
|
+
|
|
11
|
+
# Removing the preference for string single quotes.
|
|
12
|
+
Style/StringLiterals:
|
|
13
|
+
Enabled: false
|
|
14
|
+
|
|
15
|
+
# Missing top-level module documentation comment.
|
|
16
|
+
Style/Documentation:
|
|
17
|
+
Enabled: false
|
|
18
|
+
|
|
19
|
+
# Prefer reduce over inject.
|
|
20
|
+
Style/CollectionMethods:
|
|
21
|
+
PreferredMethods:
|
|
22
|
+
reduce: 'inject'
|
|
23
|
+
|
|
24
|
+
# Use each_with_object instead of inject.
|
|
25
|
+
Style/EachWithObject:
|
|
26
|
+
Enabled: false
|
|
27
|
+
|
|
28
|
+
# Prefer fail over raise.
|
|
29
|
+
Style/SignalException:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
# This never works for validations.
|
|
33
|
+
Style/AlignHash:
|
|
34
|
+
EnforcedLastArgumentHashStyle: ignore_implicit
|
|
35
|
+
|
|
36
|
+
# Align multi-line params with previous line.
|
|
37
|
+
Style/AlignParameters:
|
|
38
|
+
EnforcedStyle: with_fixed_indentation
|
|
39
|
+
|
|
40
|
+
# Indent `when` clause one step from `case`.
|
|
41
|
+
Style/CaseIndentation:
|
|
42
|
+
IndentOneStep: true
|
|
43
|
+
|
|
44
|
+
# Don't force bad var names for reduce/inject loops.
|
|
45
|
+
Style/SingleLineBlockParams:
|
|
46
|
+
Enabled: false
|
|
47
|
+
|
|
48
|
+
# For method chains, keep the dot with the method name.
|
|
49
|
+
Style/DotPosition:
|
|
50
|
+
EnforcedStyle: leading
|
|
51
|
+
|
|
52
|
+
# Stop nesting so hard.
|
|
53
|
+
Metrics/BlockNesting:
|
|
54
|
+
Max: 2
|
|
55
|
+
|
|
56
|
+
# Encourage short methods.
|
|
57
|
+
Metrics/MethodLength:
|
|
58
|
+
Max: 15
|
|
59
|
+
|
|
60
|
+
# Encourage fewer parameters.
|
|
61
|
+
Metrics/ParameterLists:
|
|
62
|
+
Max: 4
|
|
63
|
+
|
|
64
|
+
# This needs to be lengthened for this gem. Trying to shoehorn
|
|
65
|
+
# lines into shorter elements is simply not worth it and doesn't
|
|
66
|
+
# make it more readable.
|
|
67
|
+
Metrics/LineLength:
|
|
68
|
+
Enabled: false
|
|
69
|
+
|
|
70
|
+
# This is necessary in order to allow the method names to have
|
|
71
|
+
# uppercase, in order to match Gherkin.
|
|
72
|
+
Style/MethodName:
|
|
73
|
+
Enabled: false
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at jeff.nyman@sproutsocial.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Jeff Nyman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Proverbs
|
|
2
|
+
|
|
3
|
+
> _Let not mercy and truth forsake thee: bind them about thy neck;
|
|
4
|
+
> write them upon the table of thine heart._
|
|
5
|
+
>
|
|
6
|
+
> **Proverbs 3:3**
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
To get the latest stable release, add this line to your application's Gemfile:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
gem 'proverbs'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
To get the latest code:
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
gem 'proverbs', git: 'https://github.com/jeffnyman/proverbs'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
After doing one of the above, execute the following command:
|
|
25
|
+
|
|
26
|
+
$ bundle
|
|
27
|
+
|
|
28
|
+
You can also install Tapestry just as you would any other gem:
|
|
29
|
+
|
|
30
|
+
$ gem install proverbs
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
TODO: Write usage instructions here
|
|
35
|
+
|
|
36
|
+
## Development
|
|
37
|
+
|
|
38
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec:all` to run the tests. The default `rake` command will run all tests as well as a RuboCop analysis. To install this gem onto your local machine, run `bundle exec rake install`.
|
|
39
|
+
|
|
40
|
+
## Contributing
|
|
41
|
+
|
|
42
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/jeffnyman/proverbs](https://github.com/jeffnyman/proverbs). The testing ecosystem of Ruby is very large and this project is intended to be a welcoming arena for collaboration on yet another test-supporting tool. As such, contributors are very much welcome but are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
43
|
+
|
|
44
|
+
The Proverbs gem follows [semantic versioning](http://semver.org).
|
|
45
|
+
|
|
46
|
+
To contribute to Proverbs:
|
|
47
|
+
|
|
48
|
+
1. [Fork the project](http://gun.io/blog/how-to-github-fork-branch-and-pull-request/).
|
|
49
|
+
2. Create your feature branch. (`git checkout -b my-new-feature`)
|
|
50
|
+
3. Commit your changes. (`git commit -am 'new feature'`)
|
|
51
|
+
4. Push the branch. (`git push origin my-new-feature`)
|
|
52
|
+
5. Create a new [pull request](https://help.github.com/articles/using-pull-requests).
|
|
53
|
+
|
|
54
|
+
## Author
|
|
55
|
+
|
|
56
|
+
* [Jeff Nyman](http://testerstories.com)
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
Proverbs is distributed under the [MIT](http://www.opensource.org/licenses/MIT) license.
|
|
61
|
+
See the [LICENSE](https://github.com/jeffnyman/proverbs/blob/master/LICENSE.md) file for details.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
require "bundler/gem_tasks"
|
|
3
|
+
require "rdoc/task"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
require "rubocop/rake_task"
|
|
6
|
+
|
|
7
|
+
RuboCop::RakeTask.new
|
|
8
|
+
|
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
10
|
+
|
|
11
|
+
namespace :spec do
|
|
12
|
+
desc 'Clean all generated reports'
|
|
13
|
+
task :clean do
|
|
14
|
+
system('rm -rf spec/reports')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
RSpec::Core::RakeTask.new(all: :clean) do |config|
|
|
18
|
+
options = %w(--color)
|
|
19
|
+
options += %w(--format documentation)
|
|
20
|
+
options += %w(--format html --out spec/reports/unit-test-report.html)
|
|
21
|
+
|
|
22
|
+
config.rspec_opts = options
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
Rake::RDocTask.new do |rdoc|
|
|
27
|
+
rdoc.rdoc_dir = 'doc'
|
|
28
|
+
rdoc.main = 'README.md'
|
|
29
|
+
rdoc.title = "Proverbs #{Proverbs::VERSION}"
|
|
30
|
+
rdoc.rdoc_files.include('README*', 'lib/**/*.rb')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
task default: ['spec:all', :rubocop]
|
data/bin/console
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "proverbs"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
require "pry"
|
|
10
|
+
Pry.start
|
|
11
|
+
|
|
12
|
+
# require "irb"
|
|
13
|
+
# IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
module RSpec
|
|
2
|
+
module Proverbs
|
|
3
|
+
module DocumentationFormatter
|
|
4
|
+
# The documentation formatter of RSpec is one that prints out the
|
|
5
|
+
# descriptive information for each example group.
|
|
6
|
+
def self.included(caller)
|
|
7
|
+
caller.class_eval do
|
|
8
|
+
include InstanceMethods
|
|
9
|
+
|
|
10
|
+
alias_method :example_started_without_steps, :example_started
|
|
11
|
+
alias_method :example_started, :example_started_with_steps
|
|
12
|
+
|
|
13
|
+
alias_method :example_passed_without_steps, :example_passed
|
|
14
|
+
alias_method :example_passed, :example_passed_with_steps
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
module InstanceMethods
|
|
19
|
+
def example_started(notification); end
|
|
20
|
+
|
|
21
|
+
def example_step_passed(notification)
|
|
22
|
+
no_keyword_display = %w(specify example it rule fact step test)
|
|
23
|
+
keyword = notification.type.to_s
|
|
24
|
+
|
|
25
|
+
full_message = "#{current_indentation} #{keyword.capitalize} #{notification.message}" unless no_keyword_display.include?(keyword)
|
|
26
|
+
full_message = "#{current_indentation} #{notification.message}" if no_keyword_display.include?(keyword)
|
|
27
|
+
|
|
28
|
+
output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :success)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def example_step_failed(notification)
|
|
32
|
+
no_keyword_display = %w(specify example it rule fact step test)
|
|
33
|
+
keyword = notification.type.to_s
|
|
34
|
+
|
|
35
|
+
full_message = "#{current_indentation} #{keyword.capitalize} #{notification.message} (FAILED)" unless no_keyword_display.include?(keyword)
|
|
36
|
+
full_message = "#{current_indentation} #{notification.message} (FAILED)" if no_keyword_display.include?(keyword)
|
|
37
|
+
|
|
38
|
+
output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :failure)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def example_step_pending(notification)
|
|
42
|
+
no_keyword_display = %w(specify example it rule fact step test)
|
|
43
|
+
keyword = notification.type.to_s
|
|
44
|
+
|
|
45
|
+
full_message = "#{current_indentation} #{keyword.capitalize} #{notification.message}" unless no_keyword_display.include?(keyword)
|
|
46
|
+
full_message = "#{current_indentation} #{notification.message}" if no_keyword_display.include?(keyword)
|
|
47
|
+
|
|
48
|
+
if notification.options[:pending] && notification.options[:pending] != true
|
|
49
|
+
full_message << " (PENDING: #{notification.options[:pending]})"
|
|
50
|
+
else
|
|
51
|
+
full_message << ' (PENDING)'
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :pending)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def example_started_with_steps(notification)
|
|
58
|
+
example_started_without_steps(notification)
|
|
59
|
+
|
|
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)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def example_passed_with_steps(notification)
|
|
66
|
+
example_passed_without_steps(notification) unless notification.example.metadata[:with_steps]
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module RSpec
|
|
2
|
+
module Proverbs
|
|
3
|
+
module ExampleGroup
|
|
4
|
+
# In Rspec, example group bodies are delimited by 'describe' and
|
|
5
|
+
# 'context' methods. These encapsulate examples, which are
|
|
6
|
+
# delimited by 'it' methods. Example groups are evaluated in the
|
|
7
|
+
# context of an ExampleGroup instance. Individual examples are
|
|
8
|
+
# evaluated in the context of an instance of the ExampleGroup
|
|
9
|
+
# to which they belong.
|
|
10
|
+
def include_steps(*args)
|
|
11
|
+
name = args.shift
|
|
12
|
+
shared_block = ::RSpec.world.shared_example_steps[name]
|
|
13
|
+
shared_block || raise(ArgumentError,
|
|
14
|
+
"Could not find shared steps #{name.inspect}")
|
|
15
|
+
instance_exec(*args, &shared_block)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def Given(message, options = {}, &block)
|
|
19
|
+
action :given, message, options, &block
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def When(message, options = {}, &block)
|
|
23
|
+
action :when, message, options, &block
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def Then(message, options = {}, &block)
|
|
27
|
+
action :then, message, options, &block
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def And(message, options = {}, &block)
|
|
31
|
+
action :and, message, options, &block
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def But(message, options = {}, &block)
|
|
35
|
+
action :but, message, options, &block
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def action(type, message, options = {}, &_block)
|
|
41
|
+
::RSpec.world.reporter.example_step_started(self, type, message, options)
|
|
42
|
+
options = { pending: true } if options == :pending
|
|
43
|
+
|
|
44
|
+
if block_given? && !options[:pending]
|
|
45
|
+
begin
|
|
46
|
+
yield
|
|
47
|
+
rescue Exception => e
|
|
48
|
+
::RSpec.world.reporter.example_step_failed(self, type, message, options)
|
|
49
|
+
raise e
|
|
50
|
+
end
|
|
51
|
+
::RSpec.world.reporter.example_step_passed(self, type, message, options)
|
|
52
|
+
else
|
|
53
|
+
::RSpec.world.reporter.example_step_pending(self, type, message, options)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module RSpec
|
|
2
|
+
module Proverbs
|
|
3
|
+
module Reporter
|
|
4
|
+
# An RSpec reporter sends notifications to listeners. The listeners
|
|
5
|
+
# are usually formatters for a specific test run.
|
|
6
|
+
def example_step_started(example, type, message, options)
|
|
7
|
+
notify :example_step_started, Notification.new(example, type, message, options)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def example_step_passed(example, type, message, options)
|
|
11
|
+
notify :example_step_passed, Notification.new(example, type, message, options)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def example_step_failed(example, type, message, options)
|
|
15
|
+
notify :example_step_failed, Notification.new(example, type, message, options)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def example_step_pending(example, type, message, options)
|
|
19
|
+
notify :example_step_pending, Notification.new(example, type, message, options)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def registered_formatters
|
|
23
|
+
@listeners.values.map(&:to_a).flatten.uniq
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def find_registered_formatter(cls)
|
|
27
|
+
registered_formatters.detect { |formatter| formatter.class == cls }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module RSpec
|
|
2
|
+
module Proverbs
|
|
3
|
+
module SharedSteps
|
|
4
|
+
def shared_steps(name, &block)
|
|
5
|
+
ensure_shared_example_steps_name_not_taken(name)
|
|
6
|
+
::RSpec.world.shared_example_steps[name] = block
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def ensure_shared_example_steps_name_not_taken(name)
|
|
12
|
+
return unless ::RSpec.world.shared_example_steps.key?(name)
|
|
13
|
+
raise(ArgumentError, "Shared step '#{name}' already exists")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/proverbs.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require "rspec/core"
|
|
2
|
+
require "rspec/core/world"
|
|
3
|
+
require "rspec/core/reporter"
|
|
4
|
+
require "rspec/core/formatters"
|
|
5
|
+
require "rspec/core/example_group"
|
|
6
|
+
require "rspec/core/formatters/console_codes"
|
|
7
|
+
require "rspec/core/formatters/documentation_formatter"
|
|
8
|
+
|
|
9
|
+
require "proverbs/version"
|
|
10
|
+
require "proverbs/rspec/world"
|
|
11
|
+
require "proverbs/rspec/reporter"
|
|
12
|
+
require "proverbs/rspec/notification"
|
|
13
|
+
require "proverbs/rspec/example_group"
|
|
14
|
+
require "proverbs/rspec/documentation_formatter"
|
|
15
|
+
|
|
16
|
+
RSpec::Core::ExampleGroup.send :include, RSpec::Proverbs::ExampleGroup
|
|
17
|
+
RSpec::Core::Reporter.send :include, RSpec::Proverbs::Reporter
|
|
18
|
+
RSpec::Core::World.send :include, RSpec::Proverbs::World
|
|
19
|
+
|
|
20
|
+
RSpec::Core::Formatters::DocumentationFormatter.send :include, RSpec::Proverbs::DocumentationFormatter
|
|
21
|
+
|
|
22
|
+
# This one is from rspec-examples
|
|
23
|
+
## RSpec::Core::ExampleGroup.define_example_method :Steps, with_steps: true
|
|
24
|
+
|
|
25
|
+
RSpec::Core::ExampleGroup.define_example_method :Scenario, with_steps: true
|
|
26
|
+
|
|
27
|
+
formatter = RSpec.world.reporter.find_registered_formatter(RSpec::Core::Formatters::DocumentationFormatter)
|
|
28
|
+
RSpec.world.reporter.register_listener(
|
|
29
|
+
formatter,
|
|
30
|
+
:example_started,
|
|
31
|
+
:example_step_passed,
|
|
32
|
+
:example_step_pending,
|
|
33
|
+
:example_step_failed
|
|
34
|
+
) if formatter
|
|
35
|
+
|
|
36
|
+
require "proverbs/rspec/shared_steps"
|
|
37
|
+
include RSpec::Proverbs::SharedSteps
|
data/proverbs.gemspec
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'proverbs/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "proverbs"
|
|
8
|
+
spec.version = Proverbs::VERSION
|
|
9
|
+
spec.authors = ["Jeff Nyman"]
|
|
10
|
+
spec.email = ["jeffnyman@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Description Language Specification and Execution Engine (Using RSpec)}
|
|
13
|
+
spec.description = %q{Description Language Specification and Execution Engine (Using RSpec)}
|
|
14
|
+
spec.homepage = "https://github.com/jeffnyman/proverbs"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
|
19
|
+
end
|
|
20
|
+
spec.bindir = "exe"
|
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
|
+
spec.require_paths = ["lib"]
|
|
23
|
+
|
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
27
|
+
spec.add_development_dependency "rubocop"
|
|
28
|
+
spec.add_development_dependency "pry"
|
|
29
|
+
|
|
30
|
+
spec.add_runtime_dependency "rspec-core", [">= 3.0", "< 4.0"]
|
|
31
|
+
|
|
32
|
+
spec.post_install_message = %{
|
|
33
|
+
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
|
|
34
|
+
Proverbs #{Proverbs::VERSION} has been installed.
|
|
35
|
+
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
|
|
36
|
+
}
|
|
37
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: proverbs
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jeff Nyman
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-02-25 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.14'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.14'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
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'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rubocop
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: pry
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec-core
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '3.0'
|
|
90
|
+
- - "<"
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: '4.0'
|
|
93
|
+
type: :runtime
|
|
94
|
+
prerelease: false
|
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
96
|
+
requirements:
|
|
97
|
+
- - ">="
|
|
98
|
+
- !ruby/object:Gem::Version
|
|
99
|
+
version: '3.0'
|
|
100
|
+
- - "<"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '4.0'
|
|
103
|
+
description: Description Language Specification and Execution Engine (Using RSpec)
|
|
104
|
+
email:
|
|
105
|
+
- jeffnyman@gmail.com
|
|
106
|
+
executables: []
|
|
107
|
+
extensions: []
|
|
108
|
+
extra_rdoc_files: []
|
|
109
|
+
files:
|
|
110
|
+
- ".gitignore"
|
|
111
|
+
- ".hound.yml"
|
|
112
|
+
- ".rspec"
|
|
113
|
+
- ".rubocop.yml"
|
|
114
|
+
- ".travis.yml"
|
|
115
|
+
- CODE_OF_CONDUCT.md
|
|
116
|
+
- Gemfile
|
|
117
|
+
- LICENSE.md
|
|
118
|
+
- README.md
|
|
119
|
+
- Rakefile
|
|
120
|
+
- bin/console
|
|
121
|
+
- bin/setup
|
|
122
|
+
- lib/proverbs.rb
|
|
123
|
+
- lib/proverbs/rspec/documentation_formatter.rb
|
|
124
|
+
- lib/proverbs/rspec/example_group.rb
|
|
125
|
+
- lib/proverbs/rspec/notification.rb
|
|
126
|
+
- lib/proverbs/rspec/reporter.rb
|
|
127
|
+
- lib/proverbs/rspec/shared_steps.rb
|
|
128
|
+
- lib/proverbs/rspec/world.rb
|
|
129
|
+
- lib/proverbs/version.rb
|
|
130
|
+
- proverbs.gemspec
|
|
131
|
+
homepage: https://github.com/jeffnyman/proverbs
|
|
132
|
+
licenses:
|
|
133
|
+
- MIT
|
|
134
|
+
metadata: {}
|
|
135
|
+
post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n
|
|
136
|
+
\ Proverbs 0.1.0 has been installed.\n(::) (::) (::) (::) (::) (::) (::) (::) (::)
|
|
137
|
+
(::) (::) (::)\n "
|
|
138
|
+
rdoc_options: []
|
|
139
|
+
require_paths:
|
|
140
|
+
- lib
|
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
|
+
requirements:
|
|
148
|
+
- - ">="
|
|
149
|
+
- !ruby/object:Gem::Version
|
|
150
|
+
version: '0'
|
|
151
|
+
requirements: []
|
|
152
|
+
rubyforge_project:
|
|
153
|
+
rubygems_version: 2.6.10
|
|
154
|
+
signing_key:
|
|
155
|
+
specification_version: 4
|
|
156
|
+
summary: Description Language Specification and Execution Engine (Using RSpec)
|
|
157
|
+
test_files: []
|