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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 983910938947f3b167357b8884551802c68f461b
4
- data.tar.gz: 4257a34ffdab95c6d6593a5474ff4a49e42026ff
3
+ metadata.gz: fa4a5953aaa1cee1cbf9d0adfec6de51b1bd2358
4
+ data.tar.gz: 309a2da3df5bf76b9b913d59246917f5d6e0446d
5
5
  SHA512:
6
- metadata.gz: 2da9e480923e109174e60bf29b1e9e18e944147398c1cea15f86949d45be1de947e0358b4c779493eb017b0e6ef4a19e9e7c56e001cbea87476ba2ad2b22d099
7
- data.tar.gz: b51f97c1df464400c78878bc81dec1b8ba73cd96cd75c38a698d7777ac9a38bd42faef5835e13b145698bac105feade127aa6f9c5343b200277a9654bb0cfb0b
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 == 0
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 == "12. Little Pinguin"
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 == :ok
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
@@ -32,7 +32,7 @@ class Peck
32
32
  context.description.find { |a| a.is_a?(Module) }
33
33
  end
34
34
 
35
- def self.context_type_for_description(context, subject)
35
+ def self.context_type_for_description(context, _)
36
36
  context.description.find do |subject|
37
37
  subject.is_a?(Symbol)
38
38
  end
@@ -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
- send(verb, action, immediate_values(params))
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 == true # Force the expectations counter
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 == _expected
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.flatten
132
- right = others.flatten
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.flatten
140
- right = others.flatten
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.flatten
148
- right = others.flatten
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) }
@@ -105,6 +105,8 @@ class Peck
105
105
  end
106
106
  end
107
107
 
108
+ alias_method :eql?, :==
109
+
108
110
  def inspect
109
111
  "#<Peck::Rails::Controller::Status:#{@response.status}>"
110
112
  end
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.3.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: 2014-10-23 00:00:00.000000000 Z
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: |2
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.2.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