Module: GimmeGimme::FakeCimHelpers

Defined in:
lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_spec_helpers.rb

Instance Method Summary collapse

Instance Method Details

#fake_cim(&block) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_spec_helpers.rb', line 13

def fake_cim(&block)
  FakeCimServer.new.tap do |server|
    with_gateway(FakeCimGateway.new(:server => server)) do
      yield(server)
    end
  end
end

#with_gateway(new_gateway) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_spec_helpers.rb', line 3

def with_gateway(new_gateway)
  old_gateway = GimmeGimme.gateway
  GimmeGimme.gateway = new_gateway
  begin
    yield
  ensure
    GimmeGimme.gateway = old_gateway
  end
end