Sha256: b8b6b182350db67514889dd45b84c795d1dd91ba18f4c21b2a625138cf982833

Contents?: true

Size: 1.93 KB

Versions: 3

Compression:

Stored size: 1.93 KB

Contents

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

module ESP::Integration
  class CustomSignatureTest < ESP::Integration::TestCase
    context ESP::CustomSignature do
      context 'live calls' do
        setup do
          @custom_signature = ESP::CustomSignature.last
          fail "Live DB does not have any custom_signatures.  Add a custom_signature and run tests again." if @custom_signature.blank?
        end

        context '#organization' do
          should 'return an organization' do
            organization = @custom_signature.organization

            assert_equal @custom_signature.organization_id, organization.id
            assert_equal ESP::Organization, organization.class
          end
        end

        context '#teams' do
          should 'return list of teams' do
            team = @custom_signature.teams

            assert_equal ESP::Team, team.resource_class
          end
        end

        context '.where' do
          should 'return custom_signature objects' do
            custom_signatures = ESP::CustomSignature.where(id_eq: @custom_signature.id)

            assert_equal ESP::CustomSignature, custom_signatures.resource_class
          end
        end

        context '#CRUD' do
          should 'be able to create, update and destroy' do
            custom_signature = ESP::CustomSignature.new(@custom_signature.attributes)

            assert_predicate custom_signature, :new?

            custom_signature.save

            refute_predicate custom_signature, :new?

            custom_signature.identifier = 'new identifier'
            custom_signature.save

            assert_nothing_raised do
              ESP::CustomSignature.find(custom_signature.id)
            end

            custom_signature.destroy

            assert_raises ActiveResource::ResourceNotFound do
              ESP::CustomSignature.find(custom_signature.id)
            end
          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/integration/custom_signature_integration_test.rb
esp_sdk-2.6.0 test/esp/integration/custom_signature_integration_test.rb
esp_sdk-2.5.0 test/esp/integration/custom_signature_integration_test.rb