Sha256: d89e00b7a08dd1c865c080d894e0ecd4a680d7e96fdddf0c7f46d4fca3a3a9a2
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true require 'test_helper' require 'stubs/service_under_test_stubs' module Webhookr module Services class ServiceUnderTest::AdapterTest < ActiveSupport::TestCase def setup @event_type = 'test_event' @data_msg = 'Hello world!' @valid_response = "event=#{@event_type}&data[msg]=#{@data_msg}" @invalid_response = 'blort' end test 'should not raise an exception for a valid payload' do assert_nothing_raised do Webhookr::ServiceUnderTest::Adapter.process(@valid_response) end end test 'should raise an exception for a invalid payload' do assert_raise(Webhookr::InvalidPayloadError) do Webhookr::ServiceUnderTest::Adapter.process(@invalid_response) end end test 'should repond with the correct event' do responses = Webhookr::ServiceUnderTest::Adapter.process(@valid_response) assert_equal(@event_type, responses.first.event_type) end test 'should respond with valid data' do responses = Webhookr::ServiceUnderTest::Adapter.process(@valid_response) assert_equal(@data_msg, responses.first.data.msg) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webhookr-0.3.0 | test/unit/webhookr/services/service_under_test/adapter_test.rb |