rspec-junklet 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/lib/rspec/junklet.rb +1 -0
- data/lib/rspec/junklet/version.rb +1 -1
- data/rspec-junklet.gemspec +1 -1
- data/spec/lib/rspec/examples_spec.rb +0 -52
- metadata +17 -11
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDQxMTliMDE4Zjk5Yjg3NmQ4OTEwYzZhYTJkMmEzZjlmMzE4Mzg2ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTk1ZjllMmM4ZGJhNTI1YWU1OTA0NzNlY2FiNTk2ODQxYTNiOGY2Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWU0ODIxODI2MmJkOTNkNDA4YWRkYjRhZjI4ZWE4ZWUwNGVmZDc0YjI3YmRj
|
10
|
+
OWQ5MmMxNDZkYmZlOGE1MTEwNDBlNmZiYzY3ZmMyNDQwOTIwM2JmZjIzM2Q4
|
11
|
+
NjFkZGNjNzA0NzJhY2Y0MTllYTYzMGNhM2M3MTQzYTlmZmExN2I=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2M0NWIzYmM1MDc0ZTUwOGQ4MjUyNGQxNDYwYmM4NzA1ODJiN2E4OWI2NjU1
|
14
|
+
M2EzMzg1OTZhNzAyYzNlMTRmMGZiZmVmZjA4NjBjZjZiODZiNzhlN2Q1ZDQw
|
15
|
+
ZDRmYzZhYTQwMmZlNTkzNTE4ODY0NmViYzY5ZmVhOWU1NThmYjc=
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-junklet (2.1.
|
4
|
+
rspec-junklet (2.1.3)
|
5
|
+
rspec (>= 2.0, < 4.0)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
@@ -31,5 +32,4 @@ DEPENDENCIES
|
|
31
32
|
bundler (~> 1.7)
|
32
33
|
pry (~> 0.10)
|
33
34
|
rake (~> 10.0)
|
34
|
-
rspec (~> 2.0)
|
35
35
|
rspec-junklet!
|
data/README.md
CHANGED
@@ -272,8 +272,8 @@ Here are the available formats:
|
|
272
272
|
string as the format string
|
273
273
|
* `format: SomeClass` passes the junk to `SomeClass.new`, returning an instance
|
274
274
|
of `SomeClass`. *Important:* This class must implement a `#format` method
|
275
|
-
which returns the formatted junk. See the `::Junklet::Formatter` class
|
276
|
-
example class that simply returns the unmodified junk.
|
275
|
+
which returns the formatted junk. See the `::RSpec::Junklet::Formatter` class
|
276
|
+
for an example class that simply returns the unmodified junk.
|
277
277
|
* `format: ->(x) { ... }` passes the junk to your Proc; whatever you return is
|
278
278
|
the value of the junk. This is obviously the most powerful transform as it can
|
279
279
|
return anything at all; there's nothing stopping you from using the format
|
data/lib/rspec/junklet.rb
CHANGED
data/rspec-junklet.gemspec
CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_development_dependency "rspec", "~> 2.0"
|
24
23
|
spec.add_development_dependency "pry", "~> 0.10"
|
24
|
+
spec.add_dependency "rspec", [">= 2.0", "< 4.0"]
|
25
25
|
end
|
@@ -178,38 +178,6 @@ describe RSpec::Junklet do
|
|
178
178
|
specify { expect(coin_tails).to eq(tails) }
|
179
179
|
end
|
180
180
|
|
181
|
-
context "with format" do
|
182
|
-
context "format: :string" do
|
183
|
-
let(:age_string) { junk :int, size: 2, format: :string }
|
184
|
-
it "changes junk to a string" do
|
185
|
-
expect(age_string).to match /^\d\d$/
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
context "format: <string>" do
|
190
|
-
let(:birthday) { junk :int, max: 9, format: "03/15/20%02d" }
|
191
|
-
it "formats using the string as a sprintf format" do
|
192
|
-
expect(birthday).to match %r{^03/15/200\d$}
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
context "format: SomeClass" do
|
197
|
-
class Birthday
|
198
|
-
def initialize(day)
|
199
|
-
@day = day
|
200
|
-
end
|
201
|
-
def format
|
202
|
-
"%02d/%02d/20%02d" % [@day, @day, @day]
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
let(:birthday) { junk :int, max: 12, format: Birthday }
|
207
|
-
it "uses the class as a formatter instance with .new(junk).format" do
|
208
|
-
expect(birthday).to match %r{^\d\d/\d\d/20\d\d$}
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
181
|
# TODO: Formats here
|
214
182
|
|
215
183
|
# format: :string -> calls .to_s
|
@@ -228,24 +196,4 @@ describe RSpec::Junklet do
|
|
228
196
|
specify { expect(metaname).to be }
|
229
197
|
end
|
230
198
|
end
|
231
|
-
|
232
|
-
|
233
|
-
# describe '.junks' do
|
234
|
-
# junks :age, :size, :weight, type: :int, format: :string
|
235
|
-
|
236
|
-
# it "makes all the defined junk objects the same type" do
|
237
|
-
# expect(age).to be_a String
|
238
|
-
# expect(size).to be_a String
|
239
|
-
# expect(weight).to be_a String
|
240
|
-
# end
|
241
|
-
|
242
|
-
# it "formats all the junk objects per the formatter" do
|
243
|
-
# # This is why it's not just an extra param to junklet: junklet
|
244
|
-
# # prepends the name of the symbol.
|
245
|
-
# expect(age).to match /^\d+$/
|
246
|
-
# expect(size).to match /^\d+$/
|
247
|
-
# expect(weight).to match /^\d+$/
|
248
|
-
# end
|
249
|
-
# end
|
250
|
-
|
251
199
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-junklet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Brady
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,33 +39,39 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0.10'
|
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: '
|
54
|
+
version: '0.10'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
62
|
-
|
61
|
+
version: '2.0'
|
62
|
+
- - <
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '4.0'
|
65
|
+
type: :runtime
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
|
-
- -
|
69
|
+
- - ! '>='
|
67
70
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
71
|
+
version: '2.0'
|
72
|
+
- - <
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '4.0'
|
69
75
|
description: Works like let for rspec, but creates unique random junk data
|
70
76
|
email:
|
71
77
|
- dbrady@shinybit.com
|