Sha256: 9e83e75c7fa62f612668dbff7c70d8e3bffd613b55e06413541221c4840b5a3d

Contents?: true

Size: 990 Bytes

Versions: 52

Compression:

Stored size: 990 Bytes

Contents

require 'spec_helper'

describe Maestrano::Account::GroupsController, type: :controller do
  routes { Maestrano::Connector::Rails::Engine.routes }

  describe "destroy" do
  	let!(:organization) { create(:organization, uid: 'cld-abc', tenant: 'abc') }
  	let(:params) { {tenant: organization.tenant, id: organization.uid} }
  	subject { delete :destroy, params }

    before {
        controller.class.skip_before_filter :authenticate_maestrano!
    }

  	it 'is successful' do
      subject
  		expect(response).to be_success
  	end

    it 'destroys the organization' do
      expect{ subject }.to change{ Maestrano::Connector::Rails::Organization.count }.by(-1)
    end

    context 'with default tenant' do
      before {
        organization.update(tenant: 'default')
      }
      let(:params) { {id: organization.uid} }

      it 'destroys the organization' do
        expect{ subject }.to change{ Maestrano::Connector::Rails::Organization.count }.by(-1)
      end
    end
  end

end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
maestrano-connector-rails-2.0.2.pre.RC6 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC5 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC4 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC3 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC2 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC1 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.1 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC13 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC12 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC11 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC10 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC9 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC8 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-1.5.0 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC7 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC6 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC5 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC4 spec/controllers/groups_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC3 spec/controllers/groups_controller_spec.rb