nala 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdba579249251211672cfe2194920064d8c347a5
4
- data.tar.gz: def872611eadb7bfc924939c4a51792562b50eed
3
+ metadata.gz: d87e064fd811730de41a3619632242a9059d5c3c
4
+ data.tar.gz: 69c65044ee82f3b3844faaafefff09d773a80f9a
5
5
  SHA512:
6
- metadata.gz: 25eca85f93b3b66134ee9ec135eb0842424c349cc6e67bd961564bc16237fc8aad3c08d709d959a933c5ede12f872eb38d1af2046a2715c2220e976a36264484
7
- data.tar.gz: 0052b8685f00185a3ca665aa945c060e9e2aafb9cf3d4a9f68a5f182f3b6ad059205de47b285372611005147ff57de99b880613948d8ef4d78bee2c1d454baf5
6
+ metadata.gz: e1c78d8c10c6a0e5fc2099eefc65ddbc138a8b729c68d17c6c44e03561143e0e47e5edd7e1f51742a1041fb037e609df03184f067b4496aa4cd9fb287ef795bf
7
+ data.tar.gz: ae16065d973d70d209fb9aa1b874d0b0572e9dec94513660fa15d36c977c07d9e5960f0f8449520567511c203862bfe066f627813037cea6c6fae80b9523e8c4
data/lib/nala/rspec.rb CHANGED
@@ -6,7 +6,7 @@ module Nala
6
6
 
7
7
  def initialize
8
8
  @called = false
9
- @args = []
9
+ @args = []
10
10
  end
11
11
 
12
12
  def called!
@@ -19,7 +19,7 @@ module Nala
19
19
  end
20
20
 
21
21
  def called?
22
- @called
22
+ called
23
23
  end
24
24
 
25
25
  def spy
@@ -36,6 +36,9 @@ RSpec::Matchers.define :be_called_with do |*expected_args|
36
36
  failure_message do |block|
37
37
  return "expected the block to be called but it was not" unless block.called?
38
38
 
39
- "expected the block to be called with the arguments #{expected_args.inspect} but was called with #{block.args.inspect}"
39
+ %(
40
+ expected the block to be called with the arguments
41
+ #{expected_args.inspect} but it was called with #{block.args.inspect}
42
+ ).strip.squeeze(" ").delete("\n")
40
43
  end
41
44
  end
data/lib/nala/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nala
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/readme.md CHANGED
@@ -66,7 +66,7 @@ class OrderController < ApplicationController
66
66
  end
67
67
  ```
68
68
 
69
- This comes in handy when there are more than two out comes to a use case:
69
+ This comes in handy when there are more than two outcomes to a use case:
70
70
 
71
71
  ```ruby
72
72
  class RegistrationController < ApplicationController
@@ -142,13 +142,30 @@ method:
142
142
  let(:block) { Nala::BlockSpy.new }
143
143
 
144
144
  it "passes multiple arguments to handlers" do
145
- PublishArgsClass.call
146
- .on(:multiple, &block.spy)
145
+ PublishArgsClass.call.on(:multiple, &block.spy)
147
146
 
148
147
  expect(block).to be_called_with(:a, :b, :c)
149
148
  end
150
149
  ```
151
150
 
151
+ You can of course spy on multiple blocks in a single spec if you need to. We
152
+ recommend naming your block after the event it will be called by (rather than
153
+ just `block`):
154
+
155
+ ```ruby
156
+ let(:success) { Nala::BlockSpy.new }
157
+ let(:notified) { Nala::BlockSpy.new }
158
+
159
+ it "passes multiple arguments to handlers" do
160
+ PlaceOrder.call
161
+ .on(:success, &success.spy)
162
+ .on(:notified, &notified.spy)
163
+
164
+ expect(success).to be_called_with(order)
165
+ expect(notified).to be_called_with(:email)
166
+ end
167
+ ```
168
+
152
169
  ## Notes for maintainers
153
170
 
154
171
  **Building a publishing gem updates**
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nala
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Pike