conjurer 0.0.1
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 +17 -0
- data/.rspec +6 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +71 -0
- data/Rakefile +12 -0
- data/conjurer.gemspec +24 -0
- data/lib/conjurer.rb +18 -0
- data/lib/conjurer/version.rb +3 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4b90dda88ff74d73375c029815de820a584041a4
|
4
|
+
data.tar.gz: 0338e8dadf08c7417e6e2fec24eecee20fe8b28c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84f5e09a59b95df0dc831a624bec002dea9f1162ca029392d293decb7269982445272f8472c99ec43e2784fab45240c1b08308b876995914356a538c525f3ef5
|
7
|
+
data.tar.gz: 144c9be0f595182668091e428bfdb43d792a7511e761a5d9583d74c09816e75bb3ee8a1bf669269e4e4f00ae061fb793d17197057809a46abbf4001a4876481e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Aaron Kromer
|
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,71 @@
|
|
1
|
+
# Conjurer
|
2
|
+
|
3
|
+
Simple plug-in for RSpec that allows for explicit pre-loading of `let`s.
|
4
|
+
|
5
|
+
This allows for the general elimination of `let!` while providing a more
|
6
|
+
semantic alternative. See my post [The Bang is for Surprise](http://aaronkromer.com/blog/2013-05-19-the-bang-is-for-surprise.html)
|
7
|
+
for more details.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'conjurer'
|
15
|
+
end
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install conjurer
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
If using Rails, the gem should automatically be loaded. Otherwise, just add the
|
28
|
+
following to your `spec_helper`:
|
29
|
+
|
30
|
+
require 'conjurer'
|
31
|
+
|
32
|
+
You can also use [`Bundler.setup`](http://gembundler.com/v1.3/bundler_setup.html)
|
33
|
+
for any other auto loading.
|
34
|
+
|
35
|
+
You can use the `preload` or more mystical `conjur` methods in your RSpec
|
36
|
+
example groups. These methods are simply aliases of each other:
|
37
|
+
|
38
|
+
describe "Loading barewords" do
|
39
|
+
|
40
|
+
context "preloading works with `let`" do
|
41
|
+
subject(:array) { [1, 2, 3] }
|
42
|
+
let(:popped) { array.pop }
|
43
|
+
|
44
|
+
conjur :popped
|
45
|
+
|
46
|
+
it { expect(array).to eq [1, 2] }
|
47
|
+
|
48
|
+
it { expect(popped).to eq 3 }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "preloading works on methods" do
|
52
|
+
subject(:array) { [] }
|
53
|
+
|
54
|
+
def some_data
|
55
|
+
array << [1, 2]
|
56
|
+
end
|
57
|
+
|
58
|
+
preload :some_data
|
59
|
+
|
60
|
+
it { expect(array).to eq [1, 2] }
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
|
67
|
+
1. Fork it
|
68
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
69
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
70
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
71
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/conjurer.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'conjurer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "conjurer"
|
8
|
+
spec.version = Conjurer::VERSION
|
9
|
+
spec.authors = ["Aaron Kromer"]
|
10
|
+
spec.description = %q{RSpec Plugin For Preloading}
|
11
|
+
spec.summary = %q{RSpec Plugin For Preloading}
|
12
|
+
spec.homepage = "https://github.com/cupakromer/conjurer"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "rspec", '~> 2.10'
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
data/lib/conjurer.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "conjurer/version"
|
2
|
+
|
3
|
+
module Conjurer
|
4
|
+
|
5
|
+
def preload(*names)
|
6
|
+
before do
|
7
|
+
names.each { |name| __send__ name }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
alias_method :conjur, :preload
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
if defined? RSpec
|
15
|
+
RSpec.configure do |c|
|
16
|
+
c.extend Conjurer
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: conjurer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aaron Kromer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-20 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: '2.10'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.10'
|
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.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
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
|
+
description: RSpec Plugin For Preloading
|
70
|
+
email:
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- .gitignore
|
76
|
+
- .rspec
|
77
|
+
- .travis.yml
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- conjurer.gemspec
|
83
|
+
- lib/conjurer.rb
|
84
|
+
- lib/conjurer/version.rb
|
85
|
+
homepage: https://github.com/cupakromer/conjurer
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.0.0
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: RSpec Plugin For Preloading
|
109
|
+
test_files: []
|