rspec-the 0.0.1 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dac315f19a1c71f8373fcdc6d7241e021c9de37f
4
- data.tar.gz: 315b743f3bf8161235f4e523025d0adaa4ee7c9f
3
+ metadata.gz: f7aaaab1b63bd8f5fca9a41b3a4dc201f03c1f3c
4
+ data.tar.gz: 7e3bc98ffd9e798daf77dc39e1b7183fdebeb99b
5
5
  SHA512:
6
- metadata.gz: c2ca1240f31b4275cc7b2d74432f433707faa95fe621d97fe1dca3e7fe26b957e5008a7d04e435b1ba3311f04f22ab41aadf577052e4087935f84ce50922fcf3
7
- data.tar.gz: 35760d754a7f446c11fd4af626b940d5f188017fd8f58fe5441bcca0514ae0473ce321ae41c97f2bb7d3f78ed6f444da0227b6b9d99e33c6d151ad3fb9337992
6
+ metadata.gz: 196a096f17176604691ccaa399effa79660862389e184a3d91a40081fe7ae97aa37c14ec16bd13330d6ccd364c81f29385bb4ce954dfb8211f0dc4db673e79ca
7
+ data.tar.gz: 6bd858e876647236928e084f6018469035e624f4c5a7d4f88dbf9e5bccd169125b5191a2fedc71d67ed479a7e1a3e2f6107656adccc28ffb1438ba347aca1a78
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-the (0.0.1)
4
+ rspec-the (0.0.2)
5
5
  rspec-core (>= 3.0.0)
6
6
  rspec-expectations (>= 3.0.0)
7
7
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RSpec::The
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
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/[my-github-username]/rspec-the/fork )
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
@@ -1,2 +1 @@
1
1
  require 'bundler/gem_tasks'
2
-
data/lib/rspec/the.rb CHANGED
@@ -1,17 +1,14 @@
1
- require 'rspec/the/version'
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
- module RSpec
4
- module The
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 = RSpec::The::VERSION
7
+ spec.version = '0.0.2'
9
8
  spec.authors = ['James Ottaway']
10
9
  spec.email = ['hello@james.ottaway.io']
11
- spec.summary = 'RSpec extension gem for defining expectations on `let` blocks'
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
@@ -0,0 +1,9 @@
1
+ class Counter
2
+ def initialize
3
+ @counter = 0
4
+ end
5
+
6
+ def next
7
+ @counter += 1
8
+ end
9
+ end
@@ -1,12 +1,22 @@
1
1
  require 'rspec/the'
2
+ require 'counter'
2
3
 
3
- module RSpec
4
- describe The do
5
- describe '#the' do
6
- context 'basic usage' do
7
- let(:foo) { :bar }
8
- the(:foo) { is_expected.to eq :bar }
9
- end
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.1
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-02 00:00:00.000000000 Z
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: RSpec extension gem for defining expectations on `let` blocks
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
@@ -1,5 +0,0 @@
1
- module RSpec
2
- module The
3
- VERSION = '0.0.1'
4
- end
5
- end