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-2.0.2.pre.RC6 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC5 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC4 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC3 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC2 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.2.pre.RC1 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.1 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC13 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC12 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC11 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC10 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC9 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC8 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-1.5.0 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC7 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC6 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC5 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC4 spec/controllers/group_users_controller_spec.rb
maestrano-connector-rails-2.0.0.pre.RC3 spec/controllers/group_users_controller_spec.rb