wires-test 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/wires/test.rb +25 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3467c6ce43030f93a423b5e8a204092aff7a444
4
- data.tar.gz: f018a88b955fdc470142c3b16a4970c07e0d5bc5
3
+ metadata.gz: f2b683dcceb6074d7fe4601260a3ff09a38b8fdb
4
+ data.tar.gz: 2fb8f68ebd2efe4769793bdcfbca60e39b0e906c
5
5
  SHA512:
6
- metadata.gz: 49278da8615bc376ca929419e38e7f448d9ce5fb55fcd8d2e248e1d013b375607a2cc95fe68d7ece0a86b25231d5ab8dd30f768c2aadf1edd7c6f22f2c8c5ecf
7
- data.tar.gz: 284ad78e57dde16b2644703c244cdfd0d41d3eed396de03ad791b9434c4d4b48eb0616127fc5bc16879d8883f6b108ec33e87a5eb0a9ac3ce2f64bc035c5fdff
6
+ metadata.gz: 8487929d329581fabd585df04d89643d4c888a861528dde30b7668f85d8089dbff700be13405f3278b1fd837763cc7a2f3fc71b5a872f5ed2025b2416c6bc206
7
+ data.tar.gz: 7ef64f0e9f3f9ea5b479d86d83c44ae62f490980fd463d08278e92da57a821ce6da0a388fb24b3770df2a0e50a25695eb67c55c031942f25c25aa09e3675b581
data/lib/wires/test.rb CHANGED
@@ -103,6 +103,8 @@ shared_context "with AFFIX wires", :AFFIX_wires=>true do
103
103
  AFFIX_wires_test_teardown
104
104
  end
105
105
  end
106
+
107
+ extend Wires::Test::RSpec::ExampleGroupMethods
106
108
  end
107
109
 
108
110
  shared_context "with AFFIX wires stimulus" do |event, **kwargs|
@@ -115,10 +117,27 @@ shared_context "with AFFIX wires stimulus" do |event, **kwargs|
115
117
  end
116
118
 
117
119
 
118
- ::RSpec::Matchers.define :have_AFFIX_fired do |event, channel=nil|
120
+ ::RSpec::Matchers.define :have_AFFIX_fired do |event, channel=:__no_channel_was_specified__, fulfilling:nil|
119
121
  match do |_|
120
- channel ||= subject
121
- AFFIX_fired? event, channel
122
+ AFFIX_fired? event, channel, &fulfilling
123
+ end
124
+
125
+ description do
126
+ str = "have fired #{event.inspect}"
127
+ str += " on #{channel.inspect}" unless channel==:__no_channel_was_specified__
128
+ str
129
+ end
130
+
131
+ failure_message_for_should do |*args, &blk|
132
+ "received: \n #{actual_events.map(&:inspect).join("\n ")}"
133
+ end
134
+
135
+ failure_message_for_should_not do |*args, &blk|
136
+ "received: \n #{actual_events.map(&:inspect).join("\n ")}"
137
+ end
138
+
139
+ def actual_events
140
+ matcher_execution_context.instance_variable_get :@AFFIX_wires_events
122
141
  end
123
142
  end
124
143
 
@@ -129,7 +148,7 @@ module Wires
129
148
  module ExampleGroupMethods
130
149
 
131
150
  def with_AFFIX_stimulus(event, **kwargs, &block)
132
- context "(with stimulus #{event.inspect})" do
151
+ context "(with AFFIX stimulus #{event.inspect})" do
133
152
  include_context "with AFFIX wires stimulus", event, **kwargs
134
153
  instance_eval &block
135
154
  end
@@ -139,7 +158,7 @@ module Wires
139
158
  context "fires #{event.inspect}" do
140
159
  specify do
141
160
  channel_obj = AFFIX_wires_test_channel_from_kwargs **kwargs
142
- expect(AFFIX_fired?(event, channel_obj, &block)).to be
161
+ should have_AFFIX_fired event, channel_obj, fulfilling:block
143
162
  end
144
163
  end
145
164
  end
@@ -148,7 +167,7 @@ module Wires
148
167
  context "fires no #{event.inspect}" do
149
168
  specify do
150
169
  channel_obj = AFFIX_wires_test_channel_from_kwargs **kwargs
151
- expect(AFFIX_fired?(event, channel_obj, &block)).to_not be
170
+ should_not have_AFFIX_fired event, channel_obj, fulfilling:block
152
171
  end
153
172
  end
154
173
  end
@@ -163,8 +182,6 @@ end
163
182
  .tap { |code| eval code } # Eval the cleaned code in
164
183
 
165
184
 
166
- RSpec.configuration.extend Wires::Test::RSpec::ExampleGroupMethods
167
-
168
185
 
169
186
  module Wires
170
187
  module Test
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wires-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe McIlvain