Sha256: 7d6bf5e25853ab1d720a01e99d9d3080fe5c205ea0f067b9ad43be97c28eec43

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require_relative '../../spec_helper'

describe Commands::Application::VerifyApiToken do
  is_required :id, :api_token

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

  before do
    @application = create(:application)
  end

  context 'with valid params' do
    let(:params) { {
      id: @application.id,
      api_token: @application.api_token
    } }

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

  context 'with invalid :id' do
    let(:params) { {
      id: 142857,
      api_token: @application.api_token
    }}

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

  context 'with invalid :api_token' do
    let(:params) { {
      id: @application.id,
      api_token: 'invalid_token'
    }}

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_core_service-0.0.5 spec/services/application/verify_api_token_spec.rb