gooddata 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +4 -0
- data/README.md +1 -0
- data/lib/gooddata/cli/commands/project_cmd.rb +2 -7
- data/lib/gooddata/client.rb +0 -2
- data/lib/gooddata/commands/project.rb +10 -0
- data/lib/gooddata/core/rest.rb +12 -2
- data/lib/gooddata/exceptions/attr_element_not_found.rb +12 -0
- data/lib/gooddata/extensions/enumerable.rb +12 -0
- data/lib/gooddata/helpers/global_helpers.rb +20 -0
- data/lib/gooddata/mixins/author.rb +16 -0
- data/lib/gooddata/mixins/content_getter.rb +11 -0
- data/lib/gooddata/mixins/content_property_reader.rb +13 -0
- data/lib/gooddata/mixins/content_property_writer.rb +13 -0
- data/lib/gooddata/mixins/contributor.rb +16 -0
- data/lib/gooddata/mixins/data_getter.rb +11 -0
- data/lib/gooddata/mixins/data_property_reader.rb +13 -0
- data/lib/gooddata/mixins/data_property_writer.rb +13 -0
- data/lib/gooddata/mixins/is_attribute.rb +13 -0
- data/lib/gooddata/mixins/is_fact.rb +13 -0
- data/lib/gooddata/mixins/is_label.rb +15 -0
- data/lib/gooddata/mixins/links.rb +11 -0
- data/lib/gooddata/mixins/md_finders.rb +36 -0
- data/lib/gooddata/mixins/md_id_to_uri.rb +29 -0
- data/lib/gooddata/mixins/md_json.rb +11 -0
- data/lib/gooddata/mixins/md_object_id.rb +11 -0
- data/lib/gooddata/mixins/md_object_indexer.rb +36 -0
- data/lib/gooddata/mixins/md_object_query.rb +83 -0
- data/lib/gooddata/mixins/md_relations.rb +39 -0
- data/lib/gooddata/mixins/meta_getter.rb +11 -0
- data/lib/gooddata/mixins/meta_property_reader.rb +13 -0
- data/lib/gooddata/mixins/meta_property_writer.rb +13 -0
- data/lib/gooddata/mixins/mixins.rb +15 -0
- data/lib/gooddata/mixins/not_attribute.rb +13 -0
- data/lib/gooddata/mixins/not_exportable.rb +11 -0
- data/lib/gooddata/mixins/not_fact.rb +13 -0
- data/lib/gooddata/mixins/not_label.rb +15 -0
- data/lib/gooddata/mixins/not_metric.rb +13 -0
- data/lib/gooddata/mixins/obj_id.rb +11 -0
- data/lib/gooddata/mixins/rest_getters.rb +13 -0
- data/lib/gooddata/mixins/rest_resource.rb +19 -0
- data/lib/gooddata/mixins/root_key_getter.rb +11 -0
- data/lib/gooddata/mixins/root_key_setter.rb +11 -0
- data/lib/gooddata/mixins/timestamps.rb +15 -0
- data/lib/gooddata/models/from_wire.rb +153 -0
- data/lib/gooddata/models/metadata.rb +28 -230
- data/lib/gooddata/models/metadata/attribute.rb +4 -6
- data/lib/gooddata/models/metadata/fact.rb +4 -6
- data/lib/gooddata/models/metadata/{display_form.rb → label.rb} +17 -11
- data/lib/gooddata/models/metadata/metric.rb +1 -1
- data/lib/gooddata/models/metadata/report_definition.rb +2 -2
- data/lib/gooddata/models/model.rb +55 -23
- data/lib/gooddata/models/models.rb +0 -2
- data/lib/gooddata/models/module_constants.rb +0 -2
- data/lib/gooddata/models/process.rb +1 -1
- data/lib/gooddata/models/project.rb +117 -76
- data/lib/gooddata/models/project_blueprint.rb +322 -42
- data/lib/gooddata/models/project_creator.rb +5 -4
- data/lib/gooddata/models/project_role.rb +20 -55
- data/lib/gooddata/models/schema_blueprint.rb +287 -84
- data/lib/gooddata/models/schema_builder.rb +0 -4
- data/lib/gooddata/models/to_manifest.rb +160 -0
- data/lib/gooddata/models/to_wire.rb +150 -0
- data/lib/gooddata/version.rb +1 -1
- data/spec/data/blueprint_invalid.json +3 -1
- data/spec/data/gd_gse_data_blueprint.json +1370 -0
- data/spec/data/gd_gse_data_manifest.json +1424 -0
- data/spec/data/gd_gse_data_model.json +1772 -0
- data/spec/data/manifest_test_project.json +116 -0
- data/spec/data/model_view.json +1772 -0
- data/spec/data/superfluous_titles_view.json +81 -0
- data/spec/data/test_project_model_spec.json +7 -4
- data/spec/data/wire_test_project.json +143 -0
- data/spec/helpers/crypto_helper.rb +9 -0
- data/spec/helpers/project_helper.rb +2 -0
- data/spec/integration/command_projects_spec.rb +4 -2
- data/spec/integration/full_project_spec.rb +51 -18
- data/spec/integration/partial_md_export_import_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/unit/models/attribute_column_spec.rb +7 -7
- data/spec/unit/models/domain_spec.rb +2 -2
- data/spec/unit/models/from_wire_spec.rb +119 -0
- data/spec/unit/models/metadata_spec.rb +4 -2
- data/spec/unit/models/project_blueprint_spec.rb +32 -16
- data/spec/unit/models/project_role_spec.rb +6 -4
- data/spec/unit/models/project_spec.rb +26 -3
- data/spec/unit/models/schema_builder_spec.rb +5 -6
- data/spec/unit/models/to_manifest_spec.rb +24 -0
- data/spec/unit/models/to_wire_spec.rb +63 -0
- metadata +53 -29
- data/lib/gooddata/models/attributes/anchor.rb +0 -37
- data/lib/gooddata/models/attributes/attributes.rb +0 -8
- data/lib/gooddata/models/attributes/date_attribute.rb +0 -25
- data/lib/gooddata/models/attributes/time_attribute.rb +0 -24
- data/lib/gooddata/models/columns/attribute.rb +0 -71
- data/lib/gooddata/models/columns/columns.rb +0 -8
- data/lib/gooddata/models/columns/date_column.rb +0 -63
- data/lib/gooddata/models/columns/fact_model.rb +0 -54
- data/lib/gooddata/models/columns/label.rb +0 -55
- data/lib/gooddata/models/columns/reference.rb +0 -57
- data/lib/gooddata/models/facts/facts.rb +0 -8
- data/lib/gooddata/models/facts/time_fact.rb +0 -20
- data/lib/gooddata/models/folders/attribute_folder.rb +0 -20
- data/lib/gooddata/models/folders/fact_folder.rb +0 -20
- data/lib/gooddata/models/folders/folders.rb +0 -8
- data/lib/gooddata/models/metadata/column.rb +0 -61
- data/lib/gooddata/models/metadata/data_set.rb +0 -32
- data/lib/gooddata/models/metadata/date_dimension.rb +0 -26
- data/lib/gooddata/models/metadata/schema.rb +0 -227
- data/lib/gooddata/models/references/date_reference.rb +0 -44
- data/lib/gooddata/models/references/references.rb +0 -8
- data/lib/gooddata/models/references/time_reference.rb +0 -13
- data/spec/helpers/schema_helper.rb +0 -16
- data/spec/unit/models/anchor_spec.rb +0 -32
- data/spec/unit/models/tools_spec.rb +0 -95
- data/test/test_upload.rb +0 -79
@@ -0,0 +1,81 @@
|
|
1
|
+
{
|
2
|
+
"projectModelView": {
|
3
|
+
"model": {
|
4
|
+
"projectModel": {
|
5
|
+
"datasets": [
|
6
|
+
{
|
7
|
+
"dataset": {
|
8
|
+
"identifier": "dataset.stage_history",
|
9
|
+
"title": "stage_history",
|
10
|
+
"anchor": {
|
11
|
+
"attribute": {
|
12
|
+
"identifier": "attr.stage_history.factsof",
|
13
|
+
"title": "Records of stage_history"
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"attributes": [
|
17
|
+
{
|
18
|
+
"attribute": {
|
19
|
+
"identifier": "attr.stage_history.current_status",
|
20
|
+
"title": "Current Status",
|
21
|
+
"labels": [
|
22
|
+
{
|
23
|
+
"label": {
|
24
|
+
"identifier": "label.stage_history.current_status",
|
25
|
+
"title": "Current Status",
|
26
|
+
"type": "GDC.text",
|
27
|
+
"dataType": "VARCHAR(128)"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
],
|
31
|
+
"defaultLabel": "label.stage_history.current_status"
|
32
|
+
}
|
33
|
+
}
|
34
|
+
],
|
35
|
+
"facts": [
|
36
|
+
{
|
37
|
+
"fact": {
|
38
|
+
"identifier": "fact.stage_history.stage_velocity",
|
39
|
+
"title": "Stage Velocity",
|
40
|
+
"dataType": "DECIMAL(12,2)"
|
41
|
+
}
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"fact": {
|
45
|
+
"identifier": "fact.stage_history.stage_duration",
|
46
|
+
"title": "Stage Duration",
|
47
|
+
"dataType": "DECIMAL(12,2)"
|
48
|
+
}
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"fact": {
|
52
|
+
"identifier": "dt.stage_history.opp_created_date",
|
53
|
+
"title": "Opp. Created (Date) for Stage History",
|
54
|
+
"dataType": "INT"
|
55
|
+
}
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"fact": {
|
59
|
+
"identifier": "dt.stage_history.opp_close_date",
|
60
|
+
"title": "Opp. Close (Date) for Stage History",
|
61
|
+
"dataType": "INT"
|
62
|
+
}
|
63
|
+
}
|
64
|
+
],
|
65
|
+
"references": [
|
66
|
+
"dataset.account",
|
67
|
+
"dataset.product",
|
68
|
+
"dataset.stage",
|
69
|
+
"dataset.opp_owner",
|
70
|
+
"dataset.opportunity",
|
71
|
+
"dataset.bookingtype",
|
72
|
+
"oppclose",
|
73
|
+
"oppcreated"
|
74
|
+
]
|
75
|
+
}
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
"title": "RubyGem Dev Week test",
|
3
3
|
"datasets": [
|
4
4
|
{
|
5
|
+
"type": "dataset",
|
5
6
|
"name": "repos",
|
6
7
|
"columns": [
|
7
8
|
{
|
@@ -20,6 +21,7 @@
|
|
20
21
|
]
|
21
22
|
},
|
22
23
|
{
|
24
|
+
"type": "dataset",
|
23
25
|
"name": "devs",
|
24
26
|
"columns": [
|
25
27
|
{
|
@@ -29,11 +31,13 @@
|
|
29
31
|
{
|
30
32
|
"type": "label",
|
31
33
|
"name": "email",
|
32
|
-
"reference": "dev_id"
|
34
|
+
"reference": "dev_id",
|
35
|
+
"default_label" : true
|
33
36
|
}
|
34
37
|
]
|
35
38
|
},
|
36
39
|
{
|
40
|
+
"type": "dataset",
|
37
41
|
"name": "commits",
|
38
42
|
"columns": [
|
39
43
|
{
|
@@ -62,9 +66,8 @@
|
|
62
66
|
],
|
63
67
|
"date_dimensions": [
|
64
68
|
{
|
65
|
-
"
|
66
|
-
"name": "committed_on"
|
67
|
-
"title": null
|
69
|
+
"type": "date_dimension",
|
70
|
+
"name": "committed_on"
|
68
71
|
}
|
69
72
|
]
|
70
73
|
}
|
@@ -0,0 +1,143 @@
|
|
1
|
+
{
|
2
|
+
"diffRequest": {
|
3
|
+
"targetModel": {
|
4
|
+
"projectModel": {
|
5
|
+
"datasets": [
|
6
|
+
{
|
7
|
+
"dataset": {
|
8
|
+
"identifier": "dataset.repos",
|
9
|
+
"title": "Repos",
|
10
|
+
"anchor": {
|
11
|
+
"attribute": {
|
12
|
+
"identifier": "attr.repos.repo_id",
|
13
|
+
"title": "Repo",
|
14
|
+
"labels": [
|
15
|
+
{
|
16
|
+
"label": {
|
17
|
+
"identifier": "label.repos.repo_id",
|
18
|
+
"title": "Repo",
|
19
|
+
"type": null,
|
20
|
+
"dataType": null
|
21
|
+
}
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"label": {
|
25
|
+
"identifier": "label.repos.repo_id.name",
|
26
|
+
"title": "Name",
|
27
|
+
"type": null,
|
28
|
+
"dataType": null
|
29
|
+
}
|
30
|
+
}
|
31
|
+
],
|
32
|
+
"defaultLabel": "label.repos.repo_id"
|
33
|
+
}
|
34
|
+
},
|
35
|
+
"attributes": [
|
36
|
+
{
|
37
|
+
"attribute": {
|
38
|
+
"identifier": "attr.repos.department",
|
39
|
+
"title": "Department",
|
40
|
+
"labels": [
|
41
|
+
{
|
42
|
+
"label": {
|
43
|
+
"identifier": "label.repos.department",
|
44
|
+
"title": "Department",
|
45
|
+
"type": null,
|
46
|
+
"dataType": null
|
47
|
+
}
|
48
|
+
}
|
49
|
+
],
|
50
|
+
"defaultLabel": "label.repos.department"
|
51
|
+
}
|
52
|
+
}
|
53
|
+
],
|
54
|
+
"facts": [
|
55
|
+
|
56
|
+
],
|
57
|
+
"references": [
|
58
|
+
|
59
|
+
]
|
60
|
+
}
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"dataset": {
|
64
|
+
"identifier": "dataset.devs",
|
65
|
+
"title": "Devs",
|
66
|
+
"anchor": {
|
67
|
+
"attribute": {
|
68
|
+
"identifier": "attr.devs.dev_id",
|
69
|
+
"title": "Dev",
|
70
|
+
"labels": [
|
71
|
+
{
|
72
|
+
"label": {
|
73
|
+
"identifier": "label.devs.dev_id",
|
74
|
+
"title": "Dev",
|
75
|
+
"type": null,
|
76
|
+
"dataType": null
|
77
|
+
}
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"label": {
|
81
|
+
"identifier": "label.devs.dev_id.email",
|
82
|
+
"title": "Email",
|
83
|
+
"type": null,
|
84
|
+
"dataType": null
|
85
|
+
}
|
86
|
+
}
|
87
|
+
],
|
88
|
+
"defaultLabel": "label.devs.dev_id.email"
|
89
|
+
}
|
90
|
+
},
|
91
|
+
"attributes": [
|
92
|
+
|
93
|
+
],
|
94
|
+
"facts": [
|
95
|
+
|
96
|
+
],
|
97
|
+
"references": [
|
98
|
+
|
99
|
+
]
|
100
|
+
}
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"dataset": {
|
104
|
+
"identifier": "dataset.commits",
|
105
|
+
"title": "Commits",
|
106
|
+
"anchor": {
|
107
|
+
"attribute": {
|
108
|
+
"identifier": "attr.commits.factsof",
|
109
|
+
"title": "Records of Commits"
|
110
|
+
}
|
111
|
+
},
|
112
|
+
"attributes": [
|
113
|
+
|
114
|
+
],
|
115
|
+
"facts": [
|
116
|
+
{
|
117
|
+
"fact": {
|
118
|
+
"identifier": "fact.commits.lines_changed",
|
119
|
+
"title": "Lines Changed",
|
120
|
+
"dataType": "INT"
|
121
|
+
}
|
122
|
+
}
|
123
|
+
],
|
124
|
+
"references": [
|
125
|
+
"committed_on",
|
126
|
+
"dataset.devs",
|
127
|
+
"dataset.repos"
|
128
|
+
]
|
129
|
+
}
|
130
|
+
}
|
131
|
+
],
|
132
|
+
"dateDimensions": [
|
133
|
+
{
|
134
|
+
"dateDimension": {
|
135
|
+
"name": "committed_on",
|
136
|
+
"title": "Committed On"
|
137
|
+
}
|
138
|
+
}
|
139
|
+
]
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
@@ -9,6 +9,8 @@ require 'gooddata/models/models'
|
|
9
9
|
module ProjectHelper
|
10
10
|
PROJECT_ID = 'we1vvh4il93r0927r809i3agif50d7iz'
|
11
11
|
PROJECT_URL = "/gdc/projects/#{PROJECT_ID}"
|
12
|
+
PROJECT_TITLE = 'GoodTravis'
|
13
|
+
PROJECT_SUMMARY = 'No summary'
|
12
14
|
|
13
15
|
def self.get_default_project
|
14
16
|
GoodData::Project[PROJECT_ID]
|
@@ -17,9 +17,11 @@ describe GoodData::Command::Project, :constraint => 'slow' do
|
|
17
17
|
it "should update the project" do
|
18
18
|
@blueprint.merge!(@module_blueprint)
|
19
19
|
GoodData.with_project(@project) do |p|
|
20
|
-
p.datasets.count.should ==
|
20
|
+
p.blueprint.datasets.count.should == 3
|
21
|
+
p.blueprint.datasets(:include_date_dimensions => true).count.should == 4
|
21
22
|
GoodData::Command::Project.update({:spec => @blueprint, :project => p})
|
22
|
-
p.datasets.count.should ==
|
23
|
+
p.blueprint.datasets.count.should == 4
|
24
|
+
p.blueprint.datasets(:include_date_dimensions => true).count.should == 5
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -20,13 +20,34 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
20
20
|
|
21
21
|
it "should contain datasets" do
|
22
22
|
GoodData.with_project(@project) do |p|
|
23
|
-
p.
|
23
|
+
p.blueprint.tap do |bp|
|
24
|
+
expect(bp.datasets.count).to eq 3
|
25
|
+
expect(bp.datasets(:include_date_dimensions => true).count).to eq 4
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should be able to rename a project" do
|
31
|
+
GoodData.with_project(@project) do |p|
|
32
|
+
former_title = p.title
|
33
|
+
a_title = (0...8).map { (65 + rand(26)).chr }.join
|
34
|
+
p.title = a_title
|
35
|
+
p.save
|
36
|
+
expect(p.title).to eq a_title
|
37
|
+
p.title = former_title
|
38
|
+
p.save
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should be able to validate a project" do
|
43
|
+
GoodData.with_project(@project) do |p|
|
44
|
+
p.validate
|
24
45
|
end
|
25
46
|
end
|
26
47
|
|
27
48
|
it "should compute an empty metric" do
|
28
49
|
GoodData.with_project(@project) do |p|
|
29
|
-
f = GoodData::Fact.find_first_by_title('Lines
|
50
|
+
f = GoodData::Fact.find_first_by_title('Lines Changed')
|
30
51
|
metric = GoodData::Metric.xcreate("SELECT SUM(#\"#{f.title}\")")
|
31
52
|
metric.execute.should be_nil
|
32
53
|
end
|
@@ -40,20 +61,22 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
40
61
|
[1,"01/01/2014",1,1],
|
41
62
|
[3,"01/02/2014",2,2],
|
42
63
|
[5,"05/02/2014",3,1]]
|
43
|
-
|
64
|
+
GoodData::Model.upload_data(commits_data, blueprint, 'commits')
|
65
|
+
# blueprint.find_dataset('commits').upload(commits_data)
|
44
66
|
|
45
67
|
devs_data = [
|
46
68
|
["dev_id", "email"],
|
47
69
|
[1, "tomas@gooddata.com"],
|
48
70
|
[2, "petr@gooddata.com"],
|
49
71
|
[3, "jirka@gooddata.com"]]
|
50
|
-
|
72
|
+
GoodData::Model.upload_data(devs_data, blueprint, 'devs')
|
73
|
+
# blueprint.find_dataset('devs').upload(devs_data)
|
51
74
|
end
|
52
75
|
end
|
53
76
|
|
54
77
|
it "should compute a metric" do
|
55
78
|
GoodData.with_project(@project) do |p|
|
56
|
-
f = GoodData::Fact.find_first_by_title('Lines
|
79
|
+
f = GoodData::Fact.find_first_by_title('Lines Changed')
|
57
80
|
metric = GoodData::Metric.xcreate("SELECT SUM(#\"#{f.title}\")")
|
58
81
|
metric.execute.should == 9
|
59
82
|
end
|
@@ -61,7 +84,7 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
61
84
|
|
62
85
|
it "should execute an anonymous metric twice and not fail" do
|
63
86
|
GoodData.with_project(@project) do |p|
|
64
|
-
f = GoodData::Fact.find_first_by_title('Lines
|
87
|
+
f = GoodData::Fact.find_first_by_title('Lines Changed')
|
65
88
|
metric = GoodData::Metric.xcreate("SELECT SUM(#\"#{f.title}\")")
|
66
89
|
metric.execute.should == 9
|
67
90
|
# Since GD platform cannot execute inline specified metric the metric has to be saved
|
@@ -72,7 +95,8 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
72
95
|
|
73
96
|
it "should compute a report" do
|
74
97
|
GoodData.with_project(@project) do |p|
|
75
|
-
f = GoodData::Fact.find_first_by_title('Lines
|
98
|
+
f = GoodData::Fact.find_first_by_title('Lines Changed')
|
99
|
+
# TODO: Here we create metric which is not deleted and is used by another test - "should exercise the object relations and getting them in various ways"
|
76
100
|
metric = GoodData::Metric.xcreate(:title => "My metric", :expression => "SELECT SUM(#\"#{f.title}\")")
|
77
101
|
metric.save
|
78
102
|
result = GoodData::ReportDefinition.execute(:title => "My report", :top => [metric], :left => ['label.devs.dev_id.email'])
|
@@ -144,7 +168,7 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
144
168
|
metric.should == metric
|
145
169
|
|
146
170
|
# grab fact in several different ways
|
147
|
-
fact1 = GoodData::Fact.find_first_by_title('Lines
|
171
|
+
fact1 = GoodData::Fact.find_first_by_title('Lines Changed')
|
148
172
|
fact2 = GoodData::Fact[fact1.identifier]
|
149
173
|
fact3 = GoodData::Fact[fact2.obj_id]
|
150
174
|
fact4 = GoodData::Fact[fact3.uri]
|
@@ -166,17 +190,23 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
166
190
|
fact1.used_by
|
167
191
|
fact1.used_by('metric').count.should == 1
|
168
192
|
|
169
|
-
metric.using?(fact1)
|
170
|
-
|
193
|
+
res = metric.using?(fact1)
|
194
|
+
expect(res).to be(true)
|
195
|
+
|
196
|
+
res = fact1.using?(metric)
|
197
|
+
expect(res).to be(false)
|
198
|
+
|
199
|
+
res = metric.used_by?(fact1)
|
200
|
+
expect(res).to be(false)
|
171
201
|
|
172
|
-
|
173
|
-
|
202
|
+
res = fact1.used_by?(metric)
|
203
|
+
expect(res).to be(true)
|
174
204
|
end
|
175
205
|
end
|
176
206
|
|
177
207
|
it "should try setting and getting by tags" do
|
178
208
|
GoodData.with_project(@project) do |p|
|
179
|
-
fact = GoodData::Fact.find_first_by_title('Lines
|
209
|
+
fact = GoodData::Fact.find_first_by_title('Lines Changed')
|
180
210
|
fact.tags.should be_empty
|
181
211
|
|
182
212
|
fact.tags = "tag1,tag2,tag3"
|
@@ -208,7 +238,7 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
208
238
|
res = GoodData::Metric.execute("SELECT SUM(![fact.commits.lines_changed])", :extended_notation => true)
|
209
239
|
res.should == 9
|
210
240
|
|
211
|
-
fact = GoodData::Fact.find_first_by_title('Lines
|
241
|
+
fact = GoodData::Fact.find_first_by_title('Lines Changed')
|
212
242
|
fact.fact?.should == true
|
213
243
|
res = fact.create_metric(:type => :sum).execute
|
214
244
|
res.should == 9
|
@@ -221,7 +251,8 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
221
251
|
devs_data = [
|
222
252
|
["dev_id", "email"],
|
223
253
|
[4, "josh@gooddata.com"]]
|
224
|
-
|
254
|
+
GoodData::Model.upload_data(devs_data, blueprint, 'devs', mode: 'INCREMENTAL' )
|
255
|
+
# blueprint.find_dataset('devs').upload(devs_data, :load => 'INCREMENTAL')
|
225
256
|
end
|
226
257
|
end
|
227
258
|
|
@@ -251,13 +282,15 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
251
282
|
l = attribute.primary_label
|
252
283
|
value = l.values.first[:value]
|
253
284
|
l.find_element_value(l.find_value_uri(value)).should == value
|
285
|
+
expect(l.value?(value)).should == true
|
286
|
+
expect(l.value?("DEFINITELY NON EXISTENT VALUE HOPEFULLY")).should == false
|
254
287
|
end
|
255
288
|
end
|
256
289
|
|
257
|
-
it "
|
290
|
+
it "should be able to compute count of different datasets" do
|
258
291
|
GoodData.with_project(@project) do |p|
|
259
292
|
attribute = GoodData::Attribute['attr.devs.dev_id']
|
260
|
-
dataset_attribute = GoodData::Attribute['attr.commits.
|
293
|
+
dataset_attribute = GoodData::Attribute['attr.commits.factsof']
|
261
294
|
attribute.create_metric(:attribute => dataset_attribute).execute.should == 3
|
262
295
|
end
|
263
296
|
end
|
@@ -283,7 +316,7 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
283
316
|
metric = GoodData::Metric.xcreate("SELECT SUM([#{fact.uri}]) WHERE [#{attribute.uri}] = [#{value[:uri]}]")
|
284
317
|
metric.replace_value(label, value[:value], different_value[:value])
|
285
318
|
metric.contain_value?(label, value[:value]).should == false
|
286
|
-
metric.pretty_expression.should == "SELECT SUM([Lines
|
319
|
+
metric.pretty_expression.should == "SELECT SUM([Lines Changed]) WHERE [Dev] = [josh@gooddata.com]"
|
287
320
|
end
|
288
321
|
end
|
289
322
|
|