gooddata 0.6.11 → 0.6.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/.travis.yml +5 -0
  4. data/CHANGELOG.md +34 -1
  5. data/CLI.md +1 -1
  6. data/authors.sh +4 -0
  7. data/lib/gooddata.rb +1 -1
  8. data/lib/gooddata/cli/commands/api_cmd.rb +0 -2
  9. data/lib/gooddata/cli/commands/auth_cmd.rb +0 -3
  10. data/lib/gooddata/cli/commands/console_cmd.rb +1 -2
  11. data/lib/gooddata/cli/commands/domain_cmd.rb +0 -2
  12. data/lib/gooddata/cli/commands/process_cmd.rb +0 -2
  13. data/lib/gooddata/cli/commands/project_cmd.rb +0 -2
  14. data/lib/gooddata/cli/commands/projects_cmd.rb +0 -2
  15. data/lib/gooddata/cli/commands/run_ruby_cmd.rb +2 -3
  16. data/lib/gooddata/cli/commands/scaffold_cmd.rb +0 -3
  17. data/lib/gooddata/cli/commands/user_cmd.rb +0 -2
  18. data/lib/gooddata/cli/shared.rb +1 -2
  19. data/lib/gooddata/commands/datawarehouse.rb +24 -0
  20. data/lib/gooddata/commands/process.rb +0 -1
  21. data/lib/gooddata/commands/project.rb +1 -1
  22. data/lib/gooddata/commands/scaffold.rb +0 -1
  23. data/lib/gooddata/core/connection.rb +376 -0
  24. data/lib/gooddata/core/logging.rb +13 -0
  25. data/lib/gooddata/core/rest.rb +40 -16
  26. data/lib/gooddata/exceptions/user_in_different_domain.rb +11 -0
  27. data/lib/gooddata/extensions/enumerable.rb +8 -0
  28. data/lib/gooddata/goodzilla/goodzilla.rb +24 -0
  29. data/lib/gooddata/helpers/global_helpers.rb +126 -12
  30. data/lib/gooddata/mixins/author.rb +11 -5
  31. data/lib/gooddata/mixins/is_dimension.rb +13 -0
  32. data/lib/gooddata/mixins/md_object_indexer.rb +17 -1
  33. data/lib/gooddata/mixins/md_object_query.rb +10 -2
  34. data/lib/gooddata/mixins/md_relations.rb +2 -2
  35. data/lib/gooddata/mixins/rest_resource.rb +1 -0
  36. data/lib/gooddata/models/data_result.rb +0 -1
  37. data/lib/gooddata/models/datawarehouse.rb +90 -0
  38. data/lib/gooddata/models/domain.rb +202 -76
  39. data/lib/gooddata/models/execution.rb +11 -0
  40. data/lib/gooddata/models/from_wire.rb +4 -4
  41. data/lib/gooddata/models/invitation.rb +0 -5
  42. data/lib/gooddata/models/membership.rb +121 -91
  43. data/lib/gooddata/models/metadata.rb +1 -2
  44. data/lib/gooddata/models/metadata/attribute.rb +7 -0
  45. data/lib/gooddata/models/metadata/dashboard.rb +1 -1
  46. data/lib/gooddata/models/metadata/dimension.rb +52 -0
  47. data/lib/gooddata/models/metadata/fact.rb +1 -1
  48. data/lib/gooddata/models/metadata/label.rb +21 -7
  49. data/lib/gooddata/models/metadata/metric.rb +1 -23
  50. data/lib/gooddata/models/metadata/report.rb +2 -2
  51. data/lib/gooddata/models/metadata/report_definition.rb +22 -2
  52. data/lib/gooddata/models/metadata/variable.rb +81 -0
  53. data/lib/gooddata/models/model.rb +2 -1
  54. data/lib/gooddata/models/process.rb +3 -4
  55. data/lib/gooddata/models/profile.rb +50 -82
  56. data/lib/gooddata/models/project.rb +170 -213
  57. data/lib/gooddata/models/project_blueprint.rb +14 -5
  58. data/lib/gooddata/models/project_creator.rb +2 -2
  59. data/lib/gooddata/models/schedule.rb +10 -8
  60. data/lib/gooddata/models/to_wire.rb +2 -2
  61. data/lib/gooddata/models/user_filters/mandatory_user_filter.rb +67 -0
  62. data/lib/gooddata/models/user_filters/user_filter.rb +96 -0
  63. data/lib/gooddata/models/user_filters/user_filter_builder.rb +409 -0
  64. data/lib/gooddata/{rest/connections/connections.rb → models/user_filters/user_filters.rb} +1 -0
  65. data/lib/gooddata/models/user_filters/variable_user_filter.rb +14 -0
  66. data/lib/gooddata/rest/client.rb +32 -21
  67. data/lib/gooddata/rest/connection.rb +283 -11
  68. data/lib/gooddata/rest/connections/rest_client_connection.rb +47 -109
  69. data/lib/gooddata/version.rb +1 -1
  70. data/spec/data/column_based_permissions.csv +7 -0
  71. data/spec/data/column_based_permissions2.csv +6 -0
  72. data/spec/data/hello_world_process/hello_world.rb +3 -1
  73. data/spec/data/line_based_permissions.csv +3 -0
  74. data/spec/data/m_n_model/blueprint.json +76 -0
  75. data/spec/data/{model_view.json → wire_models/model_view.json} +0 -0
  76. data/spec/data/wire_models/nu_model.json +3046 -0
  77. data/spec/helpers/process_helper.rb +2 -2
  78. data/spec/helpers/project_helper.rb +29 -0
  79. data/spec/helpers/schedule_helper.rb +1 -1
  80. data/spec/integration/command_datawarehouse_spec.rb +32 -0
  81. data/spec/integration/create_project_spec.rb +0 -1
  82. data/spec/integration/full_process_schedule_spec.rb +13 -5
  83. data/spec/integration/full_project_spec.rb +2 -1
  84. data/spec/integration/over_to_user_filters_spec.rb +92 -0
  85. data/spec/integration/project_spec.rb +233 -0
  86. data/spec/integration/rest_spec.rb +209 -0
  87. data/spec/integration/user_filters_spec.rb +193 -0
  88. data/spec/integration/variables_spec.rb +196 -0
  89. data/spec/unit/commands/command_auth_spec.rb +0 -7
  90. data/spec/unit/commands/command_process_spec.rb +10 -13
  91. data/spec/unit/core/connection_spec.rb +0 -19
  92. data/spec/unit/helpers/global_helpers_spec.rb +57 -0
  93. data/spec/unit/models/domain_spec.rb +80 -40
  94. data/spec/unit/models/from_wire_spec.rb +8 -1
  95. data/spec/unit/models/params_spec.rb +6 -6
  96. data/spec/unit/models/profile_spec.rb +23 -22
  97. data/spec/unit/models/project_blueprint_spec.rb +1 -6
  98. data/spec/unit/models/project_spec.rb +331 -286
  99. data/spec/unit/models/schedule_spec.rb +39 -14
  100. data/spec/unit/models/user_filters_spec.rb +89 -0
  101. data/spec/unit/models/variable_spec.rb +259 -0
  102. metadata +31 -7
  103. data/lib/gooddata/rest/connections/dummy_connection.rb +0 -52
  104. data/spec/unit/core/rest_spec.rb +0 -106
@@ -55,7 +55,6 @@ describe GoodData::Command::Auth do
55
55
 
56
56
  describe "#ask_for_credentials" do
57
57
  it 'Interactively asks user for crendentials' do
58
- pending("Mock STDIO")
59
58
  @input.string = ''
60
59
  @input << DEFAULT_CREDENTIALS[:email] << "\n"
61
60
  @input << DEFAULT_CREDENTIALS[:password] << "\n"
@@ -102,8 +101,6 @@ describe GoodData::Command::Auth do
102
101
 
103
102
  describe "#store" do
104
103
  it 'Stores credentials' do
105
- pending("Mock STDIO")
106
-
107
104
  @input.string = ''
108
105
  @input << DEFAULT_CREDENTIALS[:email] << "\n"
109
106
  @input << DEFAULT_CREDENTIALS[:password] << "\n"
@@ -117,8 +114,6 @@ describe GoodData::Command::Auth do
117
114
  end
118
115
 
119
116
  it 'Overwrites credentials if confirmed' do
120
- pending("Mock STDIO")
121
-
122
117
  @input.string = ''
123
118
  @input << DEFAULT_CREDENTIALS[:email] << "\n"
124
119
  @input << DEFAULT_CREDENTIALS[:password] << "\n"
@@ -133,8 +128,6 @@ describe GoodData::Command::Auth do
133
128
  end
134
129
 
135
130
  it 'Do not overwrites credentials if not confirmed' do
136
- pending("Mock STDIO")
137
-
138
131
  @input.string = ''
139
132
  @input << DEFAULT_CREDENTIALS_OVER[:email] << "\n"
140
133
  @input << DEFAULT_CREDENTIALS_OVER[:password] << "\n"
@@ -24,13 +24,11 @@ describe GoodData::Command::Process do
24
24
  end
25
25
 
26
26
  it "Should throw exception if no Process ID specified" do
27
- expect { GoodData::Command::Process.get(:project_id => ProjectHelper::PROJECT_ID) }.to raise_error
27
+ expect { GoodData::Command::Process.get(project_id: ProjectHelper::PROJECT_ID, client: @client) }.to raise_error
28
28
  end
29
29
 
30
30
  it "Gets process by process ID" do
31
- pending "SystemStackError: stack level too deep"
32
-
33
- res = GoodData::Command::Process.get(:project_id => ProjectHelper::PROJECT_ID, :process_id => ProcessHelper::PROCESS_ID)
31
+ res = GoodData::Command::Process.get(project_id: ProjectHelper::PROJECT_ID, process_id: ProcessHelper::PROCESS_ID, client: @client)
34
32
  expect(res).to_not be_nil
35
33
  expect(res).to be_an_instance_of(GoodData::Process)
36
34
  end
@@ -38,12 +36,11 @@ describe GoodData::Command::Process do
38
36
 
39
37
  describe "#deploy" do
40
38
  it "Throws exception if no project specified" do
41
- pending('Flickering test result, investigate why')
42
- expect { GoodData::Command::Process.deploy(deploy_dir) }.to_not raise_error
39
+ GoodData::Command::Process.deploy(deploy_dir, name: ProcessHelper::DEPLOY_NAME, project_id: ProjectHelper::PROJECT_ID, client: @client, project: @project)
43
40
  end
44
41
 
45
42
  it "Deploys graph" do
46
- GoodData::Command::Process.deploy(deploy_dir, :name => ProcessHelper::DEPLOY_NAME, :project_id => ProjectHelper::PROJECT_ID, :client => @client, :project => @project)
43
+ GoodData::Command::Process.deploy(deploy_dir, name: ProcessHelper::DEPLOY_NAME, project_id: ProjectHelper::PROJECT_ID, client: @client, project: @project)
47
44
  end
48
45
  end
49
46
 
@@ -58,7 +55,7 @@ describe GoodData::Command::Process do
58
55
 
59
56
  describe "#list" do
60
57
  it "Returns processes" do
61
- res = GoodData::Command::Process.list(:project_id => ProjectHelper::PROJECT_ID, :client => @client, :project => @project)
58
+ res = GoodData::Command::Process.list(project_id: ProjectHelper::PROJECT_ID, client: @client, project: @project)
62
59
  expect(res).to be_an_instance_of(Array)
63
60
  end
64
61
  end
@@ -76,18 +73,18 @@ describe GoodData::Command::Process do
76
73
  describe "#with_deploy" do
77
74
  it "Should throw exception if no project specified" do
78
75
  expect do
79
- GoodData::Process.with_deploy(deploy_dir) do
76
+ GoodData::Process.with_deploy('./spec/data/hello_world_process', type: :ruby, name: ProcessHelper::DEPLOY_NAME, client: @client) do
80
77
  msg = "Hello World!"
81
78
  end
82
-
83
79
  end.to raise_error
84
80
  end
85
81
 
86
82
  it "Executes block when deploying" do
87
- # pending('Project ID needed')
88
- GoodData::Process.with_deploy(deploy_dir, :name => ProcessHelper::DEPLOY_NAME, :project_id => ProjectHelper::PROJECT_ID, :client => @client, :project => @project) do
89
- msg = "Hello World!"
83
+ msg = nil
84
+ GoodData::Process.with_deploy('./spec/data/hello_world_process', type: :ruby, name: ProcessHelper::DEPLOY_NAME, client: @client, project: @project) do
85
+ msg = 'Hello World!'
90
86
  end
87
+ expect(msg).to eq 'Hello World!'
91
88
  end
92
89
  end
93
90
 
@@ -32,23 +32,4 @@ describe GoodData::Rest::Connection do
32
32
  c.disconnect
33
33
  end
34
34
  end
35
-
36
- describe '#connect_with_sst' do
37
- it 'Connects using SST' do
38
- pending('Get SST')
39
- end
40
- end
41
-
42
- describe '#create_authenticated_connection' do
43
- it "Creates authenticated connection" do
44
- pending('Investigate how the credentials should be passed')
45
- GoodData.connect(ConnectionHelper::DEFAULT_USERNAME, ConnectionHelper::DEFAULT_PASSWORD)
46
- opts = {
47
- :username => ConnectionHelper::DEFAULT_USERNAME,
48
- :password => ConnectionHelper::DEFAULT_PASSWORD
49
- }
50
- GoodData.create_authenticated_connection(opts)
51
- ConnectionHelper.disconnect
52
- end
53
- end
54
35
  end
@@ -0,0 +1,57 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'gooddata/helpers/csv_helper'
4
+
5
+ describe GoodData::Helpers do
6
+ describe '#diff' do
7
+
8
+ before :each do
9
+
10
+ @old_tomas = { id: 1, name: 'Tomas', age: 28 }
11
+ @new_tomas = { id: 1, name: "Lil'Tomas", age: 28 }
12
+ @patrick = { id: 4, name: 'Patrick', age: 24 }
13
+ @old_korczis = { id: 3, name: 'Korczis', age: 23 }
14
+ @new_korczis = { id: 3, name: "Korczis", age: 22 }
15
+ @petr = { id: 2, name: 'Petr', age: 32 }
16
+ @cvengy = { id: 5, name: 'Petr', age: 30 }
17
+
18
+ @old_list = [@cvengy, @old_tomas, @patrick, @old_korczis]
19
+ @new_list = [@cvengy, @new_tomas, @petr, @new_korczis]
20
+ end
21
+
22
+ it 'diffs two lists of hashes' do
23
+ diff = GoodData::Helpers.diff(@old_list, @new_list, key: :id)
24
+
25
+ expect(diff[:same]).to eq [@cvengy]
26
+ expect(diff[:added]).to eq [@petr]
27
+ expect(diff[:removed]).to eq [@patrick]
28
+ expect(diff[:changed]).to eq([
29
+ {
30
+ old_obj: @old_tomas,
31
+ new_obj: @new_tomas,
32
+ diff: { name: "Lil'Tomas"}
33
+ },
34
+ {
35
+ old_obj: @old_korczis,
36
+ new_obj: @new_korczis,
37
+ diff: { age: 22 }
38
+ }
39
+ ])
40
+ end
41
+
42
+ it 'diffs two lists of hashes on subset of fields' do
43
+ diff = GoodData::Helpers.diff(@old_list, @new_list, key: :id, fields: [:id, :age])
44
+
45
+ expect(diff[:same]).to eq [@cvengy, @old_tomas]
46
+ expect(diff[:added]).to eq [@petr]
47
+ expect(diff[:removed]).to eq [@patrick]
48
+ expect(diff[:changed]).to eq([
49
+ {
50
+ old_obj: @old_korczis,
51
+ new_obj: @new_korczis,
52
+ diff: { age: 22 }
53
+ }
54
+ ])
55
+ end
56
+ end
57
+ end
@@ -5,6 +5,7 @@ require 'gooddata/models/domain'
5
5
  describe GoodData::Domain do
6
6
  before(:each) do
7
7
  @client = ConnectionHelper.create_default_connection
8
+ @domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
8
9
  end
9
10
 
10
11
  after(:each) do
@@ -12,23 +13,49 @@ describe GoodData::Domain do
12
13
  end
13
14
 
14
15
  describe '#add_user' do
15
- it 'Should add user' do
16
+ before(:each) do
17
+ @user = nil
18
+ end
19
+
20
+ after(:each) do
21
+ @user.delete if @user
22
+ end
23
+
24
+ it 'Should add user using class method' do
16
25
  args = {
17
26
  :domain => ConnectionHelper::DEFAULT_DOMAIN,
18
- :login => "gemtest#{rand(1e6)}@gooddata.com",
27
+ :login => "gemtest_#{rand(1e6)}@gooddata.com",
19
28
  :password => CryptoHelper.generate_password,
20
- :client => @client
21
29
  }
22
30
 
23
- user = GoodData::Domain.add_user(args)
31
+ @user = GoodData::Domain.add_user(args)
32
+ expect(@user).to be_an_instance_of(GoodData::Profile)
33
+ end
34
+
35
+ it 'Should add user using instance method' do
36
+ domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
37
+
38
+ login = "gemtest#{rand(1e6)}@gooddata.com"
39
+ password = CryptoHelper.generate_password
40
+
41
+ @user = domain.add_user(:login => login, :password => password, :first_name => 'X', :last_name => 'X')
42
+ expect(@user).to be_an_instance_of(GoodData::Profile)
43
+ end
44
+ end
45
+
46
+ describe '#find_user_by_login' do
47
+ it 'Should find user by login' do
48
+ domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
49
+ user = domain.find_user_by_login(ConnectionHelper::DEFAULT_USERNAME)
50
+ # user = @domain.add_user(args, client: @client)
24
51
  expect(user).to be_an_instance_of(GoodData::Profile)
25
- user.delete
52
+ expect(user.login).to eq ConnectionHelper::DEFAULT_USERNAME
26
53
  end
27
54
  end
28
55
 
29
56
  describe '#users' do
30
57
  it 'Should list users' do
31
- users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN, :client => @client)
58
+ users = @domain.users
32
59
  expect(users).to be_instance_of(Array)
33
60
  users.each do |user|
34
61
  expect(user).to be_an_instance_of(GoodData::Profile)
@@ -36,7 +63,7 @@ describe GoodData::Domain do
36
63
  end
37
64
 
38
65
  it 'Accepts pagination options - limit' do
39
- users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN, {:client => @client, :limit =>1})
66
+ users = @domain.users(limit: 10)
40
67
  expect(users).to be_instance_of(Array)
41
68
  users.each do |user|
42
69
  expect(user).to be_an_instance_of(GoodData::Profile)
@@ -44,7 +71,8 @@ describe GoodData::Domain do
44
71
  end
45
72
 
46
73
  it 'Accepts pagination options - offset' do
47
- users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN, {:client => @client, :offset => 1})
74
+ pending('not that useful and takes very long')
75
+ users = @domain.users(offset: 1)
48
76
  expect(users).to be_instance_of(Array)
49
77
  users.each do |user|
50
78
  expect(user).to be_an_instance_of(GoodData::Profile)
@@ -52,44 +80,56 @@ describe GoodData::Domain do
52
80
  end
53
81
  end
54
82
 
55
- describe '#users_create' do
83
+ describe '#create_users' do
56
84
  it 'Creates new users from list' do
57
- list = []
58
- (0...10).each do |i|
59
- num = rand(1e6)
60
- login = "gemtest#{num}@gooddata.com"
61
-
62
- json = {
63
- 'user' => {
64
- 'content' => {
65
- 'email' => login,
66
- 'login' => login,
67
- 'firstname' => 'the',
68
- 'lastname' => num.to_s,
69
-
70
- # Following lines are ugly hack
71
- 'role' => 'admin',
72
- 'password' => CryptoHelper.generate_password,
73
- 'domain' => ConnectionHelper::DEFAULT_DOMAIN,
74
-
75
- # And following lines are even much more ugly hack
76
- # 'sso_provider' => '',
77
- # 'authentication_modes' => ['sso', 'password']
78
- },
79
- 'meta' => {}
80
- }
81
- }
82
- user = GoodData::Membership.new(json)
83
- list << user
84
- end
85
+ list = (0...10).to_a.map { |i| ProjectHelper.create_random_user(@client) }
86
+ res = @domain.create_users(list)
85
87
 
86
- res = GoodData::Domain.users_create(list, ConnectionHelper::DEFAULT_DOMAIN, :client => @client)
88
+ # no errors
89
+ expect(res.select { |x| x[:type] == :user_added_to_domain }.count).to eq res.count
90
+ expect(@domain.members?(list.map(&:login)).all?).to be_truthy
87
91
 
88
- expect(res).to be_an_instance_of(Array)
89
- res.each do |r|
92
+ res.map { |r| r[:user] }.each do |r|
90
93
  expect(r).to be_an_instance_of(GoodData::Profile)
91
94
  r.delete
92
95
  end
93
96
  end
97
+
98
+ it 'Update a user' do
99
+ user = @domain.users.sample
100
+ login = user.login
101
+ name = user.first_name
102
+
103
+ user.first_name = name.reverse
104
+ @domain.create_users([user])
105
+ changed_user = @domain.get_user(login)
106
+ expect(changed_user.first_name).to eq name.reverse
107
+
108
+ user.first_name = name
109
+ @domain.create_users([user])
110
+ reverted_user = @domain.get_user(login)
111
+ expect(reverted_user.first_name).to eq name
112
+ end
113
+
114
+ it 'Fails with an exception if you try to create a user that is in a different domain' do
115
+ user = ProjectHelper.create_random_user(@client)
116
+ user.login = 'svarovsky@gooddata.com'
117
+ expect do
118
+ @domain.create_user(user)
119
+ end.to raise_exception(GoodData::UserInDifferentDomainError)
120
+ end
121
+
122
+ it 'updates properties of a profile' do
123
+ user = @domain.users
124
+ .reject { |u| u.login == ConnectionHelper::DEFAULT_USERNAME }.sample
125
+
126
+ old_email = user.email
127
+ user.email = 'john.doe@gooddata.com'
128
+ @domain.update_user(user)
129
+ expect(@domain.get_user(user.login).email).to eq 'john.doe@gooddata.com'
130
+ user.email = old_email
131
+ @domain.update_user(user)
132
+ expect(@domain.get_user(user.login).email).to eq old_email
133
+ end
94
134
  end
95
135
  end
@@ -7,7 +7,7 @@ include GoodData::Model
7
7
  describe GoodData::Model::FromWire do
8
8
 
9
9
  before(:each) do
10
- @model_view = MultiJson.load(File.read('./spec/data/model_view.json'))
10
+ @model_view = MultiJson.load(File.read('./spec/data/wire_models/model_view.json'))
11
11
  @blueprint = FromWire.from_wire(@model_view)
12
12
  end
13
13
 
@@ -116,4 +116,11 @@ describe GoodData::Model::FromWire do
116
116
  :default_label => true
117
117
  }]
118
118
  end
119
+
120
+ it "should be able to deal with fiscal dimensions with weird names" do
121
+ model_view = MultiJson.load(File.read('./spec/data/wire_models/nu_model.json'))
122
+ blueprint = FromWire.from_wire(model_view)
123
+ blueprint.lint
124
+ end
125
+
119
126
  end
@@ -29,7 +29,7 @@ describe 'GoodData::Schedule::Params' do
29
29
  }
30
30
 
31
31
  res = @process.create_schedule("0 12 * * *", @graph_path, params: params)
32
- expect(res).to be_true
32
+ expect(res).to be_truthy
33
33
  res.delete
34
34
  end
35
35
 
@@ -42,7 +42,7 @@ describe 'GoodData::Schedule::Params' do
42
42
  }
43
43
 
44
44
  res = @process.create_schedule("0 12 * * *", @graph_path, params: params)
45
- expect(res).to be_true
45
+ expect(res).to be_truthy
46
46
  res.delete
47
47
  end
48
48
 
@@ -53,7 +53,7 @@ describe 'GoodData::Schedule::Params' do
53
53
  }
54
54
 
55
55
  res = @process.create_schedule("0 12 * * *", @graph_path, params: params)
56
- expect(res).to be_true
56
+ expect(res).to be_truthy
57
57
  res.delete
58
58
  end
59
59
  end
@@ -65,7 +65,7 @@ describe 'GoodData::Schedule::Params' do
65
65
  }
66
66
 
67
67
  res = @process.create_schedule("0 12 * * *", @graph_path, hiddenParams: params)
68
- expect(res).to be_true
68
+ expect(res).to be_truthy
69
69
  res.delete
70
70
  end
71
71
 
@@ -78,7 +78,7 @@ describe 'GoodData::Schedule::Params' do
78
78
  }
79
79
 
80
80
  res = @process.create_schedule("0 12 * * *", @graph_path, hiddenParams: params)
81
- expect(res).to be_true
81
+ expect(res).to be_truthy
82
82
  res.delete
83
83
  end
84
84
 
@@ -89,7 +89,7 @@ describe 'GoodData::Schedule::Params' do
89
89
  }
90
90
 
91
91
  res = @process.create_schedule("0 12 * * *", @graph_path, hiddenParams: params)
92
- expect(res).to be_true
92
+ expect(res).to be_truthy
93
93
  res.delete
94
94
  end
95
95
  end
@@ -8,7 +8,8 @@ require 'gooddata/models/project'
8
8
  describe GoodData::Profile do
9
9
  before(:all) do
10
10
  @client = ConnectionHelper.create_default_connection
11
- @user = GoodData::Domain.find_user_by_login(ConnectionHelper::DEFAULT_DOMAIN, ConnectionHelper::DEFAULT_USERNAME, :client => @client)
11
+ @domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
12
+ @user = @domain.get_user(ConnectionHelper::DEFAULT_USERNAME)
12
13
 
13
14
  @users = [
14
15
  @client.create(GoodData::Profile,
@@ -83,7 +84,7 @@ describe GoodData::Profile do
83
84
  user1 = deep_dup(@user)
84
85
  user2 = deep_dup(@user)
85
86
  res = user1 == user2
86
- res.should be_true
87
+ res.should be_truthy
87
88
  end
88
89
 
89
90
  it 'Returns false for different objects' do
@@ -94,7 +95,7 @@ describe GoodData::Profile do
94
95
  user2.first_name = 'kokos'
95
96
 
96
97
  res = user1 == user2
97
- res.should be_false
98
+ res.should be_falsey
98
99
  end
99
100
  end
100
101
 
@@ -103,7 +104,7 @@ describe GoodData::Profile do
103
104
  user1 = deep_dup(@user)
104
105
  user2 = deep_dup(@user)
105
106
  res = user1 != user2
106
- res.should be_false
107
+ res.should be_falsey
107
108
  end
108
109
 
109
110
  it 'Returns true for different objects' do
@@ -114,27 +115,27 @@ describe GoodData::Profile do
114
115
  user2.first_name = 'kokos'
115
116
 
116
117
  res = user1 != user2
117
- res.should be_true
118
+ res.should be_truthy
118
119
  end
119
120
  end
120
121
 
121
122
  describe '#apply' do
122
123
  it 'When diff of two objects applied to first result should be same as second object' do
124
+ skip("We need to resolve this in a simpler way. The assignable members seem to be too complicated")
123
125
  user1 = deep_dup(@user)
124
126
  user2 = deep_dup(@user)
125
127
 
126
128
  # Do some little modification
127
129
  user2.first_name = 'kokos'
128
-
129
130
  diff = user1.diff(user2)
130
131
 
131
132
  expect(diff).to be_instance_of(Hash)
132
133
  diff.length.should_not eql(0)
133
134
 
134
- user1.apply(diff)
135
+ updated_user = GoodData::Profile.create(user1.to_hash.merge(diff))
135
136
 
136
137
  res = user1 == user2
137
- res.should be_true
138
+ res.should be_truthy
138
139
  end
139
140
  end
140
141
 
@@ -146,14 +147,14 @@ describe GoodData::Profile do
146
147
  expect(res).to be_instance_of(Hash)
147
148
  res.length.should eql(0)
148
149
  end
149
-
150
+
150
151
  it 'Returns non empty hash for different objects' do
151
152
  user1 = deep_dup(@user)
152
153
  user2 = deep_dup(@user)
153
-
154
+
154
155
  # Do some little modification
155
156
  user2.first_name = 'kokos'
156
-
157
+
157
158
  res = user1.diff(user2)
158
159
  expect(res).to be_instance_of(Hash)
159
160
  res.length.should_not eql(0)
@@ -165,53 +166,53 @@ describe GoodData::Profile do
165
166
  l1 = [
166
167
  @users[0]
167
168
  ]
168
-
169
+
169
170
  l2 = [
170
171
  @users[0]
171
172
  ]
172
-
173
+
173
174
  diff = GoodData::Profile.diff_list(l1, l2)
174
175
  diff[:added].length.should eql(0)
175
176
  diff[:changed].length.should eql(0)
176
177
  diff[:removed].length.should eql(0)
177
178
  end
178
-
179
+
179
180
  it 'Recognizes added element' do
180
181
  l1 = []
181
-
182
+
182
183
  l2 = [
183
184
  @users[0]
184
185
  ]
185
-
186
+
186
187
  diff = GoodData::Profile.diff_list(l1, l2)
187
188
  diff[:added].length.should eql(1)
188
189
  diff[:changed].length.should eql(0)
189
190
  diff[:removed].length.should eql(0)
190
191
  end
191
-
192
+
192
193
  it 'Recognizes changed element' do
193
194
  l1 = [
194
195
  @users[0]
195
196
  ]
196
-
197
+
197
198
  l2 = [
198
199
  GoodData::Profile.new(@users[0].json.deep_dup)
199
200
  ]
200
201
  l2[0].first_name = 'Peter'
201
-
202
+
202
203
  diff = GoodData::Profile.diff_list(l1, l2)
203
204
  diff[:added].length.should eql(0)
204
205
  diff[:changed].length.should eql(1)
205
206
  diff[:removed].length.should eql(0)
206
207
  end
207
-
208
+
208
209
  it 'Recognizes removed element' do
209
210
  l1 = [
210
211
  @users[0]
211
212
  ]
212
-
213
+
213
214
  l2 = []
214
-
215
+
215
216
  diff = GoodData::Profile.diff_list(l1, l2)
216
217
  diff[:added].length.should eql(0)
217
218
  diff[:changed].length.should eql(0)