flutter 0.1.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/.overcommit.yml +8 -0
  3. data/.rubocop.yml +10 -0
  4. data/CHANGELOG.md +6 -0
  5. data/CODE_OF_CONDUCT.md +84 -0
  6. data/Gemfile +35 -0
  7. data/Guardfile +9 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +134 -0
  10. data/Rakefile +24 -0
  11. data/TODO.md +30 -0
  12. data/integration_tests/minitest/grape_app/.gitignore +67 -0
  13. data/integration_tests/minitest/grape_app/.ruby-version +1 -0
  14. data/integration_tests/minitest/grape_app/Gemfile +17 -0
  15. data/integration_tests/minitest/grape_app/Gemfile.lock +89 -0
  16. data/integration_tests/minitest/grape_app/README.md +2 -0
  17. data/integration_tests/minitest/grape_app/Rakefile +9 -0
  18. data/integration_tests/minitest/grape_app/api/api.rb +34 -0
  19. data/integration_tests/minitest/grape_app/api/routes/api_helpers.rb +12 -0
  20. data/integration_tests/minitest/grape_app/api/routes/change_request/api.rb +69 -0
  21. data/integration_tests/minitest/grape_app/api/routes/change_request/response_entity.rb +18 -0
  22. data/integration_tests/minitest/grape_app/api/routes/event/api.rb +121 -0
  23. data/integration_tests/minitest/grape_app/api/routes/event/response_entity.rb +41 -0
  24. data/integration_tests/minitest/grape_app/api/routes/project/api.rb +59 -0
  25. data/integration_tests/minitest/grape_app/api/routes/project/response_entity.rb +13 -0
  26. data/integration_tests/minitest/grape_app/api/routes/property/api.rb +78 -0
  27. data/integration_tests/minitest/grape_app/api/routes/property/response_entity.rb +31 -0
  28. data/integration_tests/minitest/grape_app/api/routes/trackable_object/api.rb +64 -0
  29. data/integration_tests/minitest/grape_app/api/routes/trackable_object/response_entity.rb +24 -0
  30. data/integration_tests/minitest/grape_app/api/routes/tracking_spec/api.rb +88 -0
  31. data/integration_tests/minitest/grape_app/api/routes/tracking_spec/response_entity.rb +17 -0
  32. data/integration_tests/minitest/grape_app/api/routes/tracking_spec/spec_response.rb +19 -0
  33. data/integration_tests/minitest/grape_app/api/routes/user/api.rb +22 -0
  34. data/integration_tests/minitest/grape_app/api/routes/user/response_entity.rb +12 -0
  35. data/integration_tests/minitest/grape_app/app/app.rb +30 -0
  36. data/integration_tests/minitest/grape_app/app/change_request/endpoint.rb +24 -0
  37. data/integration_tests/minitest/grape_app/app/change_request/generate_system_changes.rb +25 -0
  38. data/integration_tests/minitest/grape_app/app/change_request/service.rb +79 -0
  39. data/integration_tests/minitest/grape_app/app/event/endpoint.rb +78 -0
  40. data/integration_tests/minitest/grape_app/app/event/service.rb +68 -0
  41. data/integration_tests/minitest/grape_app/app/event/validator.rb +108 -0
  42. data/integration_tests/minitest/grape_app/app/project/endpoint.rb +24 -0
  43. data/integration_tests/minitest/grape_app/app/project/service.rb +42 -0
  44. data/integration_tests/minitest/grape_app/app/property/endpoint.rb +39 -0
  45. data/integration_tests/minitest/grape_app/app/property/service.rb +56 -0
  46. data/integration_tests/minitest/grape_app/app/trackable_object/endpoint.rb +38 -0
  47. data/integration_tests/minitest/grape_app/app/trackable_object/service.rb +49 -0
  48. data/integration_tests/minitest/grape_app/app/trackable_object/validator.rb +40 -0
  49. data/integration_tests/minitest/grape_app/app/tracking_spec/endpoint.rb +58 -0
  50. data/integration_tests/minitest/grape_app/app/tracking_spec/expand_tracking_spec_events.rb +91 -0
  51. data/integration_tests/minitest/grape_app/app/tracking_spec/service.rb +51 -0
  52. data/integration_tests/minitest/grape_app/app/tracking_spec/validator.rb +61 -0
  53. data/integration_tests/minitest/grape_app/app/utils/errors/api_exceptions.rb +10 -0
  54. data/integration_tests/minitest/grape_app/app/utils/errors/service_exceptions.rb +12 -0
  55. data/integration_tests/minitest/grape_app/app/versioned_entity/entity.rb +110 -0
  56. data/integration_tests/minitest/grape_app/app/versioned_entity/service.rb +47 -0
  57. data/integration_tests/minitest/grape_app/app/versioned_entity/validator.rb +61 -0
  58. data/integration_tests/minitest/grape_app/app/versioned_entity_snapshot/entity.rb +32 -0
  59. data/integration_tests/minitest/grape_app/config/boot.rb +9 -0
  60. data/integration_tests/minitest/grape_app/config.ru +3 -0
  61. data/integration_tests/minitest/grape_app/db/proto/change_request.rb +10 -0
  62. data/integration_tests/minitest/grape_app/db/proto/common/doc.rb +86 -0
  63. data/integration_tests/minitest/grape_app/db/proto/event.rb +10 -0
  64. data/integration_tests/minitest/grape_app/db/proto/event_snapshot.rb +10 -0
  65. data/integration_tests/minitest/grape_app/db/proto/project.rb +21 -0
  66. data/integration_tests/minitest/grape_app/db/proto/property.rb +10 -0
  67. data/integration_tests/minitest/grape_app/db/proto/property_snapshot.rb +10 -0
  68. data/integration_tests/minitest/grape_app/db/proto/trackable_object.rb +10 -0
  69. data/integration_tests/minitest/grape_app/db/proto/trackable_object_snapshot.rb +10 -0
  70. data/integration_tests/minitest/grape_app/db/proto/tracking_spec.rb +10 -0
  71. data/integration_tests/minitest/grape_app/test/api/functional/event_test.rb +186 -0
  72. data/integration_tests/minitest/grape_app/test/api/functional/property_test.rb +197 -0
  73. data/integration_tests/minitest/grape_app/test/api/functional/trackable_object_test.rb +134 -0
  74. data/integration_tests/minitest/grape_app/test/api/functional/tracking_spec_test.rb +56 -0
  75. data/integration_tests/minitest/grape_app/test/api/functional/user_test.rb +24 -0
  76. data/integration_tests/minitest/grape_app/test/api/functional/versioned_entity_helper.rb +157 -0
  77. data/integration_tests/minitest/grape_app/test/fixtures/change_requests.rb +83 -0
  78. data/integration_tests/minitest/grape_app/test/fixtures/event_snapshots.rb +105 -0
  79. data/integration_tests/minitest/grape_app/test/fixtures/events.rb +58 -0
  80. data/integration_tests/minitest/grape_app/test/fixtures/properties.rb +66 -0
  81. data/integration_tests/minitest/grape_app/test/fixtures/property_snapshots.rb +124 -0
  82. data/integration_tests/minitest/grape_app/test/fixtures/sample_tracking_spec.json +125 -0
  83. data/integration_tests/minitest/grape_app/test/fixtures/trackable_objects.rb +58 -0
  84. data/integration_tests/minitest/grape_app/test/fixtures/trackable_objects_snapshots.rb +61 -0
  85. data/integration_tests/minitest/grape_app/test/fixtures/tracking_specs.rb +22 -0
  86. data/integration_tests/minitest/grape_app/test/test_helper.rb +15 -0
  87. data/lib/flutter/config.rb +24 -0
  88. data/lib/flutter/minitest.rb +83 -0
  89. data/lib/flutter/parser.rb +82 -0
  90. data/lib/flutter/persistence.rb +152 -0
  91. data/lib/flutter/rspec.rb +66 -0
  92. data/lib/flutter/tracker.rb +133 -0
  93. data/lib/flutter/version.rb +5 -0
  94. data/lib/flutter.rb +12 -0
  95. data/lib/minitest/flutter_plugin.rb +16 -0
  96. data/sig/flutter.rbs +4 -0
  97. metadata +187 -0
@@ -0,0 +1,134 @@
1
+ require_relative '../../test_helper'
2
+ require_relative 'versioned_entity_helper'
3
+ module Skee
4
+ module API
5
+ module Test
6
+ module Functional
7
+ class TrackableObjectTest < MiniTest::Test
8
+ include Rack::Test::Methods
9
+ include Skee::API::Test::Functional::VersionedEntityHelper
10
+
11
+ def app
12
+ Skee::API::Routes::TrackableObject::API
13
+ end
14
+
15
+ def initialize_db
16
+ @trackable_objects = Skee::Test::Fixtures::TrackableObjects.all
17
+ @trackable_objects.each { |entity| Skee::DB::Proto::TrackableObject.create(entity) }
18
+ @trackable_object_snapshots = Skee::Test::Fixtures::TrackableObjectSnapshots.all
19
+ @trackable_object_snapshots.each { |entity| Skee::DB::Proto::TrackableObjectSnapshot.create(entity) }
20
+ @change_requests = Skee::Test::Fixtures::ChangeRequests.all
21
+ @change_requests.each { |entity| Skee::DB::Proto::ChangeRequest.create(entity) }
22
+ @tracking_specs = Skee::Test::Fixtures::TrackingSpecs.all
23
+ @tracking_specs.each { |entity| Skee::DB::Proto::TrackingSpec.create(entity) }
24
+ end
25
+
26
+ def clear_db
27
+ Skee::DB::Proto::TrackableObject.delete_all
28
+ Skee::DB::Proto::ChangeRequest.delete_all
29
+ Skee::DB::Proto::TrackingSpec.delete_all
30
+ end
31
+
32
+ def setup
33
+ clear_db
34
+ initialize_db
35
+ @entity_type = :trackable_object
36
+ @entity_path = 'trackable_objects'
37
+ @entity_fixture = Skee::Test::Fixtures::TrackableObjects
38
+ end
39
+
40
+ # def test_get_all_trackable_objects
41
+ # get_all_entities
42
+ # end
43
+
44
+ def test_retrieve_trackable_object
45
+ id = '4'
46
+ retrieve_entity(id)
47
+ end
48
+
49
+ def test_retrieve_trackable_object_with_change_request
50
+ id = '4'
51
+ snapshot_id = '5'
52
+ params = {'change_request_id' => '1'}
53
+ retrieved_entity = retrieve_entity(id, params)
54
+ assert_equal(
55
+ snapshot_id,
56
+ retrieved_entity['snapshot_id']
57
+ )
58
+ end
59
+
60
+ def test_create_trackable_object_invalid_change_request
61
+ new_entity_params = {'name' => 'name', 'change_request_id' => '-999'}
62
+ create_entity_invalid_change_request(new_entity_params)
63
+ end
64
+
65
+ def test_create_trackable_object_valid_name
66
+ new_entity_params = {'name' => 'Cart', 'change_request_id' => '1'}
67
+ create_entity_valid_name(new_entity_params)
68
+ end
69
+
70
+ def test_update_trackable_object_invalid_change_request
71
+ id = '3'
72
+ params = {'name' => 'name', 'change_request_id' => '-999'}
73
+ update_entity_invalid_change_request(id, params)
74
+ end
75
+
76
+ def test_update_trackable_object_valid_creates_new_entity
77
+ id = '3'
78
+ params = {'name' => 'Cart', 'change_request_id' => '1'}
79
+ updated_entity = update_entity_valid_creates_new_entity(id, params)
80
+ assert_equal(
81
+ params['name'],
82
+ updated_entity['name']
83
+ )
84
+ assert_equal(id, updated_entity['previous_snapshot_id'])
85
+ end
86
+
87
+ def test_update_trackable_object_valid_updates_existing_snapshot_of_updated_trackable_object
88
+ id = '4'
89
+ params = {'name' => 'All Shops', 'change_request_id' => '1'}
90
+ updated_entity = update_entity_valid_updates_existing_snapshot_of_updated_entity(id, params)
91
+ assert_equal(
92
+ params['name'],
93
+ updated_entity['name']
94
+ )
95
+ end
96
+
97
+ def test_update_trackable_object_valid_updates_existing_snapshot_of_new_trackable_object
98
+ id = '5'
99
+ params = {'name' => 'Logged-in User', 'change_request_id' => '1'}
100
+ updated_entity = update_entity_valid_updates_existing_snapshot_of_new_entity(id, params)
101
+ assert_equal(
102
+ params['name'],
103
+ updated_entity['name']
104
+ )
105
+ end
106
+
107
+ def test_remove_trackable_object_invalid_change_request
108
+ id = '3'
109
+ params = {'change_request_id' => '-999'}
110
+ remove_entity_invalid_change_request(id, params)
111
+ end
112
+
113
+ def test_remove_trackable_object_valid_creates_new_entity
114
+ id = '3'
115
+ params = {'change_request_id' => '1'}
116
+ remove_entity_valid_creates_new_entity(id, params)
117
+ end
118
+
119
+ def test_remove_trackable_object_valid_updates_existing_snapshot_of_updated_trackable_object
120
+ id = '4'
121
+ params = {'change_request_id' => '1'}
122
+ remove_entity_valid_updates_existing_snapshot_of_updated_entity(id, params)
123
+ end
124
+
125
+ def test_remove_trackable_object_valid_updates_existing_snapshot_of_new_trackable_object
126
+ id = '5'
127
+ params = {'change_request_id' => '1'}
128
+ remove_entity_valid_updates_existing_snapshot_of_new_entity(id, params)
129
+ end
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,56 @@
1
+ require_relative '../../test_helper'
2
+ module Skee
3
+ module API
4
+ module Test
5
+ module Functional
6
+ class TrackingSpecTest < MiniTest::Test
7
+ include Rack::Test::Methods
8
+
9
+ def app
10
+ Skee::API::Routes::TrackingSpec::API
11
+ end
12
+
13
+ def initialize_db
14
+ @properties = Skee::Test::Fixtures::Properties.all
15
+ @properties.each { |entity| Skee::DB::Proto::Property.create(entity) }
16
+ @property_snapshots = Skee::Test::Fixtures::PropertySnapshots.all
17
+ @property_snapshots.each { |entity| Skee::DB::Proto::PropertySnapshot.create(entity) }
18
+ @trackable_objects = Skee::Test::Fixtures::TrackableObjects.all
19
+ @trackable_objects.each { |entity| Skee::DB::Proto::TrackableObject.create(entity) }
20
+ @trackable_object_snapshots = Skee::Test::Fixtures::TrackableObjectSnapshots.all
21
+ @trackable_object_snapshots.each { |entity| Skee::DB::Proto::TrackableObjectSnapshot.create(entity) }
22
+ @change_requests = Skee::Test::Fixtures::ChangeRequests.all
23
+ @change_requests.each { |entity| Skee::DB::Proto::ChangeRequest.create(entity) }
24
+ @tracking_specs = Skee::Test::Fixtures::TrackingSpecs.all
25
+ @tracking_specs.each { |entity| Skee::DB::Proto::TrackingSpec.create(entity) }
26
+ @events = Skee::Test::Fixtures::Events.all
27
+ @events.each { |entity| Skee::DB::Proto::Event.create(entity) }
28
+ @event_snapshots = Skee::Test::Fixtures::EventSnapshots.all
29
+ @event_snapshots.each { |entity| Skee::DB::Proto::EventSnapshot.create(entity) }
30
+ end
31
+
32
+ def clear_db
33
+ Skee::DB::Proto::Property.delete_all
34
+ Skee::DB::Proto::TrackableObject.delete_all
35
+ Skee::DB::Proto::ChangeRequest.delete_all
36
+ Skee::DB::Proto::TrackingSpec.delete_all
37
+ Skee::DB::Proto::Event.delete_all
38
+ end
39
+
40
+ def setup
41
+ clear_db
42
+ initialize_db
43
+ end
44
+
45
+ def test_expands_results
46
+ change_request_id = '0'
47
+ tracking_spec_id = '1'
48
+ params = {'change_request_id' => change_request_id}
49
+ get "/api/tracking_specs/#{tracking_spec_id}/expand", params
50
+ assert last_response.ok?
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,24 @@
1
+ require_relative '../../test_helper'
2
+ module Skee
3
+ module API
4
+ module Test
5
+ module Functional
6
+ class UserTest < MiniTest::Test
7
+ include Rack::Test::Methods
8
+
9
+ def app
10
+ Skee::API::Routes::User::API
11
+ end
12
+
13
+ def test_authenticate
14
+ post '/api/users/authenticate', username: 'user', password: 'password'
15
+ assert last_response.created?
16
+ body = JSON.parse(last_response.body)
17
+ assert_equal('user', body['username'])
18
+ assert_equal('123', body['access_token'])
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,157 @@
1
+ require_relative '../../test_helper'
2
+ module Skee
3
+ module API
4
+ module Test
5
+ module Functional
6
+ module VersionedEntityHelper
7
+
8
+ def get_all_entities
9
+ get "/api/#{@entity_path}"
10
+ assert last_response.ok?
11
+ expected_entity_ids = @entity_fixture.all.map{ |e| e[:id] }
12
+ response_entity_ids = JSON.parse(last_response.body).map{ |e| e['id'] }
13
+ assert_empty(expected_entity_ids - response_entity_ids)
14
+ end
15
+
16
+ def retrieve_entity(id, params=nil)
17
+ get "/api/#{@entity_path}/#{id}", params
18
+ retrieved_entity = JSON.parse(last_response.body)
19
+ assert last_response.ok?
20
+ assert_equal(
21
+ id,
22
+ retrieved_entity['id']
23
+ )
24
+ retrieved_entity
25
+ end
26
+
27
+ def create_entity_invalid_change_request(new_entity_params)
28
+ post "/api/#{@entity_path}", new_entity_params
29
+ assert_equal(400, last_response.status)
30
+ assert_equal(
31
+ "{\"error\":\"Invalid change request\"}",
32
+ last_response.body
33
+ )
34
+ end
35
+
36
+ def create_entity_valid_name(new_entity_params)
37
+ post "/api/#{@entity_path}", new_entity_params
38
+ change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(new_entity_params['change_request_id'])
39
+ new_entity = JSON.parse(last_response.body)
40
+ assert_equal(201,last_response.status)
41
+ assert_equal(
42
+ new_entity_params['name'],
43
+ new_entity['name']
44
+ )
45
+ assert_includes(change_request.change_set[@entity_type][new_entity['id']].values, new_entity['snapshot_id'])
46
+ new_entity
47
+ end
48
+
49
+ def update_entity_invalid_change_request(id, update_params)
50
+ post "/api/#{@entity_path}/#{id}", update_params
51
+ assert_equal(400, last_response.status)
52
+ assert_equal(
53
+ "{\"error\":\"Invalid change request\"}",
54
+ last_response.body
55
+ )
56
+ end
57
+
58
+ def update_entity_valid_creates_new_entity(id, update_params)
59
+ post "/api/#{@entity_path}/#{id}", update_params
60
+ change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(update_params['change_request_id'])
61
+ updated_entity = JSON.parse(last_response.body)
62
+ assert_equal(201, last_response.status)
63
+ assert_equal(id, updated_entity['id'])
64
+ assert_includes(change_request.change_set[@entity_type].keys, id)
65
+ assert_equal(change_request.change_set[@entity_type][id].values.first, updated_entity['snapshot_id'])
66
+ assert_equal(change_request.change_set[@entity_type][id].keys.first, updated_entity['previous_snapshot_id'])
67
+ updated_entity
68
+ end
69
+
70
+ def update_entity_valid_updates_existing_snapshot_of_updated_entity(id, update_params)
71
+ old_change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(update_params['change_request_id'])
72
+ post "/api/#{@entity_path}/#{id}", update_params
73
+ updated_change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(update_params['change_request_id'])
74
+ updated_entity = JSON.parse(last_response.body)
75
+ assert_equal(201, last_response.status)
76
+ assert_equal(id, updated_entity['id'])
77
+ assert_includes(updated_change_request.change_set[@entity_type].keys, id)
78
+ assert_equal(updated_change_request.change_set[@entity_type][id].values.first,
79
+ old_change_request.change_set[@entity_type][id].values.first)
80
+ assert_equal(updated_change_request.change_set[@entity_type][id].keys.first,
81
+ old_change_request.change_set[@entity_type][id].keys.first)
82
+ updated_entity
83
+ end
84
+
85
+ def update_entity_valid_updates_existing_snapshot_of_new_entity(id, update_params)
86
+ old_change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(update_params['change_request_id'])
87
+ post "/api/#{@entity_path}/#{id}", update_params
88
+ updated_change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(update_params['change_request_id'])
89
+ updated_entity = JSON.parse(last_response.body)
90
+ assert_equal(201, last_response.status)
91
+ assert_equal(id, updated_entity['id'])
92
+ assert_includes(updated_change_request.change_set[@entity_type].keys, id)
93
+ assert_equal(old_change_request.change_set[@entity_type][id].values.first,
94
+ updated_change_request.change_set[@entity_type][id].values.first)
95
+ assert_nil(updated_change_request.change_set[@entity_type][id].keys.first)
96
+ assert_nil(updated_entity['previous_snapshot_id'])
97
+ updated_entity
98
+ end
99
+
100
+ def remove_entity_invalid_change_request(id, remove_params)
101
+ post "/api/#{@entity_path}/#{id}/remove", remove_params
102
+ assert_equal(400, last_response.status)
103
+ assert_equal(
104
+ "{\"error\":\"Invalid change request\"}",
105
+ last_response.body
106
+ )
107
+ end
108
+
109
+ def remove_entity_valid_creates_new_entity(id, remove_params)
110
+ post "/api/#{@entity_path}/#{id}/remove", remove_params
111
+ change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(remove_params['change_request_id'])
112
+ updated_entity = JSON.parse(last_response.body)
113
+ assert_equal(201, last_response.status)
114
+ assert_equal(true, updated_entity['is_removed'])
115
+ assert_equal(id, updated_entity['id'])
116
+ assert_includes(change_request.change_set[@entity_type].keys, id)
117
+ assert_equal(change_request.change_set[@entity_type][id].values.first, updated_entity['snapshot_id'])
118
+ assert_equal(change_request.change_set[@entity_type][id].keys.first, updated_entity['previous_snapshot_id'])
119
+ updated_entity
120
+ end
121
+
122
+ def remove_entity_valid_updates_existing_snapshot_of_updated_entity(id, remove_params)
123
+ old_change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(remove_params['change_request_id'])
124
+ post "/api/#{@entity_path}/#{id}/remove", remove_params
125
+ updated_change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(remove_params['change_request_id'])
126
+ updated_entity = JSON.parse(last_response.body)
127
+ assert_equal(201, last_response.status)
128
+ assert_equal(true, updated_entity['is_removed'])
129
+ assert_equal(id, updated_entity['id'])
130
+ assert_includes(updated_change_request.change_set[@entity_type].keys, id)
131
+ assert_equal(updated_change_request.change_set[@entity_type][id].values.first,
132
+ old_change_request.change_set[@entity_type][id].values.first)
133
+ assert_equal(updated_change_request.change_set[@entity_type][id].keys.first,
134
+ old_change_request.change_set[@entity_type][id].keys.first)
135
+ updated_entity
136
+ end
137
+
138
+ def remove_entity_valid_updates_existing_snapshot_of_new_entity(id, remove_params)
139
+ old_change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(remove_params['change_request_id'])
140
+ post "/api/#{@entity_path}/#{id}/remove", remove_params
141
+ updated_change_request = Skee::App::DB_MAPPING_ENTITY[:change_request].find(remove_params['change_request_id'])
142
+ updated_entity = JSON.parse(last_response.body)
143
+ assert_equal(201, last_response.status)
144
+ assert_equal(true, updated_entity['is_removed'])
145
+ assert_equal(id, updated_entity['id'])
146
+ assert_includes(updated_change_request.change_set[@entity_type].keys, id)
147
+ assert_equal(old_change_request.change_set[@entity_type][id].values.first,
148
+ updated_change_request.change_set[@entity_type][id].values.first)
149
+ assert_nil(updated_change_request.change_set[@entity_type][id].keys.first)
150
+ assert_nil(updated_entity['previous_snapshot_id'])
151
+ updated_entity
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,83 @@
1
+ module Skee
2
+ module Test
3
+ module Fixtures
4
+ class ChangeRequests
5
+ def self.all
6
+ all_change_requests = [
7
+ {
8
+ 'id': '1',
9
+ 'name': 'Self-enabling disintermediate budgetary management',
10
+ 'identifier': 'Voltsillam',
11
+ 'project_id': '1',
12
+ 'source_tracking_spec_id': '0',
13
+ 'status': 'open',
14
+ 'description': 'nulla suscipit ligula in lacus curabitur at ipsum',
15
+ 'change_set': {
16
+ trackable_object: {
17
+ '4' => {
18
+ '4' => '5'
19
+ },
20
+ '5' => {
21
+ nil => '7'
22
+ }
23
+ },
24
+ property: {
25
+ '4' => {
26
+ '4' => '5'
27
+ },
28
+ '5' => {
29
+ nil => '7'
30
+ }
31
+ },
32
+ event: {
33
+ '4' => {
34
+ '4' => '5'
35
+ },
36
+ '5' => {
37
+ nil => '7'
38
+ }
39
+ },
40
+ }
41
+ }
42
+ ]
43
+ all_change_requests << initial_change_request
44
+ end
45
+
46
+ def self.initial_change_request
47
+ {
48
+ 'id': '0',
49
+ 'name': 'Budgetary management',
50
+ 'identifier': 'beginning',
51
+ 'project_id': '1',
52
+ 'source_tracking_spec_id': nil,
53
+ 'status': 'open',
54
+ 'description': 'nulla suscipit ligula in lacus curabitur at ipsum',
55
+ 'change_set': {
56
+ trackable_object: {
57
+ '4' => {
58
+ nil => '4'
59
+ },
60
+ },
61
+ property: {
62
+ '5' => {
63
+ nil => '7'
64
+ }
65
+ },
66
+ event: {
67
+ '1' => {
68
+ nil => '1'
69
+ },
70
+ '3' => {
71
+ nil => '5'
72
+ },
73
+ '4' => {
74
+ nil => '4'
75
+ }
76
+ },
77
+ }
78
+ }
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,105 @@
1
+ module Skee
2
+ module Test
3
+ module Fixtures
4
+ class EventSnapshots
5
+ def self.all
6
+ [
7
+ {
8
+ 'id': '1',
9
+ 'name': 'Closed App',
10
+ 'description': 'Description of event A.',
11
+ 'payload': {
12
+ 'primary_user' => {
13
+ 'reference_entity_type': :trackable_object,
14
+ 'reference_entity_id': '1',
15
+ 'is_array': false,
16
+ 'is_primary': true,
17
+ 'selected_property_ids': ['1'],
18
+ },
19
+ 'created_timestamp' => {
20
+ 'reference_entity_type': :property,
21
+ 'reference_entity_id': '2',
22
+ 'is_array': false,
23
+ 'is_primary': nil,
24
+ 'selected_property_ids': ['2'],
25
+ },
26
+ 'cart' => {
27
+ 'reference_entity_type': :trackable_object,
28
+ 'reference_entity_id': '3',
29
+ 'is_array': false,
30
+ 'is_primary': nil,
31
+ 'selected_property_ids': ['3'],
32
+ }
33
+ },
34
+ 'change_request_id': '1',
35
+ 'previous_snapshot_id': nil,
36
+ 'is_removed': nil,
37
+ },
38
+ {
39
+ 'id': '4',
40
+ 'name': 'Launched App',
41
+ 'description': 'Description of event A.',
42
+ 'payload': {
43
+ 'primary_user' => {
44
+ 'reference_entity_type': :trackable_object,
45
+ 'reference_entity_id': '1',
46
+ 'is_array': false,
47
+ 'is_primary': true,
48
+ 'selected_property_ids': ['1'],
49
+ },
50
+ 'created_timestamp' => {
51
+ 'reference_entity_type': :property,
52
+ 'reference_entity_id': '2',
53
+ 'is_array': false,
54
+ 'is_primary': nil,
55
+ 'selected_property_ids': ['2'],
56
+ },
57
+ 'cart' => {
58
+ 'reference_entity_type': :trackable_object,
59
+ 'reference_entity_id': '3',
60
+ 'is_array': false,
61
+ 'is_primary': nil,
62
+ 'selected_property_ids': ['3'],
63
+ }
64
+ },
65
+ 'change_request_id': '1',
66
+ 'previous_snapshot_id': nil,
67
+ 'is_removed': nil,
68
+ },
69
+ {
70
+ 'id': '5',
71
+ 'name': 'Opened App',
72
+ 'description': 'Description of event A.',
73
+ 'payload': {
74
+ 'primary_user' => {
75
+ 'reference_entity_type': :trackable_object,
76
+ 'reference_entity_id': '1',
77
+ 'is_array': false,
78
+ 'is_primary': true,
79
+ 'selected_property_ids': ['1'],
80
+ },
81
+ 'created_timestamp' => {
82
+ 'reference_entity_type': :property,
83
+ 'reference_entity_id': '2',
84
+ 'is_array': false,
85
+ 'is_primary': nil,
86
+ 'selected_property_ids': ['2'],
87
+ },
88
+ 'cart' => {
89
+ 'reference_entity_type': :trackable_object,
90
+ 'reference_entity_id': '3',
91
+ 'is_array': false,
92
+ 'is_primary': nil,
93
+ 'selected_property_ids': ['3'],
94
+ }
95
+ },
96
+ 'change_request_id': '1',
97
+ 'previous_snapshot_id': nil,
98
+ 'is_removed': nil,
99
+ },
100
+ ]
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,58 @@
1
+ module Skee
2
+ module Test
3
+ module Fixtures
4
+ class Events
5
+ def self.all
6
+ [
7
+ {
8
+ 'id': '1',
9
+ 'latest_snapshot_id': '1',
10
+ 'snapshot_mapping': {
11
+ '0' => '1'
12
+ },
13
+ 'is_removed': nil,
14
+ }, {
15
+ 'id': '2',
16
+ 'latest_snapshot_id': nil,
17
+ 'snapshot_mapping': {
18
+ },
19
+ 'is_removed': nil,
20
+ }, {
21
+ 'id': '3',
22
+ 'latest_snapshot_id': '5',
23
+ 'snapshot_mapping': {
24
+ '0' => '5'
25
+ },
26
+ 'is_removed': nil,
27
+ }, {
28
+ 'id': '4',
29
+ 'latest_snapshot_id': '4',
30
+ 'snapshot_mapping': {
31
+ '0' => '4'
32
+ },
33
+ 'is_removed': nil,
34
+ }, {
35
+ 'id': '5',
36
+ 'latest_snapshot_id': '4',
37
+ 'snapshot_mapping': {
38
+ },
39
+ 'is_removed': nil,
40
+ }, {
41
+ 'id': '6',
42
+ 'latest_snapshot_id': nil,
43
+ 'snapshot_mapping': {
44
+ },
45
+ 'is_removed': nil,
46
+ }, {
47
+ 'id': '7',
48
+ 'latest_snapshot_id': nil,
49
+ 'snapshot_mapping': {
50
+ },
51
+ 'is_removed': nil,
52
+ }
53
+ ]
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,66 @@
1
+ module Skee
2
+ module Test
3
+ module Fixtures
4
+ class Properties
5
+ def self.all
6
+ [{
7
+ 'id': '1',
8
+ 'latest_snapshot_id': '1',
9
+ 'snapshot_mapping': {
10
+ '0' => '1'
11
+ },
12
+ 'is_removed': nil,
13
+ }, {
14
+ 'id': '2',
15
+ 'latest_snapshot_id': '2',
16
+ 'snapshot_mapping': {
17
+ '0' => '2'
18
+ },
19
+ 'is_removed': nil,
20
+ }, {
21
+ 'id': '3',
22
+ 'latest_snapshot_id': '3',
23
+ 'snapshot_mapping': {
24
+ '0' => '3'
25
+ },
26
+ 'is_removed': nil,
27
+ }, {
28
+ 'id': '4',
29
+ 'latest_snapshot_id': '1',
30
+ 'snapshot_mapping': {
31
+ '0' => '1'
32
+ },
33
+ 'is_removed': nil,
34
+ }, {
35
+ 'id': '5',
36
+ 'latest_snapshot_id': '4',
37
+ 'snapshot_mapping': {
38
+ },
39
+ 'is_removed': nil,
40
+ }, {
41
+ 'id': '6',
42
+ 'latest_snapshot_id': nil,
43
+ 'snapshot_mapping': {
44
+ },
45
+ 'is_removed': nil,
46
+ }, {
47
+ 'id': '7',
48
+ 'latest_snapshot_id': '6',
49
+ 'snapshot_mapping': {
50
+ '0' => '6'
51
+ },
52
+ 'is_removed': nil,
53
+ }, {
54
+ 'id': '8',
55
+ 'latest_snapshot_id': '7',
56
+ 'snapshot_mapping': {
57
+ '0' => '7'
58
+ },
59
+ 'is_removed': nil,
60
+ }
61
+ ]
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end