rspec-ensure-unfiltered 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +13 -0
- data/README.md +72 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rspec-ensure-unfiltered.rb +1 -0
- data/lib/rspec/ensure/unfiltered.rb +30 -0
- data/lib/rspec/ensure/unfiltered/version.rb +7 -0
- data/rspec-ensure-unfiltered.gemspec +27 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57f652d5c72e52b106ca325b3682357592b00a34
|
4
|
+
data.tar.gz: 1f2b12ae88789e0bbafe3f834682e9da22d6fb3e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f0980a64fc93768403406b029124cb68eec05b83d30ae871221078c4e245a5fb8982878a4b70962d4d3818db41c0a662e6d245dbd87636276853a0ba44b3c2c8
|
7
|
+
data.tar.gz: f13de0e2f2ecbd6048860b1576e36775c6649d0f641c46466e76420fdf4e31a02e6380ab00a460e22d4fa5027b9d871e1e5b99356a7131f13d515d157de87377
|
data/.gitignore
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 rob@robhoward.id.au. 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.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2018 Rob Howard
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# rspec-ensure-unfiltered
|
2
|
+
|
3
|
+
A plugin for ensuring your RSpec tests don't run with a filter (eg. `focus: true`). Useful for CI runs.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile, in the `test` group:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'rspec-ensure-unfiltered', group: :test
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
```
|
17
|
+
$ bundle
|
18
|
+
```
|
19
|
+
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
In your `spec_helper.rb` (eg. `spec/spec_helper.rb`) or other RSpec config file, inside your `RSpec.configure` block:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'rspec/ensure/unfiltered'
|
27
|
+
RSpec.configure do |config|
|
28
|
+
RSpec::Ensure::Unfiltered.setup!(config)
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
To have this trigger on CI runs only (recommended), I'd recommend guarding it with a condition that checks the environment. This example should work for [Buildkite](https://buildkite.com), [Travis CI](https://travis-ci.org/) and [CircleCI](https://circleci.com/):
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
require 'rspec/ensure/unfiltered'
|
36
|
+
RSpec.configure do |config|
|
37
|
+
# Block the build if any example filtering is active,
|
38
|
+
# eg. if we left a "focus: true" in a spec somewhere.
|
39
|
+
if ENV['CI']
|
40
|
+
RSpec::Ensure::Unfiltered.setup!(config)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
When triggered, the build will abort and you'll get something like this dumped into your console:
|
46
|
+
|
47
|
+
```
|
48
|
+
************************************************************************
|
49
|
+
Examples have been filtered; you're only running 1 out of 3845 examples.
|
50
|
+
|
51
|
+
You may have left a filter (eg. 'focus: true') in one of your *_spec.rb
|
52
|
+
files; is it one of these?
|
53
|
+
- ./spec/sandbox_spec.rb
|
54
|
+
************************************************************************
|
55
|
+
```
|
56
|
+
|
57
|
+
|
58
|
+
## Development
|
59
|
+
|
60
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
61
|
+
|
62
|
+
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).
|
63
|
+
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
|
67
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/damncabbage/rspec-ensure-unfiltered. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the (https://github.com/damncabbage/rspec-ensure-unfiltered)[code of conduct].
|
68
|
+
|
69
|
+
|
70
|
+
## License
|
71
|
+
|
72
|
+
The gem is available as open source under the terms of the [Apache-2.0 License](https://opensource.org/licenses/Apache-2.0).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rspec/ensure/unfiltered"
|
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(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "rspec/ensure/unfiltered"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "rspec/ensure/unfiltered/version"
|
2
|
+
require "rspec"
|
3
|
+
|
4
|
+
module RSpec
|
5
|
+
module Ensure
|
6
|
+
module Unfiltered
|
7
|
+
def self.setup!(config, world: nil)
|
8
|
+
world ||= RSpec.world
|
9
|
+
config.before(:suite) do
|
10
|
+
# Yell if we're filtering, eg. we filter on 'focus: true' somewhere by accident.
|
11
|
+
run_examples = world.example_count
|
12
|
+
all_examples = world.all_examples.count
|
13
|
+
if run_examples != all_examples
|
14
|
+
paths = world.filtered_examples.flat_map(&:second).map(&:file_path).uniq.sort
|
15
|
+
msg = [
|
16
|
+
"Examples have been filtered; you're only running #{run_examples} out of #{all_examples} examples.",
|
17
|
+
"",
|
18
|
+
"You may have left a filter (eg. 'focus: true') in one of your *_spec.rb",
|
19
|
+
"files; is it one of these?"
|
20
|
+
].concat(
|
21
|
+
paths.map { |p| "- #{p}" }
|
22
|
+
)
|
23
|
+
border = "*" * msg.sort_by(&:length).last.length
|
24
|
+
raise "\n\n#{border}\n#{msg.join("\n")}\n#{border}\n\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "rspec/ensure/unfiltered/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rspec-ensure-unfiltered"
|
8
|
+
spec.version = RSpec::Ensure::Unfiltered::VERSION
|
9
|
+
spec.authors = ["Rob Howard"]
|
10
|
+
spec.email = ["rob@robhoward.id.au"]
|
11
|
+
|
12
|
+
spec.summary = %q{A plugin for ensuring your RSpec tests don't run with a filter (eg. `focus: true`); useful for CI runs.}
|
13
|
+
spec.homepage = "https://github.com/damncabbage/rspec-ensure-unfiltered"
|
14
|
+
spec.license = "Apache-2.0"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency "rspec", "~> 3.0"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-ensure-unfiltered
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rob Howard
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- rob@robhoward.id.au
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- CODE_OF_CONDUCT.md
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- lib/rspec-ensure-unfiltered.rb
|
71
|
+
- lib/rspec/ensure/unfiltered.rb
|
72
|
+
- lib/rspec/ensure/unfiltered/version.rb
|
73
|
+
- rspec-ensure-unfiltered.gemspec
|
74
|
+
homepage: https://github.com/damncabbage/rspec-ensure-unfiltered
|
75
|
+
licenses:
|
76
|
+
- Apache-2.0
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.5.2.3
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: 'A plugin for ensuring your RSpec tests don''t run with a filter (eg. `focus:
|
98
|
+
true`); useful for CI runs.'
|
99
|
+
test_files: []
|