Sha256: cd06ad8a918829e629d388d5eac2ece87d867e3c4a8ed14b055f3fee5fa4e88f

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require_relative '../../spec_helper'

describe Core::Commands::Domain::ByIdentifier do
  is_required :identifier
  is_optional :includes

  let(:response) { subject.class.run(params) }

  before do
    @domain = create(:domain)
  end

  context 'with valid params' do
    let(:params) { {
      identifier: @domain.identifier,
      includes: 'applications'
    } }

    it 'is valid' do
      response.success?.should == true
    end

    it 'includes identifier' do
      response.result[:domains].length.should == 1
      response.result[:domains].first[:identifier].should == @domain.identifier
    end

    it 'includes related application' do
      response.result[:applications].length.should == 1
      response.result[:applications].first[:id].should == @domain.application_id.to_s
    end
  end

  context 'with invalid :identifier' do
    let(:params) { {
      identifier: 'invalid'
    }}

    it 'is :not_found' do
      response.success?.should == false
      response.result.should == {}
      response.status.should == :not_found
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_core_service-0.0.10 spec/services/domain/by_identifier_spec.rb