Module: Wires::Test::RSpec::ExampleGroupMethods

Defined in:
lib/wires/test.rb

Instance Method Summary collapse

Instance Method Details

#it_fires(event, **kwargs, &block) ⇒ Object



182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/wires/test.rb', line 182

def it_fires(event, **kwargs, &block)
  context "fires #{event.inspect}" do
    specify do
      channel_obj = wires_test_channel_from_kwargs **kwargs
      if block.nil?
        should have_fired(event, channel_obj)
      else
        should have_fired(event, channel_obj).fulfilling(&block)
      end
    end
  end
end

#it_fires_no(event, **kwargs, &block) ⇒ Object



195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/wires/test.rb', line 195

def it_fires_no(event, **kwargs, &block)
  context "fires no #{event.inspect}" do
    specify do
      channel_obj = wires_test_channel_from_kwargs **kwargs
      if block.nil?
        should_not have_fired(event, channel_obj)
      else
        should_not have_fired(event, channel_obj).fulfilling(&block)
      end
    end
  end
end

#with_stimulus(event, **kwargs, &block) ⇒ Object



175
176
177
178
179
180
# File 'lib/wires/test.rb', line 175

def with_stimulus(event, **kwargs, &block)
  context "(with stimulus #{event.inspect})" do
    include_context "with wires stimulus", event, **kwargs
    instance_eval &block
  end
end