spec/integration/user_group_spec.rb in gooddata-0.6.49 vs spec/integration/user_group_spec.rb in gooddata-0.6.50

- old
+ new

@@ -1,23 +1,23 @@ # encoding: UTF-8 # -# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved. +# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. describe GoodData::UserGroup do before(:all) do @bulk_size = 3 @user_group_name = 'My Test Group' @user_group_description = 'My Test Description' - @client = ConnectionHelper::create_default_connection + @client = ConnectionHelper.create_default_connection @project = @client.create_project(title: 'UserGroup Testing Project', token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT) @domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN) - users = (1..5).to_a.map do |x| + users = (1..5).to_a.map do { user: ProjectHelper.create_random_user(@client), role: 'Admin' } end @@ -27,11 +27,11 @@ @group = @project.add_user_group(:name => @user_group_name, :description => @user_group_description) end after(:all) do - @group && @group.delete + # @group && @group.delete @project && @project.delete @client.disconnect end describe '#[]' do @@ -47,11 +47,11 @@ old_count = @group.members.to_a.length @group.add_member(users) new_count = @group.members.to_a.length - expect(new_count).to eq (old_count + 1) + expect(new_count).to eq(old_count + 1) group_members = @group.members.to_a users.each do |user| res = group_members.find do |group_member| @@ -120,8 +120,28 @@ describe '#description=' do it 'Should assign description of user group' do new_description = 'This is new description' @group.description = new_description expect(@group.description).to eq new_description + end + end + + describe '#save' do + it 'updates existing group' do + new_description = 'This is new description' + @group.description = new_description + @group.save + @group = @project.user_groups(@group.obj_id) + expect(@group.description).to eq new_description + end + end + + describe '.create' do + it 'sets client attribute' do + expect(@group.client).not_to be_nil + end + + it 'sets project attribute' do + expect(@group.project).not_to be_nil end end end