Class: CallCenter::Test::MiniTest::DSL::ItShouldRender

Inherits:
ItShouldFlow show all
Defined in:
lib/call_center/test/minitest/dsl.rb

Defined Under Namespace

Classes: Assertion

Instance Method Summary collapse

Methods inherited from ItShouldFlow

#after_transition_methods, #expects, #from, #if, #if_and_unless_conditions, #initialize, #on, #restubs, #send_event, #stubs, #to, #unless, #verify_send

Constructor Details

This class inherits a constructor from CallCenter::Test::MiniTest::DSL::ItShouldFlow

Instance Method Details

#is(state) ⇒ Object



187
188
189
190
# File 'lib/call_center/test/minitest/dsl.rb', line 187

def is(state)
  @state = state
  self
end

#selects(selector, matcher = nil) ⇒ Object



202
203
204
205
206
# File 'lib/call_center/test/minitest/dsl.rb', line 202

def selects(selector, matcher = nil)
  @assertions ||= []
  @assertions << Assertion.new(selector, matcher)
  self
end

#verifyObject



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/call_center/test/minitest/dsl.rb', line 208

def verify
  state = @state
  expectations = @expectations || []
  assertions = @assertions || []
  helper = self
  @context.it(description) do
    helper.restubs(subject, expectations.map(&:name))
    expectations.each do |expectation|
      expectation.setup(subject)
    end
    state_field = defined?(call_center_state_field) ? call_center_state_field.to_sym : :state
    subject.send(:"#{state_field}=", state)
    body(subject.render)
    assertions.each do |assertion|
      assertion.setup(self)
    end
  end
end