Sha256: aec60f74806b2d9a6c1b502121cfd13b747cfb7bf5c33a83cf80e7c958d682d8

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')

module ESP
  class ServiceTest < ActiveSupport::TestCase
    context ESP::Service do
      context '#signatures' do
        context '.where' do
          should 'not be implemented' do
            assert_raises ESP::NotImplementedError do
              Tag.where(id_eq: 2)
            end
          end
        end

        should 'call the api' do
          s = build(:service)
          stub_request(:get, /signatures.json*/).to_return(body: json_list(:signature, 2))

          s.signatures

          assert_requested(:get, /signatures.json*/) do |req|
            assert_equal "filter[service_id_eq]=#{s.id}", URI.unescape(req.uri.query)
          end
        end
      end

      context '.where' do
        should 'not be implemented' do
          assert_raises ESP::NotImplementedError do
            ESP::Service.where(id_eq: 1)
          end
        end
      end

      context '#create' do
        should 'not be implemented' do
          assert_raises ESP::NotImplementedError do
            ESP::Service.create(name: 'test')
          end
        end
      end

      context '#destroy' do
        should 'not be implemented' do
          s = build(:service)
          assert_raises ESP::NotImplementedError do
            s.destroy
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
esp_sdk-2.7.0 test/esp/resources/service_test.rb
esp_sdk-2.6.0 test/esp/resources/service_test.rb
esp_sdk-2.5.0 test/esp/resources/service_test.rb