Skip to content

Commit c37abbc

Browse files
committed
initial version
0 parents  commit c37abbc

22 files changed

Lines changed: 616 additions & 0 deletions

‎.gitignore‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
10+
# rspec failure tracking
11+
.rspec_status
12+
13+
.byebug_history
14+
15+
# iCloud Drive
16+
.nosync
17+
18+
*.gem
19+
/Gemfile.lock

‎.pryrc‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
if defined?(PryByebug)
4+
Pry.commands.alias_command 'c', 'continue'
5+
Pry.commands.alias_command 's', 'step'
6+
Pry.commands.alias_command 'n', 'next'
7+
Pry.commands.alias_command 'trace', 'backtrace'
8+
end
9+
10+
# Hit Enter to repeat last command
11+
Pry::Commands.command /^$/, 'repeat last command' do
12+
_pry_.run_command Pry.history.to_a.last
13+
end

‎.rspec‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--format documentation
2+
--color
3+
--require spec_helper

‎.ruby-version‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby-2.5.1

‎.travis.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sudo: false
3+
language: ruby
4+
cache: bundler
5+
rvm:
6+
- 2.5.1
7+
before_install: gem install bundler -v 1.16.5

‎CODE_OF_CONDUCT.md‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 peter.boling@gmail.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/

‎Gemfile‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6+
7+
# Specify your gem's dependencies in rspec-stubbed_env.gemspec
8+
gemspec

‎LICENSE‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2018 Peter Boling of railsbling.com
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

‎README.md‎

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# RSpec::StubbedEnv
2+
3+
ENV stubbing via a shared context for more powerful tests.
4+
5+
```ruby
6+
describe 'my stubbed test' do
7+
include_context 'with stubbed env'
8+
before do
9+
stub_env('FOO' => 'is bar')
10+
end
11+
it 'has a value' do
12+
expect(ENV['FOO']).to eq('is bar')
13+
end
14+
end
15+
```
16+
17+
| Project | RSpec::StubbedEnv |
18+
|------------------------ | ----------------------- |
19+
| gem name | [rspec-stubbed_env](https://rubygems.org/gems/rspec-stubbed_env) |
20+
| license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
21+
| download rank | [![Downloads Today](https://img.shields.io/gem/rd/rspec-stubbed_env.svg)](https://github.com/pboling/rspec-stubbed_env) |
22+
| version | [![Version](https://img.shields.io/gem/v/rspec-stubbed_env.svg)](https://rubygems.org/gems/rspec-stubbed_env) |
23+
| continuous integration | [![Build Status](https://travis-ci.org/pboling/rspec-stubbed_env.svg?branch=master)](https://travis-ci.org/pboling/rspec-stubbed_env) |
24+
| test coverage | [![Test Coverage](https://api.codeclimate.com/v1/badges/ced7e39984dd9c27c528/test_coverage)](https://codeclimate.com/github/pboling/rspec-stubbed_env/test_coverage) |
25+
| maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/ced7e39984dd9c27c528/maintainability)](https://codeclimate.com/github/pboling/rspec-stubbed_env/maintainability) |
26+
| dependencies | [![Depfu](https://badges.depfu.com/badges/6633827ecc1ad3b5dd749b4ac822347b/count.svg)](https://depfu.com/github/pboling/rspec-stubbed_env?project_id=5828) |
27+
| code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/rspec-stubbed_env/badges/users.svg)](https://www.codetriage.com/pboling/rspec-stubbed_env) |
28+
| homepage | [on Github.com][homepage], [on Railsbling.com][blogpage] |
29+
| documentation | [on RDoc.info][documentation] |
30+
| Spread ~♡ⓛⓞⓥⓔ♡~ | [🌍 🌎 🌏](https://about.me/peter.boling), [🍚](https://www.crowdrise.com/helprefugeeswithhopefortomorrowliberia/fundraiser/peterboling), [➕](https://plus.google.com/+PeterBoling/posts), [👼](https://angel.co/peter-boling), [🐛](https://www.topcoder.com/members/pboling/), [:shipit:](http://coderwall.com/pboling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo) |
31+
32+
33+
## Installation
34+
35+
Add this line to your application's Gemfile:
36+
37+
```ruby
38+
gem 'rspec-stubbed_env', group: :test
39+
```
40+
41+
And then execute:
42+
43+
$ bundle
44+
45+
Or install it yourself as:
46+
47+
$ gem install rspec-stubbed_env
48+
49+
50+
You must configure RSpec to use the `:expect` syntax, or some compatible alternative.
51+
52+
```ruby
53+
RSpec.configure do |config|
54+
config.expect_with :rspec do |c|
55+
c.syntax = :expect
56+
end
57+
end
58+
```
59+
60+
## Usage
61+
62+
ENV stubbing:
63+
64+
- is opt-in, via a shared context, rather than global.
65+
- *does not* affect the real ENV at all. It is a true stub.
66+
- has the same scope as a `before`, `subject`, or `let` at the same level.
67+
68+
See the spec suite for detailed examples.
69+
70+
```ruby
71+
# This is normal, without stubbing, ENV is not set
72+
describe 'vanilla' do
73+
it 'has no ENV stub' do
74+
expect(ENV['FOO']).to be_nil
75+
end
76+
end
77+
78+
# With a stubbed ENV!
79+
describe 'my stubbed test' do
80+
include_context 'with stubbed env'
81+
before do
82+
stub_env('FOO' => 'is bar')
83+
end
84+
it 'has a value' do
85+
expect(ENV['FOO']).to eq('is bar')
86+
end
87+
end
88+
```
89+
90+
## Development
91+
92+
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.
93+
94+
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).
95+
96+
## Contributing
97+
98+
Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/rspec-stubbed_env.
99+
100+
## Code of Conduct
101+
102+
Everyone interacting in the AnonymousActiveRecord project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pboling/rspec-stubbed_env/blob/master/CODE_OF_CONDUCT.md).
103+
104+
## Versioning
105+
106+
This library aims to adhere to [Semantic Versioning 2.0.0][semver].
107+
Violations of this scheme should be reported as bugs. Specifically,
108+
if a minor or patch version is released that breaks backward
109+
compatibility, a new version should be immediately released that
110+
restores compatibility. Breaking changes to the public API will
111+
only be introduced with new major versions.
112+
113+
As a result of this policy, you can (and should) specify a
114+
dependency on this gem using the [Pessimistic Version Constraint][pvc] with two digits of precision.
115+
116+
For example:
117+
118+
```ruby
119+
spec.add_dependency 'rspec-stubbed_env', '~> 1.0'
120+
```
121+
122+
## License
123+
124+
* Copyright (c) 2018 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
125+
126+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
127+
128+
[license]: LICENSE
129+
[semver]: http://semver.org/
130+
[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
131+
[railsbling]: http://www.railsbling.com
132+
[peterboling]: http://www.peterboling.com
133+
[documentation]: http://rdoc.info/github/pboling/rspec-stubbed_env/frames
134+
[homepage]: https://github.com/pboling/rspec-stubbed_env/
135+
[blogpage]: http://www.railsbling.com/tags/rspec-stubbed_env/

‎Rakefile‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
require 'bundler/gem_tasks'
4+
require 'rspec/core/rake_task'
5+
6+
RSpec::Core::RakeTask.new(:spec)
7+
8+
task default: :spec

0 commit comments

Comments
 (0)