peck-on-rails 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/peck_on_rails.rb +1 -1
- data/lib/peck_on_rails/assertions.rb +17 -9
- data/lib/peck_on_rails/controller.rb +2 -0
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa4a5953aaa1cee1cbf9d0adfec6de51b1bd2358
|
4
|
+
data.tar.gz: 309a2da3df5bf76b9b913d59246917f5d6e0446d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f74def668828388328594b5e7542571a066ef061daa2b96164044fc6b0b5cf5349303b68f37b82769a7a736b7cb24dcebcf5d6c5e57a3d6f1668a2bbcf000b6
|
7
|
+
data.tar.gz: 8dbf3649f9d3513fb15c6211c41ca3ec3c784a6b339333f69feac6401c381f79edc97535aea7beac9783caa52d6182e5ba5cc6fa8f5ce2118f01b59e66ac2178
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ Peck-On-Rails automatically supports model, controller, and helper specs. By def
|
|
53
53
|
describe "A new", Book do
|
54
54
|
it "does not have any pages" do
|
55
55
|
book = Book.new
|
56
|
-
book.pages.count.should
|
56
|
+
book.pages.count.should.eql(0)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -98,7 +98,7 @@ In `:helper` specs you automatically get your helper module included.
|
|
98
98
|
describe BooksHelper do
|
99
99
|
it "formats titles" do
|
100
100
|
book = Book.new(title: 'Little Pinguin', :number = 12)
|
101
|
-
format_book_title(book).should
|
101
|
+
format_book_title(book).should.eql("12. Little Pinguin")
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -109,7 +109,7 @@ For controller specs you get a `@controller` instance, a `controller` accessor,
|
|
109
109
|
describe "On the", BooksController, "a visitor" do
|
110
110
|
it "sees an overview of recent books" do
|
111
111
|
get :index
|
112
|
-
status.should
|
112
|
+
status.should.eql(:ok)
|
113
113
|
templates.should.include 'books/index'
|
114
114
|
body.should.match_css 'h1' # Only possible when Nokogiri is installed
|
115
115
|
body.should.match_xpath '//h1' # Only possible when Nokogiri is installed
|
data/lib/peck_on_rails.rb
CHANGED
@@ -12,11 +12,16 @@ class Peck
|
|
12
12
|
_allowed_exceptions = self.allowed_exceptions
|
13
13
|
context.it(description(verb, action, params)) do
|
14
14
|
begin
|
15
|
-
|
15
|
+
immediate_values = immediate_values(params)
|
16
|
+
if immediate_values.present?
|
17
|
+
send(verb, action, immediate_values)
|
18
|
+
else
|
19
|
+
send(verb, action)
|
20
|
+
end
|
16
21
|
rescue => raised_exception
|
17
22
|
if _allowed_exceptions
|
18
23
|
_allowed_exceptions.any? { |exception| raised_exception.should.be.kind_of(exception) }
|
19
|
-
true.should
|
24
|
+
true.should.eql(true) # Force the expectations counter
|
20
25
|
else
|
21
26
|
raise
|
22
27
|
end
|
@@ -24,7 +29,7 @@ class Peck
|
|
24
29
|
if _negated
|
25
30
|
send(_method).should.not == _expected
|
26
31
|
else
|
27
|
-
send(_method).should
|
32
|
+
send(_method).should.eql(_expected)
|
28
33
|
end
|
29
34
|
end
|
30
35
|
end
|
@@ -128,24 +133,27 @@ class Peck
|
|
128
133
|
end
|
129
134
|
|
130
135
|
def equal_record_set(*others)
|
131
|
-
left = @this
|
132
|
-
|
136
|
+
left, right = @this, others
|
137
|
+
left.flatten! if left.respond_to?(:flatten)
|
138
|
+
right.flatten! if right.respond_to?(:flatten)
|
133
139
|
|
134
140
|
message = "Expected the record set to be #{!@negated ? 'equal' : 'unequal'}: #{left.map(&:id).inspect} - #{right.map(&:id).inspect}"
|
135
141
|
satisfy(message) { Set.new(left) == Set.new(right) }
|
136
142
|
end
|
137
143
|
|
138
144
|
def equal_record_array(*others)
|
139
|
-
left = @this
|
140
|
-
|
145
|
+
left, right = @this, others
|
146
|
+
left.flatten! if left.respond_to?(:flatten)
|
147
|
+
right.flatten! if right.respond_to?(:flatten)
|
141
148
|
|
142
149
|
message = "Expected the array of records to be #{!@negated ? 'equal' : 'unequal'}: #{left.map(&:id).inspect} - #{right.map(&:id).inspect}"
|
143
150
|
satisfy(message) { left == right }
|
144
151
|
end
|
145
152
|
|
146
153
|
def equal_set(*others)
|
147
|
-
left = @this
|
148
|
-
|
154
|
+
left, right = @this, others
|
155
|
+
left.flatten! if left.respond_to?(:flatten)
|
156
|
+
right.flatten! if right.respond_to?(:flatten)
|
149
157
|
|
150
158
|
message = "Expected sets to be #{!@negated ? 'equal' : 'unequal'}: #{left.inspect} - #{right.inspect}"
|
151
159
|
satisfy(message) { Set.new(left) == Set.new(right) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peck-on-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manfred Stienstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: peck
|
@@ -38,8 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
42
|
-
Peck-On-Rails is an extension for Peck to make testing Rails easier.
|
41
|
+
description: " Peck-On-Rails is an extension for Peck to make testing Rails easier.\n"
|
43
42
|
email: manfred@fngtps.com
|
44
43
|
executables: []
|
45
44
|
extensions: []
|
@@ -74,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
73
|
version: '0'
|
75
74
|
requirements: []
|
76
75
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
76
|
+
rubygems_version: 2.5.2
|
78
77
|
signing_key:
|
79
78
|
specification_version: 4
|
80
79
|
summary: Peck-On-Rails adds useful helpers and context extensions to make testing
|