Sha256: ba6143c9233d6a9c794fb592b3d1067925fd49a0a1663ebdeddc1ec06662259f

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

class TestTracksaleDummyClient < Minitest::Test
  def setup
    Tracksale.configure(&:force_dummy_client)
  end

  def test_campaign_all_dummy
    assert Tracksale::Campaign.all.is_a? Array
    assert_equal [], Tracksale::Campaign.all
  end

  def test_campaign_find_by_name_dummy
    assert_nil Tracksale::Campaign.find_by_name('foobar')
  end

  def test_campaign_dispatch_dummy
    assert_equal({}, Tracksale::Campaign.schedule_dispatch('code', 'body'))
  end

  def test_allow_explict_response
    response = Object.new
    response.send :define_singleton_method, :success?, (proc { true })
    Tracksale::DummyClient.response = response

    assert_equal response, Tracksale::Campaign.schedule_dispatch('code', 'body')

    Tracksale::DummyClient.response = nil # revert to default
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tracksale-0.0.7 test/test_tracksale_dummyclient.rb
tracksale-0.0.5 test/test_tracksale_dummyclient.rb