montage_rails 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/montage_rails/model_generator.rb +49 -0
- data/lib/generators/montage_rails/templates/model.rb +5 -0
- data/lib/generators/montage_rails/templates/resource.rb +22 -0
- data/lib/generators/montage_rails/templates/test_data.rb +6 -0
- data/lib/montage_rails/application_resource.rb +63 -0
- data/lib/montage_rails/mock_server.rb +54 -0
- data/lib/montage_rails/railtie.rb +5 -0
- data/lib/montage_rails/version.rb +1 -1
- data/lib/montage_rails.rb +34 -1
- data/test/dummy/app/models/movie.rb +1 -0
- data/test/dummy/app/models/test_mod.rb +3 -0
- data/test/dummy/app/models/test_one.rb +3 -0
- data/test/dummy/config/initializers/montage.rb +1 -0
- data/test/dummy/config/routes.rb +3 -54
- data/test/dummy/log/development.log +8 -0
- data/test/dummy/log/test.log +4074 -0
- data/test/dummy/test/fixtures/actors.yml +9 -0
- data/test/dummy/test/fixtures/movies.yml +17 -0
- data/test/dummy/test/fixtures/studios.yml +7 -0
- data/test/dummy/test/fixtures/test_mods.yml +9 -0
- data/test/dummy/test/fixtures/test_ones.yml +11 -0
- data/test/dummy/test/models/actor_test.rb +7 -0
- data/test/dummy/test/models/movie_test.rb +7 -0
- data/test/dummy/test/models/studio_test.rb +7 -0
- data/test/dummy/test/models/test_mod_test.rb +5 -0
- data/test/dummy/test/models/test_one_test.rb +7 -0
- data/test/dummy/test/montage_resources/actor_resource.rb +26 -0
- data/test/dummy/test/montage_resources/movie_resource.rb +43 -0
- data/test/dummy/test/montage_resources/studio_resource.rb +18 -0
- data/test/dummy/test/montage_resources/test_data/actor_test_data.yml +8 -0
- data/test/dummy/test/montage_resources/test_data/movie_test_data.yml +8 -0
- data/test/dummy/test/montage_resources/test_data/studio_test_data.yml +3 -0
- data/test/dummy/test/resources/test_mod_resource.rb +22 -0
- data/test/dummy/test/resources/test_one_resource.rb +26 -0
- data/test/dummy/test/test_helper.rb +0 -0
- data/test/montage_rails/application_resource_test.rb +92 -0
- data/test/montage_rails/base_test.rb +22 -22
- data/test/montage_rails/relation_test.rb +1 -1
- data/test/montage_rails_test.rb +57 -14
- data/test/test_helper.rb +9 -166
- metadata +108 -22
- data/test/resources/actor_resource.rb +0 -141
- data/test/resources/movie_resource.rb +0 -221
- data/test/resources/studio_resource.rb +0 -56
data/test/test_helper.rb
CHANGED
@@ -23,7 +23,7 @@ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
|
23
23
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
24
24
|
|
25
25
|
# Load resource helpers
|
26
|
-
Dir[File.join(File.dirname(__FILE__), '
|
26
|
+
Dir[File.join(File.dirname(__FILE__), 'dummy','test', 'montage_resources', '*.rb')].each do |file|
|
27
27
|
require file
|
28
28
|
end
|
29
29
|
|
@@ -33,6 +33,7 @@ require 'mocha/setup'
|
|
33
33
|
require 'webmock/minitest'
|
34
34
|
|
35
35
|
WebMock.disable_net_connect!(:allow => "codecov.io")
|
36
|
+
WebMock.disable_net_connect!(:allow => "127.0.0.1")
|
36
37
|
|
37
38
|
class MiniTest::Test
|
38
39
|
@@default_headers = {
|
@@ -43,170 +44,12 @@ class MiniTest::Test
|
|
43
44
|
}
|
44
45
|
|
45
46
|
def setup
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
'Content-Type' => 'application/json'
|
54
|
-
}
|
55
|
-
)
|
56
|
-
|
57
|
-
# Stub the save movie request
|
58
|
-
#
|
59
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/save/").
|
60
|
-
with(body: [ MontageRails::MovieResource.to_hash ].to_json, headers: @@default_headers).to_return(
|
61
|
-
body: MontageRails::MovieResource.save_response.to_json,
|
62
|
-
headers: { 'Content-Type' => 'application/json' }
|
63
|
-
)
|
64
|
-
|
65
|
-
# Stub the save movie request
|
66
|
-
#
|
67
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/save/").
|
68
|
-
with(body: [ MontageRails::MovieResource.save_with_update_hash ].to_json, headers: @@default_headers).to_return(
|
69
|
-
body: MontageRails::MovieResource.save_response.to_json,
|
70
|
-
headers: { 'Content-Type' => 'application/json' }
|
71
|
-
)
|
72
|
-
|
73
|
-
# Stub the update movie request
|
74
|
-
#
|
75
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/save/").
|
76
|
-
with(body: MontageRails::MovieResource.update_body.to_json, headers: @@default_headers).to_return(
|
77
|
-
body: MontageRails::MovieResource.update_response.to_json,
|
78
|
-
headers: { 'Content-Type' => 'application/json' }
|
79
|
-
)
|
80
|
-
|
81
|
-
# Stub the update movie request for votes only
|
82
|
-
#
|
83
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/save/").
|
84
|
-
with(body: MontageRails::MovieResource.update_votes.to_json, headers: @@default_headers).to_return(
|
85
|
-
body: MontageRails::MovieResource.update_votes_response.to_json,
|
86
|
-
headers: { 'Content-Type' => 'application/json' }
|
87
|
-
)
|
88
|
-
|
89
|
-
# Stub the request for getting the actor schema definition
|
90
|
-
#
|
91
|
-
stub_request(:get, "http://testco.dev.montagehot.club/api/v1/schemas/actors/")
|
92
|
-
.with(headers: @@default_headers).to_return(
|
93
|
-
status: 200,
|
94
|
-
body: MontageRails::ActorResource.schema_definition.to_json,
|
95
|
-
headers: {
|
96
|
-
'Content-Type' => 'application/json'
|
97
|
-
}
|
98
|
-
)
|
99
|
-
|
100
|
-
# Stub the creation of Steve Martin
|
101
|
-
#
|
102
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/save/").
|
103
|
-
with(body: [ MontageRails::ActorResource.steve_martin ].to_json, headers: @@default_headers).to_return(
|
104
|
-
body: MontageRails::ActorResource.save_steve_response.to_json,
|
105
|
-
headers: { 'Content-Type' => 'application/json' }
|
106
|
-
)
|
107
|
-
|
108
|
-
# Stub the creation of Mark Hamill
|
109
|
-
#
|
110
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/save/").
|
111
|
-
with(body: [ MontageRails::ActorResource.mark_hamill ].to_json, headers: @@default_headers).to_return(
|
112
|
-
body: MontageRails::ActorResource.save_mark_response.to_json,
|
113
|
-
headers: { 'Content-Type' => 'application/json' }
|
114
|
-
)
|
115
|
-
|
116
|
-
# Stub the actor query
|
117
|
-
#
|
118
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/query/").
|
119
|
-
with(body: MontageRails::ActorResource.query.to_json, headers: @@default_headers).to_return(
|
120
|
-
body: MontageRails::ActorResource.query_result.to_json,
|
121
|
-
headers: { 'Content-Type' => 'application/json'}
|
122
|
-
)
|
123
|
-
|
124
|
-
# Stub the movie query
|
125
|
-
#
|
126
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
|
127
|
-
with(body: MontageRails::MovieResource.movie_query.to_json, headers: @@default_headers).to_return(
|
128
|
-
body: MontageRails::MovieResource.query_result.to_json,
|
129
|
-
headers: { 'Content-Type' => 'application/json'}
|
130
|
-
)
|
131
|
-
|
132
|
-
# Stub the movie pluck query
|
133
|
-
#
|
134
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
|
135
|
-
with(body: MontageRails::MovieResource.movie_query_pluck.to_json, headers: @@default_headers).to_return(
|
136
|
-
body: MontageRails::MovieResource.pluck_response.to_json,
|
137
|
-
headers: { 'Content-Type' => 'application/json'}
|
138
|
-
)
|
139
|
-
|
140
|
-
# Stub the movie relation query for actors
|
141
|
-
#
|
142
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/query/").
|
143
|
-
with(body: MontageRails::ActorResource.relation_query.to_json, headers: @@default_headers).to_return(
|
144
|
-
body: MontageRails::ActorResource.relation_response.to_json,
|
145
|
-
headers: { 'Content-Type' => 'application/json'}
|
146
|
-
)
|
147
|
-
|
148
|
-
# Stub the movie relation query for getting the first actor
|
149
|
-
#
|
150
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/query/").
|
151
|
-
with(body: MontageRails::ActorResource.relation_first_query.to_json, headers: @@default_headers).to_return(
|
152
|
-
body: MontageRails::ActorResource.relation_response.to_json,
|
153
|
-
headers: { 'Content-Type' => 'application/json'}
|
154
|
-
)
|
155
|
-
|
156
|
-
# Stub the schema definition request for studios
|
157
|
-
#
|
158
|
-
stub_request(:get, "http://testco.dev.montagehot.club/api/v1/schemas/studios/").
|
159
|
-
with(headers: @@default_headers).to_return(
|
160
|
-
body: MontageRails::StudioResource.schema_definition.to_json,
|
161
|
-
headers: { 'Content-Type' => 'application/json' }
|
162
|
-
)
|
163
|
-
|
164
|
-
# Stub the save studio action
|
165
|
-
#
|
166
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/studios/save/").
|
167
|
-
with(body: [ MontageRails::StudioResource.to_hash ].to_json, headers: @@default_headers).to_return(
|
168
|
-
body: MontageRails::StudioResource.save_response.to_json,
|
169
|
-
headers: { 'Content-Type' => 'application/json' }
|
170
|
-
)
|
171
|
-
|
172
|
-
# Stub the get studio response
|
173
|
-
#
|
174
|
-
stub_request(:get, "http://testco.dev.montagehot.club/api/v1/schemas/studios/19442e09-5c2d-4e5d-8f34-675570e81414/").
|
175
|
-
with(headers: @@default_headers).to_return(
|
176
|
-
body: MontageRails::StudioResource.get_studio_response.to_json,
|
177
|
-
headers: { 'Content-Type' => 'applicaiton/json' }
|
178
|
-
)
|
179
|
-
|
180
|
-
# Stub the find by query for movies
|
181
|
-
#
|
182
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
|
183
|
-
with(body: MontageRails::MovieResource.find_movie_query.to_json, headers: @@default_headers).to_return(
|
184
|
-
body: MontageRails::MovieResource.query_result.to_json,
|
185
|
-
headers: { 'Content-Type' => 'application/json' }
|
186
|
-
)
|
187
|
-
|
188
|
-
# Stub the find by query for movies that returns no results
|
189
|
-
#
|
190
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
|
191
|
-
with(body: MontageRails::MovieResource.movie_not_found_query.to_json, headers: @@default_headers).to_return(
|
192
|
-
body: { data: [] }.to_json,
|
193
|
-
headers: { 'Content-Type' => 'application/json' }
|
194
|
-
)
|
195
|
-
|
196
|
-
# Stub the all query for movies
|
197
|
-
#
|
198
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
|
199
|
-
with(body: MontageRails::MovieResource.all_movies_query.to_json, headers: @@default_headers).to_return(
|
200
|
-
body: MontageRails::MovieResource.query_result.to_json,
|
201
|
-
headers: { 'Content-Type' => 'application/json' }
|
202
|
-
)
|
203
|
-
|
204
|
-
# Stub the greater than relation
|
205
|
-
#
|
206
|
-
stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
|
207
|
-
with(body: MontageRails::MovieResource.gt_query.to_json, headers: @@default_headers).to_return(
|
208
|
-
body: MontageRails::MovieResource.query_result.to_json,
|
209
|
-
headers: { 'Content-Type' => 'application/json' }
|
210
|
-
)
|
47
|
+
MontageRails.configure do |c|
|
48
|
+
c.token = "fb761e07-a12b-40bb-a42f-2202ecfd1046"
|
49
|
+
c.domain = "testco"
|
50
|
+
c.use_mock_server = true
|
51
|
+
c.url_prefix = nil
|
52
|
+
c.server_url = nil
|
53
|
+
end
|
211
54
|
end
|
212
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: montage_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dphaener
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -84,6 +84,34 @@ dependencies:
|
|
84
84
|
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '1.0'
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: webmock
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.0'
|
94
|
+
type: :runtime
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - "~>"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '1.0'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: sinatra
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '1.4'
|
108
|
+
type: :runtime
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '1.4'
|
87
115
|
- !ruby/object:Gem::Dependency
|
88
116
|
name: sqlite3
|
89
117
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,20 +210,6 @@ dependencies:
|
|
182
210
|
- - "~>"
|
183
211
|
- !ruby/object:Gem::Version
|
184
212
|
version: '0.0'
|
185
|
-
- !ruby/object:Gem::Dependency
|
186
|
-
name: webmock
|
187
|
-
requirement: !ruby/object:Gem::Requirement
|
188
|
-
requirements:
|
189
|
-
- - "~>"
|
190
|
-
- !ruby/object:Gem::Version
|
191
|
-
version: '1.0'
|
192
|
-
type: :development
|
193
|
-
prerelease: false
|
194
|
-
version_requirements: !ruby/object:Gem::Requirement
|
195
|
-
requirements:
|
196
|
-
- - "~>"
|
197
|
-
- !ruby/object:Gem::Version
|
198
|
-
version: '1.0'
|
199
213
|
- !ruby/object:Gem::Dependency
|
200
214
|
name: pry-rails
|
201
215
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,6 +258,34 @@ dependencies:
|
|
244
258
|
- - "~>"
|
245
259
|
- !ruby/object:Gem::Version
|
246
260
|
version: '0.16'
|
261
|
+
- !ruby/object:Gem::Dependency
|
262
|
+
name: capybara
|
263
|
+
requirement: !ruby/object:Gem::Requirement
|
264
|
+
requirements:
|
265
|
+
- - "~>"
|
266
|
+
- !ruby/object:Gem::Version
|
267
|
+
version: '1.1'
|
268
|
+
type: :runtime
|
269
|
+
prerelease: false
|
270
|
+
version_requirements: !ruby/object:Gem::Requirement
|
271
|
+
requirements:
|
272
|
+
- - "~>"
|
273
|
+
- !ruby/object:Gem::Version
|
274
|
+
version: '1.1'
|
275
|
+
- !ruby/object:Gem::Dependency
|
276
|
+
name: faker
|
277
|
+
requirement: !ruby/object:Gem::Requirement
|
278
|
+
requirements:
|
279
|
+
- - "~>"
|
280
|
+
- !ruby/object:Gem::Version
|
281
|
+
version: '1.4'
|
282
|
+
type: :runtime
|
283
|
+
prerelease: false
|
284
|
+
version_requirements: !ruby/object:Gem::Requirement
|
285
|
+
requirements:
|
286
|
+
- - "~>"
|
287
|
+
- !ruby/object:Gem::Version
|
288
|
+
version: '1.4'
|
247
289
|
description: Makes Rails play nice with Montage
|
248
290
|
email:
|
249
291
|
- dphaener@gmail.com
|
@@ -253,11 +295,17 @@ extra_rdoc_files: []
|
|
253
295
|
files:
|
254
296
|
- MIT-LICENSE
|
255
297
|
- Rakefile
|
298
|
+
- lib/generators/montage_rails/model_generator.rb
|
299
|
+
- lib/generators/montage_rails/templates/model.rb
|
300
|
+
- lib/generators/montage_rails/templates/resource.rb
|
301
|
+
- lib/generators/montage_rails/templates/test_data.rb
|
256
302
|
- lib/montage_rails.rb
|
303
|
+
- lib/montage_rails/application_resource.rb
|
257
304
|
- lib/montage_rails/base.rb
|
258
305
|
- lib/montage_rails/base/column.rb
|
259
306
|
- lib/montage_rails/errors.rb
|
260
307
|
- lib/montage_rails/log_subscriber.rb
|
308
|
+
- lib/montage_rails/mock_server.rb
|
261
309
|
- lib/montage_rails/query_cache.rb
|
262
310
|
- lib/montage_rails/railtie.rb
|
263
311
|
- lib/montage_rails/relation.rb
|
@@ -273,6 +321,8 @@ files:
|
|
273
321
|
- test/dummy/app/models/movie.rb
|
274
322
|
- test/dummy/app/models/studio.rb
|
275
323
|
- test/dummy/app/models/test.rb
|
324
|
+
- test/dummy/app/models/test_mod.rb
|
325
|
+
- test/dummy/app/models/test_one.rb
|
276
326
|
- test/dummy/app/views/layouts/application.html.erb
|
277
327
|
- test/dummy/bin/bundle
|
278
328
|
- test/dummy/bin/rails
|
@@ -309,14 +359,31 @@ files:
|
|
309
359
|
- test/dummy/public/422.html
|
310
360
|
- test/dummy/public/500.html
|
311
361
|
- test/dummy/public/favicon.ico
|
362
|
+
- test/dummy/test/fixtures/actors.yml
|
363
|
+
- test/dummy/test/fixtures/movies.yml
|
364
|
+
- test/dummy/test/fixtures/studios.yml
|
365
|
+
- test/dummy/test/fixtures/test_mods.yml
|
366
|
+
- test/dummy/test/fixtures/test_ones.yml
|
367
|
+
- test/dummy/test/models/actor_test.rb
|
368
|
+
- test/dummy/test/models/movie_test.rb
|
369
|
+
- test/dummy/test/models/studio_test.rb
|
370
|
+
- test/dummy/test/models/test_mod_test.rb
|
371
|
+
- test/dummy/test/models/test_one_test.rb
|
372
|
+
- test/dummy/test/montage_resources/actor_resource.rb
|
373
|
+
- test/dummy/test/montage_resources/movie_resource.rb
|
374
|
+
- test/dummy/test/montage_resources/studio_resource.rb
|
375
|
+
- test/dummy/test/montage_resources/test_data/actor_test_data.yml
|
376
|
+
- test/dummy/test/montage_resources/test_data/movie_test_data.yml
|
377
|
+
- test/dummy/test/montage_resources/test_data/studio_test_data.yml
|
378
|
+
- test/dummy/test/resources/test_mod_resource.rb
|
379
|
+
- test/dummy/test/resources/test_one_resource.rb
|
380
|
+
- test/dummy/test/test_helper.rb
|
381
|
+
- test/montage_rails/application_resource_test.rb
|
312
382
|
- test/montage_rails/base/column_test.rb
|
313
383
|
- test/montage_rails/base_test.rb
|
314
384
|
- test/montage_rails/query_cache_test.rb
|
315
385
|
- test/montage_rails/relation_test.rb
|
316
386
|
- test/montage_rails_test.rb
|
317
|
-
- test/resources/actor_resource.rb
|
318
|
-
- test/resources/movie_resource.rb
|
319
|
-
- test/resources/studio_resource.rb
|
320
387
|
- test/test_helper.rb
|
321
388
|
homepage: https://github.com/EditLLC/rails-montage
|
322
389
|
licenses:
|
@@ -351,6 +418,8 @@ test_files:
|
|
351
418
|
- test/dummy/app/models/movie.rb
|
352
419
|
- test/dummy/app/models/studio.rb
|
353
420
|
- test/dummy/app/models/test.rb
|
421
|
+
- test/dummy/app/models/test_mod.rb
|
422
|
+
- test/dummy/app/models/test_one.rb
|
354
423
|
- test/dummy/app/views/layouts/application.html.erb
|
355
424
|
- test/dummy/bin/bundle
|
356
425
|
- test/dummy/bin/rails
|
@@ -389,12 +458,29 @@ test_files:
|
|
389
458
|
- test/dummy/public/favicon.ico
|
390
459
|
- test/dummy/Rakefile
|
391
460
|
- test/dummy/README.rdoc
|
461
|
+
- test/dummy/test/fixtures/actors.yml
|
462
|
+
- test/dummy/test/fixtures/movies.yml
|
463
|
+
- test/dummy/test/fixtures/studios.yml
|
464
|
+
- test/dummy/test/fixtures/test_mods.yml
|
465
|
+
- test/dummy/test/fixtures/test_ones.yml
|
466
|
+
- test/dummy/test/models/actor_test.rb
|
467
|
+
- test/dummy/test/models/movie_test.rb
|
468
|
+
- test/dummy/test/models/studio_test.rb
|
469
|
+
- test/dummy/test/models/test_mod_test.rb
|
470
|
+
- test/dummy/test/models/test_one_test.rb
|
471
|
+
- test/dummy/test/montage_resources/actor_resource.rb
|
472
|
+
- test/dummy/test/montage_resources/movie_resource.rb
|
473
|
+
- test/dummy/test/montage_resources/studio_resource.rb
|
474
|
+
- test/dummy/test/montage_resources/test_data/actor_test_data.yml
|
475
|
+
- test/dummy/test/montage_resources/test_data/movie_test_data.yml
|
476
|
+
- test/dummy/test/montage_resources/test_data/studio_test_data.yml
|
477
|
+
- test/dummy/test/resources/test_mod_resource.rb
|
478
|
+
- test/dummy/test/resources/test_one_resource.rb
|
479
|
+
- test/dummy/test/test_helper.rb
|
480
|
+
- test/montage_rails/application_resource_test.rb
|
392
481
|
- test/montage_rails/base/column_test.rb
|
393
482
|
- test/montage_rails/base_test.rb
|
394
483
|
- test/montage_rails/query_cache_test.rb
|
395
484
|
- test/montage_rails/relation_test.rb
|
396
485
|
- test/montage_rails_test.rb
|
397
|
-
- test/resources/actor_resource.rb
|
398
|
-
- test/resources/movie_resource.rb
|
399
|
-
- test/resources/studio_resource.rb
|
400
486
|
- test/test_helper.rb
|
@@ -1,141 +0,0 @@
|
|
1
|
-
module MontageRails
|
2
|
-
class ActorResource
|
3
|
-
def self.schema_definition
|
4
|
-
{
|
5
|
-
name: "actors",
|
6
|
-
fields: [
|
7
|
-
{
|
8
|
-
name: "movie_id",
|
9
|
-
datatype: "text",
|
10
|
-
indexed: false,
|
11
|
-
required: false
|
12
|
-
},
|
13
|
-
{
|
14
|
-
name: "name",
|
15
|
-
datatype: "text",
|
16
|
-
indexed: false,
|
17
|
-
required: true
|
18
|
-
}
|
19
|
-
],
|
20
|
-
links: {
|
21
|
-
self: "http://testco.dev.montagehot.club/api/v1/schemas/actors/",
|
22
|
-
query: "http://testco.dev.montagehot.club/api/v1/schemas/actors/query/",
|
23
|
-
create_document: "http://testco.dev.montagehot.club/api/v1/schemas/actors/save/"
|
24
|
-
}
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.steve_martin
|
29
|
-
{
|
30
|
-
movie_id: "69cc93af-1f0e-43bc-ac9a-19117111978e",
|
31
|
-
name: "Steve Martin"
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.mark_hamill
|
36
|
-
{
|
37
|
-
movie_id: nil,
|
38
|
-
name: "Mark Hamill"
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.save_steve_response
|
43
|
-
{
|
44
|
-
data: [
|
45
|
-
{
|
46
|
-
id: "2b427e93-4809-425b-a587-e309a4715e8f",
|
47
|
-
_meta: {
|
48
|
-
modified: "2015-04-20T18:39:53.628Z",
|
49
|
-
created: "2015-04-20T18:39:53.628Z"
|
50
|
-
},
|
51
|
-
movie_id: "69cc93af-1f0e-43bc-ac9a-19117111978e",
|
52
|
-
name: "Steve Martin"
|
53
|
-
}
|
54
|
-
]
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.save_mark_response
|
59
|
-
{
|
60
|
-
data: [
|
61
|
-
{
|
62
|
-
id: "d8332c5b-71a9-423d-8bc8-9d956e7257a4",
|
63
|
-
_meta: {
|
64
|
-
modified: "2015-04-20T18:39:53.962Z",
|
65
|
-
created: "2015-04-20T18:39:53.962Z"
|
66
|
-
},
|
67
|
-
movie_id: "",
|
68
|
-
name: "Mark Hamill"
|
69
|
-
}
|
70
|
-
]
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.query
|
75
|
-
{
|
76
|
-
filter: {
|
77
|
-
movie_id: "69cc93af-1f0e-43bc-ac9a-19117111978e" ,
|
78
|
-
name: "Steve Martin"
|
79
|
-
},
|
80
|
-
limit: 1
|
81
|
-
}
|
82
|
-
end
|
83
|
-
|
84
|
-
def self.query_result
|
85
|
-
{
|
86
|
-
data: [
|
87
|
-
{
|
88
|
-
id: "2b427e93-4809-425b-a587-e309a4715e8f",
|
89
|
-
_meta: {
|
90
|
-
modified: "2015-04-20T18:39:53.628Z",
|
91
|
-
created: "2015-04-20T18:39:53.628Z"
|
92
|
-
},
|
93
|
-
movie_id: "69cc93af-1f0e-43bc-ac9a-19117111978e",
|
94
|
-
name: "Steve Martin"
|
95
|
-
}
|
96
|
-
],
|
97
|
-
cursors: {
|
98
|
-
previous: nil,
|
99
|
-
next: nil
|
100
|
-
}
|
101
|
-
}
|
102
|
-
end
|
103
|
-
|
104
|
-
def self.relation_query
|
105
|
-
{
|
106
|
-
filter: {
|
107
|
-
movie_id: "69cc93af-1f0e-43bc-ac9a-19117111978e"
|
108
|
-
}
|
109
|
-
}
|
110
|
-
end
|
111
|
-
|
112
|
-
def self.relation_response
|
113
|
-
{
|
114
|
-
data: [
|
115
|
-
{
|
116
|
-
id: "2b427e93-4809-425b-a587-e309a4715e8f",
|
117
|
-
_meta: {
|
118
|
-
modified: "2015-04-20T18:39:53.628Z",
|
119
|
-
created: "2015-04-20T18:39:53.628Z"
|
120
|
-
},
|
121
|
-
movie_id: "69cc93af-1f0e-43bc-ac9a-19117111978e",
|
122
|
-
name: "Steve Martin"
|
123
|
-
}
|
124
|
-
],
|
125
|
-
cursors: {
|
126
|
-
previous: nil,
|
127
|
-
next: nil
|
128
|
-
}
|
129
|
-
}
|
130
|
-
end
|
131
|
-
|
132
|
-
def self.relation_first_query
|
133
|
-
{
|
134
|
-
filter: {
|
135
|
-
movie_id: "69cc93af-1f0e-43bc-ac9a-19117111978e"
|
136
|
-
},
|
137
|
-
limit: 1
|
138
|
-
}
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|