rspec-pending_for 0.1.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b863b51de5b32968f0387d5596bb5e4064328f98
4
+ data.tar.gz: d0c4cc6393fc9760b896a0115f7866b8868592c9
5
+ SHA512:
6
+ metadata.gz: c5c03ccee1d1b08d706e8a2da9994e26a190b5f5e9472f2aff29e067c58821f9d1465df49588d394443749d85115ee4104577303a9dada9e04d311c62eca4a9a
7
+ data.tar.gz: 7016c08fd75acba013cdeded6ce9aa602a5ef242337c85749caec7231fb3724b0693ed5b11251e361ac559fe48a5fb4e103c9ee46225e0995552ed683027714a
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec-pending_for.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Peter H. Boling of RailsBling.com
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # Rspec::PendingFor
2
+
3
+ Easiest to just show you:
4
+
5
+ ```ruby
6
+ it("blah is blah") do
7
+ pending_for(engine: "ruby", version: "2.1.5")
8
+ expect("blah").to eq "blah"
9
+ end
10
+ ```
11
+
12
+ | Project | Rspec::PendingFor |
13
+ |------------------------ | ------------------ |
14
+ | gem name | rspec-pending_for |
15
+ | license | MIT |
16
+ | moldiness | [![Maintainer Status](http://stillmaintained.com/pboling/rspec-pending_for.png)](http://stillmaintained.com/pboling/rspec-pending_for) |
17
+ | version | [![Gem Version](https://badge.fury.io/rb/rspec-pending_for.png)](http://badge.fury.io/rb/rspec-pending_for) |
18
+ | dependencies | [![Dependency Status](https://gemnasium.com/pboling/rspec-pending_for.png)](https://gemnasium.com/pboling/rspec-pending_for) |
19
+ | code quality | [![Code Climate](https://codeclimate.com/github/pboling/rspec-pending_for.png)](https://codeclimate.com/github/pboling/rspec-pending_for) |
20
+ | inline documenation | [![Inline docs](http://inch-ci.org/github/pboling/rspec-pending_for.png)](http://inch-ci.org/github/pboling/rspec-pending_for) |
21
+ | continuous integration | [![Build Status](https://secure.travis-ci.org/pboling/rspec-pending_for.png?branch=master)](https://travis-ci.org/pboling/rspec-pending_for) |
22
+ | test coverage | [![Coverage Status](https://coveralls.io/repos/pboling/rspec-pending_for/badge.png)](https://coveralls.io/r/pboling/rspec-pending_for) |
23
+ | homepage | [https://github.com/pboling/rspec-pending_for][homepage] |
24
+ | documentation | [http://rdoc.info/github/pboling/rspec-pending_for/frames][documentation] |
25
+ | author | [Peter Boling](https://coderbits.com/pboling) |
26
+ | Spread ~♡ⓛⓞⓥⓔ♡~ | [![Endorse Me](https://api.coderwall.com/pboling/endorsecount.png)](http://coderwall.com/pboling) |
27
+
28
+ ## Installation
29
+
30
+ Add this line to your application's Gemfile:
31
+
32
+ ```ruby
33
+ gem 'rspec-pending_for'
34
+ ```
35
+
36
+ And then execute:
37
+
38
+ $ bundle
39
+
40
+ Or install it yourself as:
41
+
42
+ $ gem install rspec-pending_for
43
+
44
+ ## Usage
45
+
46
+ To mark a spec pending for a specific ruby engine, and/or versions:
47
+
48
+ ```ruby
49
+ it("blah is blah") do
50
+ pending_for(engine: "ruby", version: "2.1.5")
51
+ expect("blah").to eq "blah"
52
+ end
53
+ ```
54
+
55
+ To skip a spec for a specific ruby engine, and/or versions:
56
+
57
+ ```ruby
58
+ it("blah is blah") do
59
+ skip_for(engine: "ruby", version: "2.1.5")
60
+ expect("blah").to eq "blah"
61
+ end
62
+ ```
63
+
64
+ To mark a spec pending for all versions of a given engine:
65
+
66
+ ```ruby
67
+ it("blah is blah") do
68
+ skip_for(engine: "jruby")
69
+ expect("blah").to eq "blah"
70
+ end
71
+ ```
72
+
73
+ To mark a spec pending for a custom reason (overriding the default message):
74
+
75
+ ```ruby
76
+ it("blah is blah") do
77
+ skip_for(engine: "jruby", reason: "This does not work on JRuby")
78
+ expect("blah").to eq "blah"
79
+ end
80
+ ```
81
+
82
+ To mark a spec pending or skipped for multiple engines and versions, just what you would expect:
83
+
84
+ ```ruby
85
+ it("blah is blah") do
86
+ skip_for(engine: "jruby", reason: "This does not work on JRuby so skipping for now") # All JRuby versions will be skipped
87
+ pending_for(engine: "rbx", reason: "This does not work on Rubinius so pending for now") # All rbx versions will be pending
88
+ pending_for(engine: "ruby", versions:%w(1.9.3 2.0.0 2.1.0)) # uses the default message
89
+ expect("blah").to eq "blah"
90
+ end
91
+ ```
92
+
93
+
94
+ ## Development
95
+
96
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
97
+
98
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
99
+
100
+
101
+ ## Authors
102
+
103
+ [Peter H. Boling][peterboling] of [Rails Bling][railsbling] is the author.
104
+
105
+ ## Contributors
106
+
107
+ See the [Network View](https://github.com/pboling/rspec-pending_for/network) and the [CHANGELOG](https://github.com/pboling/rspec-pending_for/blob/master/CHANGELOG.md)
108
+
109
+ ## Contributing
110
+
111
+ 1. Fork it
112
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
113
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
114
+ 4. Push to the branch (`git push origin my-new-feature`)
115
+ 5. Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
116
+ 6. Create new Pull Request
117
+
118
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/rspec-pending_for.
119
+
120
+ ## Versioning
121
+
122
+ This library aims to adhere to [Semantic Versioning 2.0.0][semver].
123
+ Violations of this scheme should be reported as bugs. Specifically,
124
+ if a minor or patch version is released that breaks backward
125
+ compatibility, a new version should be immediately released that
126
+ restores compatibility. Breaking changes to the public API will
127
+ only be introduced with new major versions.
128
+
129
+ As a result of this policy, you can (and should) specify a
130
+ dependency on this gem using the [Pessimistic Version Constraint][pvc] with two digits of precision.
131
+
132
+ For example:
133
+
134
+ spec.add_dependency 'rspec-pending_for', '~> 1.1'
135
+
136
+ ## Legal
137
+
138
+ * MIT License - See LICENSE file in this project
139
+ * Copyright (c) 2015 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
140
+
141
+ [semver]: http://semver.org/
142
+ [pvc]: http://docs.rubygems.org/read/chapter/16#page74
143
+ [railsbling]: http://www.railsbling.com
144
+ [peterboling]: https://about.me/peter.boling
145
+ [documentation]: http://rdoc.info/github/pboling/rspec-pending_for/frames
146
+ [homepage]: https://github.com/pboling/rspec-pending_for
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rspec/pending_for"
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
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,49 @@
1
+ require "ruby_version"
2
+ require "ruby_engine"
3
+ require "rspec/pending_for/version"
4
+ require "rspec/pending_for/engine_or_versions_required"
5
+ require "rspec/pending_for/build"
6
+ require "rspec/pending_for/rspec"
7
+
8
+ module Rspec
9
+
10
+ # Use with Rspec by including in your example groups, just like any other Rspec helpers:
11
+ #
12
+ # RSpec.configure do |c|
13
+ # c.include Rspec::PendingFor
14
+ # end
15
+ #
16
+ module PendingFor
17
+
18
+ # How to pend specs that break due to bugs in Ruby interpreters or versions
19
+ #
20
+ # it("blah is blah") do
21
+ # pending_for(engine: "ruby", version: "2.1.5")
22
+ # expect("blah").to eq "blah"
23
+ # end
24
+ #
25
+ def pending_for(options = {}) # Not using named parameters because still supporting Ruby 1.9
26
+ modify_example_with(:pending, options)
27
+ end
28
+
29
+ # How to pend specs that break due to bugs in Ruby interpreters or versions
30
+ #
31
+ # it("blah is blah") do
32
+ # skip_for(engine: "jruby", version: "2.2.2")
33
+ # expect("blah").to eq "blah"
34
+ # end
35
+ #
36
+ def skip_for(options = {}) # Not using named parameters because still supporting Ruby 1.9
37
+ modify_example_with(:skip, options)
38
+ end
39
+
40
+ private
41
+
42
+ def modify_example_with(message, options)
43
+ fail(EngineOrVersionsRequired, :pending_for) unless options[:engine] || options[:versions]
44
+ build = Build.new(options)
45
+ self.send(message, build.message) if build.current_matches_specified?
46
+ end
47
+
48
+ end
49
+ end
@@ -0,0 +1,89 @@
1
+ module Rspec
2
+ module PendingFor
3
+ # SRP: Describe the RubyEngine and/or RubyVersion(s) that will be pended or skipped and with what message
4
+ class Build
5
+
6
+ #
7
+ # | RUBY_ENGINE | Implementation |
8
+ # |:-----------:|:------------------------:|
9
+ # | "unknown" | MRI < 1.9 (probably) |
10
+ # | "ruby" | MRI >= 1.9 |
11
+ # | "ree" | Ruby Enterprise Edition |
12
+ # | "jruby" | JRuby |
13
+ # | "macruby" | MacRuby |
14
+ # | "rbx" | Rubinius |
15
+ # | "maglev" | MagLev |
16
+ # | "ironruby" | IronRuby |
17
+ # | "cardinal" | Cardinal |
18
+ #
19
+
20
+ # Keys are the
21
+ INTERPRETER_MATRIX = {
22
+ "unknown" => "MRI < 1.9 (probably)",
23
+ "ruby" => "MRI >= 1.9",
24
+ "ree" => "Ruby Enterprise Edition",
25
+ "jruby" => "JRuby",
26
+ "macruby" => "MacRuby",
27
+ "rbx" => "Rubinius",
28
+ "maglev" => "MagLev",
29
+ "ironruby" => "IronRuby",
30
+ "cardinal" => "Cardinal"
31
+ }
32
+ BROKEN_STRING = "Behavior is broken"
33
+ BUG_STRING = "due to a bug in the Ruby engine"
34
+ VERSIONS_STRING = "in Ruby versions"
35
+ ISSUES_LINK = "https://github.com/pboling/rspec-pending_for/issues"
36
+
37
+ attr_reader :message, :relevant_versions, :relevant_engine, :reason
38
+
39
+ def initialize(options = {})
40
+ @relevant_versions = Array(options[:versions]) # cast to array
41
+ @relevant_engine = options[:engine].nil? ? nil : options[:engine].to_s
42
+ @reason = options[:reason]
43
+ warn_about_unrecognized_engine
44
+ # If engine is nil, then any matching versions should be pended
45
+ @message = if @relevant_engine.nil?
46
+ no_engine_specified
47
+ elsif RubyEngine.is? @relevant_engine
48
+ engine_specified_and_relevant
49
+ end
50
+ end
51
+
52
+ def current_matches_specified?
53
+ !message.nil?
54
+ end
55
+
56
+ private
57
+
58
+ def warn_about_unrecognized_engine
59
+ return false if relevant_engine.nil? || !INTERPRETER_MATRIX[relevant_engine].nil?
60
+ warn %[
61
+ Engine specified (#{relevant_engine}) is not known to rspec-pending_for.
62
+ If it is a real RUBY_ENGINE, please report as a bug to #{ISSUES_LINK}
63
+ ]
64
+ end
65
+
66
+ def no_engine_specified
67
+ if relevant_versions.include?(RubyVersion.to_s)
68
+ reason || "#{BROKEN_STRING} #{VERSIONS_STRING} #{relevant_versions} #{BUG_STRING}"
69
+ else
70
+ nil # Not a pended/skipped spec
71
+ end
72
+ end
73
+
74
+ def engine_specified_and_relevant
75
+ if relevant_versions.empty?
76
+ # No versions specified means ALL versions for this engine
77
+ reason || "#{BROKEN_STRING} #{BUG_STRING} #{INTERPRETER_MATRIX[relevant_engine]}"
78
+ else
79
+ if relevant_versions.include?(RubyVersion.to_s)
80
+ reason || %[#{BROKEN_STRING} #{VERSIONS_STRING} #{relevant_versions} #{BUG_STRING} (#{INTERPRETER_MATRIX[relevant_engine]})]
81
+ else
82
+ nil # Not a pended/skipped spec
83
+ end
84
+ end
85
+ end
86
+
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,12 @@
1
+ module Rspec
2
+ module PendingFor
3
+
4
+ class EngineOrVersionsRequired < ArgumentError
5
+ def initialize(method_name, *args)
6
+ message = "#{method_name} requires at least an engine or versions to be specified"
7
+ super(message, *args)
8
+ end
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ require "rspec/core"
2
+ begin
3
+ RSpec.configure do |c|
4
+ c.include Rspec::PendingFor
5
+ end
6
+ rescue NameError
7
+ # Rspec really should be loaded by now...
8
+ end
@@ -0,0 +1,5 @@
1
+ module Rspec
2
+ module PendingFor
3
+ VERSION = "0.1.2"
4
+ end
5
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rspec/pending_for/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rspec-pending_for"
8
+ spec.version = Rspec::PendingFor::VERSION
9
+ spec.authors = ["Peter Boling"]
10
+ spec.email = ["peter.boling@gmail.com"]
11
+
12
+ spec.summary = %q{Mark specs pending or skipped for specific Ruby engine (e.g. MRI or JRuby) / version combinations}
13
+ spec.homepage = "https://github.com/pboling/rspec-pending_for"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "rspec-core"
21
+ spec.add_dependency "ruby_version", "~> 1.0"
22
+ spec.add_dependency "ruby_engine", "~> 1.0"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.10"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.3"
27
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-pending_for
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Peter Boling
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruby_version
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ruby_engine
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.3'
97
+ description:
98
+ email:
99
+ - peter.boling@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - Gemfile
108
+ - LICENSE
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - lib/rspec/pending_for.rb
114
+ - lib/rspec/pending_for/build.rb
115
+ - lib/rspec/pending_for/engine_or_versions_required.rb
116
+ - lib/rspec/pending_for/rspec.rb
117
+ - lib/rspec/pending_for/version.rb
118
+ - rspec-pending_for.gemspec
119
+ homepage: https://github.com/pboling/rspec-pending_for
120
+ licenses: []
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.4.5.1
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: Mark specs pending or skipped for specific Ruby engine (e.g. MRI or JRuby)
142
+ / version combinations
143
+ test_files: []