Sha256: 1d058701801c055e5c50798054fb2560c854d9f036c8a7e08451212053799258

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe Commands::Groups::Configuration::Get do
  is_required :application_id

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

  context 'when no record exists' do
    let(:params) { {
      application_id: 123
    } }

    it 'return new configurations' do
      response.success?.should == true
      response.result[:configurations].length.should == 1
      response.result[:configurations].first[:id].should_not == ''
      response.result[:configurations].first[:application_id].should == 123
      response.result[:configurations].first[:rsvp_url].should == nil
    end
  end

  context 'when a record exists' do
    before do
      @configuration = Models::Groups::Configuration.create({
        application_id: 123,
        data: { 'rsvp_url' => 'http://somewhere.org/rsvp' }
      })
    end

    let(:params) { {
      application_id: @configuration.application_id
    } }

    it 'returns the settings' do
      response.success?.should == true
      configurations = response.result[:configurations]
      configurations.length.should == 1
      configurations.first[:id].should == @configuration.id.to_s
      configurations.first[:rsvp_url].should == 'http://somewhere.org/rsvp'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_group_service-0.0.8 spec/commands/configuration/get_spec.rb