Sha256: f959710626a907c2ae04789db46a1c406378dc3e9ff5eb7171f839836cb01612

Contents?: true

Size: 1.17 KB

Versions: 52

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

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

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

    before {
        controller.class.skip_before_filter :authenticate_maestrano!
        organization.add_member(user)
    }

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

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

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

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

end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
maestrano-connector-rails-1.0.0 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.4.4 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.4.3 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.4.2 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.4.1 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.4.0 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.3.13 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.3.12 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.3.11 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.3.10 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.3.9 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-0.3.8 spec/controllers/group_users_controller_spec.rb