rspec-the 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +8 -3
- data/Rakefile +0 -1
- data/lib/rspec/the.rb +9 -12
- data/rspec-the.gemspec +2 -3
- data/spec/counter.rb +9 -0
- data/spec/rspec/the_spec.rb +17 -7
- metadata +6 -4
- data/lib/rspec/the/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7aaaab1b63bd8f5fca9a41b3a4dc201f03c1f3c
|
4
|
+
data.tar.gz: 7e3bc98ffd9e798daf77dc39e1b7183fdebeb99b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196a096f17176604691ccaa399effa79660862389e184a3d91a40081fe7ae97aa37c14ec16bd13330d6ccd364c81f29385bb4ce954dfb8211f0dc4db673e79ca
|
7
|
+
data.tar.gz: 6bd858e876647236928e084f6018469035e624f4c5a7d4f88dbf9e5bccd169125b5191a2fedc71d67ed479a7e1a3e2f6107656adccc28ffb1438ba347aca1a78
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RSpec::The
|
2
2
|
|
3
|
-
|
3
|
+
Easily make assertions about the contents of your `let` blocks
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -20,11 +20,16 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
```ruby
|
24
|
+
describe 'something' do
|
25
|
+
let(:value) { 42 }
|
26
|
+
the(:value) { is_expected.to eq 42 }
|
27
|
+
end
|
28
|
+
```
|
24
29
|
|
25
30
|
## Contributing
|
26
31
|
|
27
|
-
1. Fork it ( https://github.com/
|
32
|
+
1. Fork it ( https://github.com/jamesottaway/rspec-the/fork )
|
28
33
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
34
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
35
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/Rakefile
CHANGED
data/lib/rspec/the.rb
CHANGED
@@ -1,17 +1,14 @@
|
|
1
|
-
|
1
|
+
module RSpec::The
|
2
|
+
def the(method, &block)
|
3
|
+
describe(method.to_s) do
|
4
|
+
let(:__the_subject) { self.public_send method }
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
def the(method, &block)
|
6
|
-
describe(method.to_s) do
|
7
|
-
let(:the_subject) { public_send(method) }
|
8
|
-
|
9
|
-
def is_expected
|
10
|
-
expect(the_subject)
|
11
|
-
end
|
12
|
-
|
13
|
-
example(nil, &block)
|
6
|
+
def is_expected
|
7
|
+
expect(__the_subject)
|
14
8
|
end
|
9
|
+
alias_method :are_expected, :is_expected
|
10
|
+
|
11
|
+
example(nil, &block)
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
data/rspec-the.gemspec
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'rspec/the/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = 'rspec-the'
|
8
|
-
spec.version =
|
7
|
+
spec.version = '0.0.2'
|
9
8
|
spec.authors = ['James Ottaway']
|
10
9
|
spec.email = ['hello@james.ottaway.io']
|
11
|
-
spec.summary = '
|
10
|
+
spec.summary = 'Easily make assertions about the contents of your `let` blocks'
|
12
11
|
spec.homepage = 'https://github.com/jamesottaway/rspec-the'
|
13
12
|
spec.license = 'MIT'
|
14
13
|
|
data/spec/counter.rb
ADDED
data/spec/rspec/the_spec.rb
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
require 'rspec/the'
|
2
|
+
require 'counter'
|
2
3
|
|
3
|
-
|
4
|
-
describe
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
describe RSpec::The do
|
5
|
+
describe '#the' do
|
6
|
+
context 'basic usage' do
|
7
|
+
let(:counter) { Counter.new }
|
8
|
+
before { expect(counter.next).to eq 1 }
|
9
|
+
let(:next) { counter.next }
|
10
|
+
the(:next) { is_expected.to eq 2 }
|
11
|
+
after { expect(counter.next).to eq 3 }
|
12
|
+
end
|
13
|
+
|
14
|
+
context '#are_expected' do
|
15
|
+
let(:counter) { Counter.new }
|
16
|
+
before { expect(counter.next).to eq 1 }
|
17
|
+
let(:nexts) { 5.times.inject([]) { |acc| acc << counter.next } }
|
18
|
+
the(:nexts) { are_expected.to eq [2, 3, 4, 5, 6] }
|
19
|
+
after { expect(counter.next).to eq 7 }
|
10
20
|
end
|
11
21
|
end
|
12
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-the
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Ottaway
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -74,14 +74,15 @@ extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
|
+
- ".ruby-version"
|
77
78
|
- Gemfile
|
78
79
|
- Gemfile.lock
|
79
80
|
- LICENSE.txt
|
80
81
|
- README.md
|
81
82
|
- Rakefile
|
82
83
|
- lib/rspec/the.rb
|
83
|
-
- lib/rspec/the/version.rb
|
84
84
|
- rspec-the.gemspec
|
85
|
+
- spec/counter.rb
|
85
86
|
- spec/rspec/the_spec.rb
|
86
87
|
homepage: https://github.com/jamesottaway/rspec-the
|
87
88
|
licenses:
|
@@ -106,6 +107,7 @@ rubyforge_project:
|
|
106
107
|
rubygems_version: 2.2.2
|
107
108
|
signing_key:
|
108
109
|
specification_version: 4
|
109
|
-
summary:
|
110
|
+
summary: Easily make assertions about the contents of your `let` blocks
|
110
111
|
test_files:
|
112
|
+
- spec/counter.rb
|
111
113
|
- spec/rspec/the_spec.rb
|