ndd-rspec 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +11 -10
- data/Gemfile.lock +19 -15
- data/VERSION +1 -1
- data/lib/ndd/rspec/matchers/be_reverse_sorted_by.rb +20 -10
- data/lib/ndd/rspec/matchers/be_sorted_by.rb +21 -10
- data/ndd-rspec.gemspec +34 -30
- data/spec/ndd/rspec/matchers/be_reverse_sorted_by_spec.rb +16 -5
- data/spec/ndd/rspec/matchers/be_sorted_by_spec.rb +16 -6
- data/spec/ndd/rspec/matchers/duck.rb +2 -0
- data/spec/ndd/rspec/matchers/shared_examples.rb +8 -6
- data/spec/spec_helper.rb +0 -1
- metadata +35 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7e3216a83cd6ab4fc8ebcbfc35ddbf9c05b6962
|
4
|
+
data.tar.gz: c40cdd3b34a97f59e9a0cf99af2430f6658b0044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37dab950976b3fbd79392037f761a833ecc38079cdb67f14453f7ca39877920e97a82c35aa462e03142ef9142267c7355cb7f603dc7eddb616ec1f1795416d1e
|
7
|
+
data.tar.gz: 7ebd97150aee31fb88b7f684da36a73aa1e8ba53ae9d34cbe7ea9aa1ba93feefe3b6605b6aebfcbcc285ec20db74df257e02120bcbfd75dd0f0bac9a4d8a68d8
|
data/Gemfile
CHANGED
@@ -12,15 +12,16 @@ gem 'rspec', '~> 3.1'
|
|
12
12
|
# Dependencies to develop the gem.
|
13
13
|
# Everything needed to run rake, tests, features, etc.
|
14
14
|
group :development do
|
15
|
-
gem 'bundler', '~> 1.7
|
16
|
-
gem 'guard', '~> 2.8
|
17
|
-
gem 'guard-bundler', '~> 2.0
|
18
|
-
gem 'guard-rspec', '~> 4.3
|
19
|
-
gem 'guard-spork', '~> 2.0
|
20
|
-
gem 'jeweler', '~> 2.0
|
21
|
-
gem 'rdoc', '~> 4.1
|
22
|
-
gem 'simplecov', '~> 0.9
|
23
|
-
gem 'spork', '~> 0.9
|
15
|
+
gem 'bundler', '~> 1.7', require: false
|
16
|
+
gem 'guard', '~> 2.8', require: false
|
17
|
+
gem 'guard-bundler', '~> 2.0', require: false
|
18
|
+
gem 'guard-rspec', '~> 4.3', require: false
|
19
|
+
gem 'guard-spork', '~> 2.0', require: false
|
20
|
+
gem 'jeweler', '~> 2.0', require: false
|
21
|
+
gem 'rdoc', '~> 4.1', require: false
|
22
|
+
gem 'simplecov', '~> 0.9', require: false
|
23
|
+
gem 'spork', '~> 0.9', require: false
|
24
|
+
gem 'yard', '~> 0.8', require: false
|
24
25
|
|
25
26
|
case HOST_OS
|
26
27
|
when /darwin/i
|
@@ -40,5 +41,5 @@ group :development do
|
|
40
41
|
end
|
41
42
|
|
42
43
|
group :test do
|
43
|
-
gem 'codeclimate-test-reporter', '~> 0.4
|
44
|
+
gem 'codeclimate-test-reporter', '~> 0.4', require: false
|
44
45
|
end
|
data/Gemfile.lock
CHANGED
@@ -36,12 +36,14 @@ GEM
|
|
36
36
|
guard-bundler (2.0.0)
|
37
37
|
bundler (~> 1.0)
|
38
38
|
guard (~> 2.2)
|
39
|
-
guard-
|
39
|
+
guard-compat (0.3.0)
|
40
|
+
guard-rspec (4.4.2)
|
40
41
|
guard (~> 2.1)
|
41
|
-
|
42
|
-
|
42
|
+
guard-compat (~> 0.1)
|
43
|
+
rspec (>= 2.99.0, < 4.0)
|
44
|
+
guard-spork (2.0.1)
|
43
45
|
childprocess (>= 0.2.3)
|
44
|
-
guard (~> 2.
|
46
|
+
guard (~> 2.8.2)
|
45
47
|
spork (>= 0.8.4)
|
46
48
|
hashie (3.3.2)
|
47
49
|
highline (1.6.21)
|
@@ -86,7 +88,7 @@ GEM
|
|
86
88
|
rb-fsevent (0.9.4)
|
87
89
|
rb-inotify (0.9.5)
|
88
90
|
ffi (>= 0.5.0)
|
89
|
-
rdoc (4.
|
91
|
+
rdoc (4.2.0)
|
90
92
|
json (~> 1.4)
|
91
93
|
rspec (3.1.0)
|
92
94
|
rspec-core (~> 3.1.0)
|
@@ -111,21 +113,23 @@ GEM
|
|
111
113
|
thread_safe (0.3.4)
|
112
114
|
timers (4.0.1)
|
113
115
|
hitimes
|
116
|
+
yard (0.8.7.6)
|
114
117
|
|
115
118
|
PLATFORMS
|
116
119
|
ruby
|
117
120
|
|
118
121
|
DEPENDENCIES
|
119
|
-
bundler (~> 1.7
|
120
|
-
codeclimate-test-reporter (~> 0.4
|
121
|
-
guard (~> 2.8
|
122
|
-
guard-bundler (~> 2.0
|
123
|
-
guard-rspec (~> 4.3
|
124
|
-
guard-spork (~> 2.0
|
125
|
-
jeweler (~> 2.0
|
122
|
+
bundler (~> 1.7)
|
123
|
+
codeclimate-test-reporter (~> 0.4)
|
124
|
+
guard (~> 2.8)
|
125
|
+
guard-bundler (~> 2.0)
|
126
|
+
guard-rspec (~> 4.3)
|
127
|
+
guard-spork (~> 2.0)
|
128
|
+
jeweler (~> 2.0)
|
126
129
|
libnotify
|
127
130
|
rb-inotify
|
128
|
-
rdoc (~> 4.1
|
131
|
+
rdoc (~> 4.1)
|
129
132
|
rspec (~> 3.1)
|
130
|
-
simplecov (~> 0.9
|
131
|
-
spork (~> 0.9
|
133
|
+
simplecov (~> 0.9)
|
134
|
+
spork (~> 0.9)
|
135
|
+
yard (~> 0.8)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
@@ -1,24 +1,33 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'rspec/expectations'
|
3
|
-
# require 'rspec/expectations/differ'
|
4
3
|
|
5
4
|
|
6
5
|
module Ndd
|
7
6
|
module RSpec
|
8
7
|
module Matchers
|
9
8
|
|
9
|
+
# Ensures that an enumerable responding to {#collect} is sorted in reverse order by the given attribute or
|
10
|
+
# method return value of the objects it contains.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Duck = Struct.new(:color)
|
14
|
+
#
|
15
|
+
# describe 'sorting' do
|
16
|
+
# let(:a_pair_of_sorted_ducks) { [Duck.new('Grey'), Duck.new('White')] }
|
17
|
+
# let(:a_pair_of_reverse_sorted_ducks) { [Duck.new('White'), Duck.new('Grey')] }
|
18
|
+
#
|
19
|
+
# it { expect(a_pair_of_sorted_ducks).to_not be_reverse_sorted_by(:color) }
|
20
|
+
# it { expect(a_pair_of_reverse_sorted_ducks).to be_reverse_sorted_by(:color) }
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# @param attribute [Symbol] the attribute or the method to sort with
|
24
|
+
# @return [Ndd::RSpec::Matchers::BeSortedBy]
|
25
|
+
#
|
10
26
|
def be_reverse_sorted_by(attribute)
|
11
27
|
BeReverseSortedBy.new(attribute)
|
12
28
|
end
|
13
29
|
|
14
|
-
#
|
15
|
-
# Ensures that an enumerable (responding to <code>Enumerable#collect</code>) is sorted in reverse order by the
|
16
|
-
# given attribute of the objects it contains.
|
17
|
-
#
|
18
|
-
# Examples:
|
19
|
-
# Duck = Struct.new(:color)
|
20
|
-
# [Duck.new('White'), Duck.new('Grey')].should be_sorted_by(:color) }
|
21
|
-
#
|
30
|
+
# @private
|
22
31
|
class BeReverseSortedBy
|
23
32
|
|
24
33
|
def initialize(attribute = nil)
|
@@ -50,9 +59,10 @@ expected attributes: #{@sorted_attributes.inspect}
|
|
50
59
|
def ==(other)
|
51
60
|
matches?(other)
|
52
61
|
end
|
53
|
-
|
54
62
|
end
|
55
63
|
|
64
|
+
private_constant :BeReverseSortedBy
|
65
|
+
|
56
66
|
end
|
57
67
|
end
|
58
68
|
end
|
@@ -1,24 +1,34 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'rspec/expectations'
|
3
|
-
# require 'rspec/expectations/differ'
|
4
3
|
|
5
4
|
|
6
5
|
module Ndd
|
7
6
|
module RSpec
|
8
7
|
module Matchers
|
9
8
|
|
9
|
+
# Ensures that an enumerable responding to {#collect} is sorted by the given attribute or method return value of
|
10
|
+
# the objects it contains.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Duck = Struct.new(:color)
|
14
|
+
#
|
15
|
+
# describe 'sorting' do
|
16
|
+
# let(:a_pair_of_sorted_ducks) { [Duck.new('Grey'), Duck.new('White')] }
|
17
|
+
# let(:a_pair_of_reverse_sorted_ducks) { [Duck.new('White'), Duck.new('Grey')] }
|
18
|
+
#
|
19
|
+
# it { expect(a_pair_of_sorted_ducks).to be_sorted_by(:color) }
|
20
|
+
# it { expect(a_pair_of_reverse_sorted_ducks).to_not be_sorted_by(:color) }
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# @param attribute [Symbol] the attribute or the method to sort with
|
24
|
+
# @return [Ndd::RSpec::Matchers::BeSortedBy]
|
25
|
+
#
|
10
26
|
def be_sorted_by(attribute)
|
11
27
|
BeSortedBy.new(attribute)
|
12
28
|
end
|
13
29
|
|
14
|
-
|
15
|
-
#
|
16
|
-
# the objects it contains.
|
17
|
-
#
|
18
|
-
# Examples:
|
19
|
-
# Duck = Struct.new(:color)
|
20
|
-
# [Duck.new('Grey'), Duck.new('White')].should be_sorted_by(:color) }
|
21
|
-
#
|
30
|
+
|
31
|
+
# @private
|
22
32
|
class BeSortedBy
|
23
33
|
|
24
34
|
def initialize(attribute = nil)
|
@@ -50,9 +60,10 @@ expected attributes: #{@sorted_attributes.inspect}
|
|
50
60
|
def ==(other)
|
51
61
|
matches?(other)
|
52
62
|
end
|
53
|
-
|
54
63
|
end
|
55
64
|
|
65
|
+
private_constant :BeSortedBy
|
66
|
+
|
56
67
|
end
|
57
68
|
end
|
58
69
|
end
|
data/ndd-rspec.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: ndd-rspec 1.
|
5
|
+
# stub: ndd-rspec 1.1.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "ndd-rspec"
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.1.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["David DIDIER"]
|
14
|
-
s.date = "2014-12-
|
14
|
+
s.date = "2014-12-11"
|
15
15
|
s.description = "RSpec utilities"
|
16
16
|
s.email = "c_inconnu2@yahoo.fr"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
"ndd-rspec.gemspec",
|
38
38
|
"spec/ndd/rspec/matchers/be_reverse_sorted_by_spec.rb",
|
39
39
|
"spec/ndd/rspec/matchers/be_sorted_by_spec.rb",
|
40
|
+
"spec/ndd/rspec/matchers/duck.rb",
|
40
41
|
"spec/ndd/rspec/matchers/shared_examples.rb",
|
41
42
|
"spec/spec_helper.rb"
|
42
43
|
]
|
@@ -50,42 +51,45 @@ Gem::Specification.new do |s|
|
|
50
51
|
|
51
52
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
53
|
s.add_runtime_dependency(%q<rspec>, ["~> 3.1"])
|
53
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.7
|
54
|
-
s.add_development_dependency(%q<guard>, ["~> 2.8
|
55
|
-
s.add_development_dependency(%q<guard-bundler>, ["~> 2.0
|
56
|
-
s.add_development_dependency(%q<guard-rspec>, ["~> 4.3
|
57
|
-
s.add_development_dependency(%q<guard-spork>, ["~> 2.0
|
58
|
-
s.add_development_dependency(%q<jeweler>, ["~> 2.0
|
59
|
-
s.add_development_dependency(%q<rdoc>, ["~> 4.1
|
60
|
-
s.add_development_dependency(%q<simplecov>, ["~> 0.9
|
61
|
-
s.add_development_dependency(%q<spork>, ["~> 0.9
|
54
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.7"])
|
55
|
+
s.add_development_dependency(%q<guard>, ["~> 2.8"])
|
56
|
+
s.add_development_dependency(%q<guard-bundler>, ["~> 2.0"])
|
57
|
+
s.add_development_dependency(%q<guard-rspec>, ["~> 4.3"])
|
58
|
+
s.add_development_dependency(%q<guard-spork>, ["~> 2.0"])
|
59
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
60
|
+
s.add_development_dependency(%q<rdoc>, ["~> 4.1"])
|
61
|
+
s.add_development_dependency(%q<simplecov>, ["~> 0.9"])
|
62
|
+
s.add_development_dependency(%q<spork>, ["~> 0.9"])
|
63
|
+
s.add_development_dependency(%q<yard>, ["~> 0.8"])
|
62
64
|
s.add_development_dependency(%q<libnotify>, [">= 0"])
|
63
65
|
s.add_development_dependency(%q<rb-inotify>, [">= 0"])
|
64
66
|
else
|
65
67
|
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
66
|
-
s.add_dependency(%q<bundler>, ["~> 1.7
|
67
|
-
s.add_dependency(%q<guard>, ["~> 2.8
|
68
|
-
s.add_dependency(%q<guard-bundler>, ["~> 2.0
|
69
|
-
s.add_dependency(%q<guard-rspec>, ["~> 4.3
|
70
|
-
s.add_dependency(%q<guard-spork>, ["~> 2.0
|
71
|
-
s.add_dependency(%q<jeweler>, ["~> 2.0
|
72
|
-
s.add_dependency(%q<rdoc>, ["~> 4.1
|
73
|
-
s.add_dependency(%q<simplecov>, ["~> 0.9
|
74
|
-
s.add_dependency(%q<spork>, ["~> 0.9
|
68
|
+
s.add_dependency(%q<bundler>, ["~> 1.7"])
|
69
|
+
s.add_dependency(%q<guard>, ["~> 2.8"])
|
70
|
+
s.add_dependency(%q<guard-bundler>, ["~> 2.0"])
|
71
|
+
s.add_dependency(%q<guard-rspec>, ["~> 4.3"])
|
72
|
+
s.add_dependency(%q<guard-spork>, ["~> 2.0"])
|
73
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
74
|
+
s.add_dependency(%q<rdoc>, ["~> 4.1"])
|
75
|
+
s.add_dependency(%q<simplecov>, ["~> 0.9"])
|
76
|
+
s.add_dependency(%q<spork>, ["~> 0.9"])
|
77
|
+
s.add_dependency(%q<yard>, ["~> 0.8"])
|
75
78
|
s.add_dependency(%q<libnotify>, [">= 0"])
|
76
79
|
s.add_dependency(%q<rb-inotify>, [">= 0"])
|
77
80
|
end
|
78
81
|
else
|
79
82
|
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
80
|
-
s.add_dependency(%q<bundler>, ["~> 1.7
|
81
|
-
s.add_dependency(%q<guard>, ["~> 2.8
|
82
|
-
s.add_dependency(%q<guard-bundler>, ["~> 2.0
|
83
|
-
s.add_dependency(%q<guard-rspec>, ["~> 4.3
|
84
|
-
s.add_dependency(%q<guard-spork>, ["~> 2.0
|
85
|
-
s.add_dependency(%q<jeweler>, ["~> 2.0
|
86
|
-
s.add_dependency(%q<rdoc>, ["~> 4.1
|
87
|
-
s.add_dependency(%q<simplecov>, ["~> 0.9
|
88
|
-
s.add_dependency(%q<spork>, ["~> 0.9
|
83
|
+
s.add_dependency(%q<bundler>, ["~> 1.7"])
|
84
|
+
s.add_dependency(%q<guard>, ["~> 2.8"])
|
85
|
+
s.add_dependency(%q<guard-bundler>, ["~> 2.0"])
|
86
|
+
s.add_dependency(%q<guard-rspec>, ["~> 4.3"])
|
87
|
+
s.add_dependency(%q<guard-spork>, ["~> 2.0"])
|
88
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
89
|
+
s.add_dependency(%q<rdoc>, ["~> 4.1"])
|
90
|
+
s.add_dependency(%q<simplecov>, ["~> 0.9"])
|
91
|
+
s.add_dependency(%q<spork>, ["~> 0.9"])
|
92
|
+
s.add_dependency(%q<yard>, ["~> 0.8"])
|
89
93
|
s.add_dependency(%q<libnotify>, [">= 0"])
|
90
94
|
s.add_dependency(%q<rb-inotify>, [">= 0"])
|
91
95
|
end
|
@@ -2,9 +2,10 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'ndd/rspec/matchers'
|
4
4
|
require 'ndd/rspec/matchers/shared_examples'
|
5
|
+
require_relative 'duck'
|
5
6
|
|
6
7
|
|
7
|
-
describe 'be reverse sorted by', {
|
8
|
+
describe 'be reverse sorted by', {:type => 'matcher'} do
|
8
9
|
|
9
10
|
REVERSE_SORTED_ARRAY = [3, 2, 1].freeze
|
10
11
|
REVERSE_UNSORTED_ARRAY = [1, 3, 2].freeze
|
@@ -15,12 +16,12 @@ describe 'be reverse sorted by', { :type => 'matcher' } do
|
|
15
16
|
let(:matcher) { be_reverse_sorted_by(:to_i) }
|
16
17
|
end
|
17
18
|
|
18
|
-
|
19
|
-
expect(REVERSE_SORTED_ARRAY).to be_reverse_sorted_by(:to_i)
|
19
|
+
context 'when the actual is sorted according to the given attribute in reverse order' do
|
20
|
+
it { expect(REVERSE_SORTED_ARRAY).to be_reverse_sorted_by(:to_i) }
|
20
21
|
end
|
21
22
|
|
22
|
-
|
23
|
-
expect(REVERSE_UNSORTED_ARRAY).to_not be_reverse_sorted_by(:to_i)
|
23
|
+
context 'when the actual is not sorted according to the given attribute in reverse order' do
|
24
|
+
it { expect(REVERSE_UNSORTED_ARRAY).to_not be_reverse_sorted_by(:to_i) }
|
24
25
|
end
|
25
26
|
|
26
27
|
it 'describes itself' do
|
@@ -42,4 +43,14 @@ expected attributes: [3, 2, 1]
|
|
42
43
|
MESSAGE
|
43
44
|
end
|
44
45
|
|
46
|
+
describe 'documentation' do
|
47
|
+
describe 'sorting' do
|
48
|
+
let(:a_pair_of_sorted_ducks) { [Duck.new('Grey'), Duck.new('White')] }
|
49
|
+
let(:a_pair_of_reverse_sorted_ducks) { [Duck.new('White'), Duck.new('Grey')] }
|
50
|
+
|
51
|
+
it { expect(a_pair_of_sorted_ducks).to_not be_reverse_sorted_by(:color) }
|
52
|
+
it { expect(a_pair_of_reverse_sorted_ducks).to be_reverse_sorted_by(:color) }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
45
56
|
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'ndd/rspec/matchers'
|
4
4
|
require 'ndd/rspec/matchers/shared_examples'
|
5
|
+
require_relative 'duck'
|
5
6
|
|
6
|
-
|
7
|
-
describe 'be sorted by', { :type => 'matcher' } do
|
7
|
+
describe 'be sorted by', {:type => 'matcher'} do
|
8
8
|
|
9
9
|
SORTED_ARRAY = [1, 2, 3].freeze
|
10
10
|
UNSORTED_ARRAY = [1, 3, 2].freeze
|
@@ -15,12 +15,12 @@ describe 'be sorted by', { :type => 'matcher' } do
|
|
15
15
|
let(:matcher) { be_sorted_by(:to_i) }
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
expect(SORTED_ARRAY).to be_sorted_by(:to_i)
|
18
|
+
context 'when the actual is sorted according to the given attribute' do
|
19
|
+
it { expect(SORTED_ARRAY).to be_sorted_by(:to_i) }
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
expect(UNSORTED_ARRAY).to_not be_sorted_by(:to_i)
|
22
|
+
context 'when the actual is not sorted according to the given attribute' do
|
23
|
+
it { expect(UNSORTED_ARRAY).to_not be_sorted_by(:to_i) }
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'describes itself' do
|
@@ -42,4 +42,14 @@ expected attributes: [1, 2, 3]
|
|
42
42
|
MESSAGE
|
43
43
|
end
|
44
44
|
|
45
|
+
describe 'documentation' do
|
46
|
+
describe 'sorting' do
|
47
|
+
let(:a_pair_of_sorted_ducks) { [Duck.new('Grey'), Duck.new('White')] }
|
48
|
+
let(:a_pair_of_reverse_sorted_ducks) { [Duck.new('White'), Duck.new('Grey')] }
|
49
|
+
|
50
|
+
it { expect(a_pair_of_sorted_ducks).to be_sorted_by(:color) }
|
51
|
+
it { expect(a_pair_of_reverse_sorted_ducks).to_not be_sorted_by(:color) }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
45
55
|
end
|
@@ -3,15 +3,17 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
shared_examples_for 'an RSpec matcher' do |options|
|
5
5
|
|
6
|
-
let(:valid_value)
|
6
|
+
let(:valid_value) { options.fetch(:valid_value) }
|
7
7
|
let(:invalid_value) { options.fetch(:invalid_value) }
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
context 'when using #== so it can be composed' do
|
10
|
+
it 'matches a valid value' do
|
11
|
+
expect(matcher).to eq(valid_value)
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
it 'does not match an invalid value' do
|
15
|
+
expect(matcher).not_to eq(invalid_value)
|
16
|
+
end
|
15
17
|
end
|
16
18
|
|
17
19
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndd-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David DIDIER
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -30,126 +30,140 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.7
|
33
|
+
version: '1.7'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.7
|
40
|
+
version: '1.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: guard
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.8
|
47
|
+
version: '2.8'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.8
|
54
|
+
version: '2.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: guard-bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.0
|
61
|
+
version: '2.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.0
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 4.3
|
75
|
+
version: '4.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 4.3
|
82
|
+
version: '4.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: guard-spork
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.0
|
89
|
+
version: '2.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.0
|
96
|
+
version: '2.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: jeweler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.0
|
103
|
+
version: '2.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.0
|
110
|
+
version: '2.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rdoc
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 4.1
|
117
|
+
version: '4.1'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 4.1
|
124
|
+
version: '4.1'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.9
|
131
|
+
version: '0.9'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.9
|
138
|
+
version: '0.9'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: spork
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.9
|
145
|
+
version: '0.9'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.9
|
152
|
+
version: '0.9'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: yard
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.8'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.8'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: libnotify
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,6 +218,7 @@ files:
|
|
204
218
|
- ndd-rspec.gemspec
|
205
219
|
- spec/ndd/rspec/matchers/be_reverse_sorted_by_spec.rb
|
206
220
|
- spec/ndd/rspec/matchers/be_sorted_by_spec.rb
|
221
|
+
- spec/ndd/rspec/matchers/duck.rb
|
207
222
|
- spec/ndd/rspec/matchers/shared_examples.rb
|
208
223
|
- spec/spec_helper.rb
|
209
224
|
homepage: http://github.com/ddidier/ndd-rspec
|