rspec-its 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Changelog.md +11 -3
- data/README.md +9 -1
- data/features/its.feature +3 -0
- data/lib/rspec/its.rb +4 -1
- data/lib/rspec/its/version.rb +1 -1
- data/rspec-its.gemspec +1 -1
- data/spec/rspec/its_spec.rb +28 -10
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40adcf789a8a325a4b84fa3a8725f0f1fe3be430
|
4
|
+
data.tar.gz: b0a3c159d913d69312139220847d2ab65c6a5f9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed85cce42900e2795d574779f9c20a474c0e9db291c629bd8bd4f5e65ff1c9dbb6a65159e9687d5feef2cf04817f8f59e55c92dd31e8010da428a7592a144ee5
|
7
|
+
data.tar.gz: 1e8203367a72f25f479d06dd0930249db8341673f07fca7e5a880ee185e9295c2be21ce290596f10bc034dbba140b45d8396ee2e141a9879ce3ae40e7c99d553
|
data/.travis.yml
CHANGED
data/Changelog.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
### 1.2.0 / 2015-02-06
|
2
|
+
[full changelog](http://github.com/rspec/rspec-its/compare/v1.1.0...v1.2.0)
|
3
|
+
|
4
|
+
Breaking Changes:
|
5
|
+
|
6
|
+
Enhancements:
|
7
|
+
* Introduced `are_expected` as alias for `is_expected`
|
8
|
+
|
9
|
+
Bug fixes:
|
10
|
+
* Restored ability to pass key/value metadata parameters, broken by https://github.com/rspec/rspec-its/commit/71307bc7051f482bfc2798daa390bee9142b0d5a
|
11
|
+
|
1
12
|
### 1.1.0 / 2014-04-13
|
2
13
|
[full changelog](http://github.com/rspec/rspec-its/compare/v1.0.1...v1.1.0)
|
3
14
|
|
@@ -22,17 +33,14 @@ Bug fixes:
|
|
22
33
|
|
23
34
|
Breaking Changes:
|
24
35
|
|
25
|
-
|
26
36
|
Enhancements:
|
27
37
|
* Add `is_expected` support to match RSpec 3.0
|
28
38
|
|
29
39
|
Deprecations:
|
30
40
|
|
31
|
-
|
32
41
|
Bug Fixes:
|
33
42
|
* Report failures and backtrace from client perspective
|
34
43
|
|
35
|
-
|
36
44
|
### 1.0.0.pre / 2013-10-11
|
37
45
|
|
38
46
|
Features
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# RSpec::Its [![Build Status](https://travis-ci.org/rspec/rspec-its.
|
1
|
+
# RSpec::Its [![Build Status](https://travis-ci.org/rspec/rspec-its.svg)](https://travis-ci.org/rspec/rspec-its)
|
2
2
|
|
3
3
|
RSpec::Its provides the `its` method as a short-hand to specify the expected value of an attribute.
|
4
4
|
|
@@ -36,6 +36,14 @@ attribute of the attribute of the subject).
|
|
36
36
|
|
37
37
|
its("phone_numbers.size") { should_not eq(0) }
|
38
38
|
|
39
|
+
The following expect-style method is also available:
|
40
|
+
|
41
|
+
its(:size) { is_expected.to eq(1) }
|
42
|
+
|
43
|
+
as is this alias for pluralized use:
|
44
|
+
|
45
|
+
its(:keys) { are_expected.to eq([:key1, :key2])
|
46
|
+
|
39
47
|
When the subject implements the `[]` operator, you can pass in an array with a single key to
|
40
48
|
refer to the value returned by that operator when passed that key as an argument.
|
41
49
|
|
data/features/its.feature
CHANGED
data/lib/rspec/its.rb
CHANGED
@@ -120,6 +120,7 @@ module RSpec
|
|
120
120
|
def is_expected
|
121
121
|
expect(__its_subject)
|
122
122
|
end
|
123
|
+
alias_method :are_expected, :is_expected
|
123
124
|
|
124
125
|
def should(matcher=nil, message=nil)
|
125
126
|
RSpec::Expectations::PositiveExpectationHandler.handle_matcher(__its_subject, matcher, message)
|
@@ -129,7 +130,9 @@ module RSpec
|
|
129
130
|
RSpec::Expectations::NegativeExpectationHandler.handle_matcher(__its_subject, matcher, message)
|
130
131
|
end
|
131
132
|
|
132
|
-
options << {
|
133
|
+
options << {} unless options.last.kind_of?(Hash)
|
134
|
+
options.last.merge!(:caller => its_caller)
|
135
|
+
|
133
136
|
example(nil, *options, &block)
|
134
137
|
|
135
138
|
end
|
data/lib/rspec/its/version.rb
CHANGED
data/rspec-its.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Peter Alfvin"]
|
10
10
|
spec.email = ["palfvin@gmail.com"]
|
11
11
|
spec.description = %q{RSpec extension gem for attribute matching}
|
12
|
-
spec.summary = %q{Provides "its" method
|
12
|
+
spec.summary = %q{Provides "its" method formerly part of rspec-core}
|
13
13
|
spec.homepage = "https://github.com/rspec/rspec-its"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/spec/rspec/its_spec.rb
CHANGED
@@ -5,7 +5,7 @@ module RSpec
|
|
5
5
|
describe "#its" do
|
6
6
|
context "with implicit subject" do
|
7
7
|
context "preserves described_class" do
|
8
|
-
its(:symbol) { expect(described_class).to be Its}
|
8
|
+
its(:symbol) { expect(described_class).to be Its }
|
9
9
|
its([]) { expect(described_class).to be Its }
|
10
10
|
end
|
11
11
|
end
|
@@ -53,18 +53,21 @@ module RSpec
|
|
53
53
|
end
|
54
54
|
end.new
|
55
55
|
end
|
56
|
-
its("name")
|
57
|
-
its("name.size")
|
56
|
+
its("name") { should eq("John") }
|
57
|
+
its("name.size") { should eq(4) }
|
58
58
|
its("name.size.class") { should eq(Fixnum) }
|
59
59
|
|
60
60
|
context "using should_not" do
|
61
|
-
its("name")
|
61
|
+
its("name") { should_not eq("Paul") }
|
62
62
|
end
|
63
63
|
|
64
64
|
context "using is_expected" do
|
65
|
-
its("name")
|
65
|
+
its("name") { is_expected.to eq("John") }
|
66
66
|
end
|
67
67
|
|
68
|
+
context "using are_expected" do
|
69
|
+
its("name.chars.to_a") { are_expected.to eq(%w[J o h n]) }
|
70
|
+
end
|
68
71
|
end
|
69
72
|
|
70
73
|
context "when it responds to #[]" do
|
@@ -130,7 +133,9 @@ module RSpec
|
|
130
133
|
its(:last) { should eq("a") }
|
131
134
|
|
132
135
|
describe '.first' do
|
133
|
-
def subject;
|
136
|
+
def subject;
|
137
|
+
super().first;
|
138
|
+
end
|
134
139
|
|
135
140
|
its(:next) { should eq(2) }
|
136
141
|
end
|
@@ -146,6 +151,7 @@ module RSpec
|
|
146
151
|
def initialize
|
147
152
|
@counter = -1
|
148
153
|
end
|
154
|
+
|
149
155
|
def nil_if_first_time
|
150
156
|
@counter += 1
|
151
157
|
@counter == 0 ? nil : true
|
@@ -161,6 +167,7 @@ module RSpec
|
|
161
167
|
def initialize
|
162
168
|
@counter = -1
|
163
169
|
end
|
170
|
+
|
164
171
|
def false_if_first_time
|
165
172
|
@counter += 1
|
166
173
|
@counter > 0
|
@@ -186,8 +193,8 @@ module RSpec
|
|
186
193
|
|
187
194
|
describe "in shared_context" do
|
188
195
|
shared_context "shared stuff" do
|
189
|
-
subject {Array}
|
190
|
-
its(:name) {should eq "Array"}
|
196
|
+
subject { Array }
|
197
|
+
its(:name) { should eq "Array" }
|
191
198
|
end
|
192
199
|
|
193
200
|
include_context "shared stuff"
|
@@ -212,8 +219,19 @@ module RSpec
|
|
212
219
|
end
|
213
220
|
end
|
214
221
|
end
|
222
|
+
context "with metadata" do
|
223
|
+
context "preserves access to metadata that doesn't end in hash" do
|
224
|
+
its([], :foo) do |example|
|
225
|
+
expect(example.metadata[:foo]).to be(true)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
context "preserves access to metadata that ends in hash" do
|
229
|
+
its([], :foo, :bar => 17) do |example|
|
230
|
+
expect(example.metadata[:foo]).to be(true)
|
231
|
+
expect(example.metadata[:bar]).to be(17)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
215
235
|
end
|
216
236
|
end
|
217
|
-
|
218
|
-
|
219
237
|
end
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-its
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Alfvin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec-expectations
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 3.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.3'
|
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
54
|
version: '1.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 10.1.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
68
|
version: 10.1.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: cucumber
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.3.8
|
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
82
|
version: 1.3.8
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: aruba
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.5'
|
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
96
|
version: '0.5'
|
97
97
|
description: RSpec extension gem for attribute matching
|
@@ -101,9 +101,9 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
- .gitignore
|
105
|
-
- .rspec
|
106
|
-
- .travis.yml
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
107
|
- Changelog.md
|
108
108
|
- Gemfile
|
109
109
|
- LICENSE.txt
|
@@ -129,20 +129,20 @@ require_paths:
|
|
129
129
|
- lib
|
130
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
|
-
- -
|
132
|
+
- - ">="
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.4.3
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
|
-
summary: Provides "its" method
|
145
|
+
summary: Provides "its" method formerly part of rspec-core
|
146
146
|
test_files:
|
147
147
|
- features/its.feature
|
148
148
|
- features/step_definitions/additional_cli_steps.rb
|