Sha256: b6428196f8d78cf07c3fd77f1a571053de26833501f13f9e4ac8caec6dce41d5

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

require_relative '../../spec_helper'

describe Commands::Group::Get do
  is_required :id, :application_id

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

  before do
    @group = create(:group)
  end

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

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

    it 'return the group' do
      response.result[:groups].length.should == 1
      response.result[:groups].first[:id].should == @group.id.to_s
    end
  end

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

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
restpack_group_service-0.0.7 spec/commands/group/get_spec.rb
restpack_group_service-0.0.6 spec/commands/group/get_spec.rb
restpack_group_service-0.0.5 spec/commands/group/get_spec.rb