montage_rails 0.3.2 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +28 -0
  4. data/lib/montage_rails/base/column.rb +57 -0
  5. data/lib/montage_rails/base.rb +406 -0
  6. data/lib/montage_rails/errors.rb +7 -0
  7. data/lib/montage_rails/log_subscriber.rb +48 -0
  8. data/lib/montage_rails/query_cache.rb +44 -0
  9. data/lib/montage_rails/railtie.rb +0 -0
  10. data/lib/montage_rails/relation.rb +88 -0
  11. data/lib/montage_rails/version.rb +3 -0
  12. data/lib/montage_rails.rb +57 -0
  13. data/lib/tasks/montage_rails_tasks.rake +4 -0
  14. data/test/dummy/README.rdoc +28 -0
  15. data/test/dummy/Rakefile +6 -0
  16. data/test/dummy/app/assets/javascripts/application.js +13 -0
  17. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  18. data/test/dummy/app/controllers/application_controller.rb +5 -0
  19. data/test/dummy/app/helpers/application_helper.rb +2 -0
  20. data/test/dummy/app/models/actor.rb +3 -0
  21. data/test/dummy/app/models/movie.rb +30 -0
  22. data/test/dummy/app/models/studio.rb +3 -0
  23. data/test/dummy/app/models/test.rb +2 -0
  24. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  25. data/test/dummy/bin/bundle +3 -0
  26. data/test/dummy/bin/rails +4 -0
  27. data/test/dummy/bin/rake +4 -0
  28. data/test/dummy/bin/setup +29 -0
  29. data/test/dummy/config/application.rb +25 -0
  30. data/test/dummy/config/boot.rb +5 -0
  31. data/test/dummy/config/database.yml +25 -0
  32. data/test/dummy/config/environment.rb +5 -0
  33. data/test/dummy/config/environments/development.rb +41 -0
  34. data/test/dummy/config/environments/production.rb +79 -0
  35. data/test/dummy/config/environments/test.rb +42 -0
  36. data/test/dummy/config/initializers/assets.rb +11 -0
  37. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  39. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/test/dummy/config/initializers/inflections.rb +16 -0
  41. data/test/dummy/config/initializers/mime_types.rb +4 -0
  42. data/test/dummy/config/initializers/montage.rb +4 -0
  43. data/test/dummy/config/initializers/session_store.rb +3 -0
  44. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/test/dummy/config/locales/en.yml +23 -0
  46. data/test/dummy/config/routes.rb +56 -0
  47. data/test/dummy/config/secrets.yml +22 -0
  48. data/test/dummy/config.ru +4 -0
  49. data/test/dummy/db/development.sqlite3 +0 -0
  50. data/test/dummy/db/schema.rb +16 -0
  51. data/test/dummy/db/test.sqlite3 +0 -0
  52. data/test/dummy/log/RAILS_ENV=development.log +0 -0
  53. data/test/dummy/log/development.log +1038 -0
  54. data/test/dummy/log/test.log +12368 -0
  55. data/test/dummy/public/404.html +67 -0
  56. data/test/dummy/public/422.html +67 -0
  57. data/test/dummy/public/500.html +66 -0
  58. data/test/dummy/public/favicon.ico +0 -0
  59. data/test/montage_rails/base/column_test.rb +59 -0
  60. data/test/montage_rails/base_test.rb +375 -0
  61. data/test/montage_rails/query_cache_test.rb +68 -0
  62. data/test/montage_rails/relation_test.rb +114 -0
  63. data/test/montage_rails_test.rb +97 -0
  64. data/test/resources/actor_resource.rb +141 -0
  65. data/test/resources/movie_resource.rb +160 -0
  66. data/test/resources/studio_resource.rb +56 -0
  67. data/test/test_helper.rb +196 -0
  68. metadata +123 -3
@@ -0,0 +1,196 @@
1
+ require 'simplecov'
2
+
3
+ SimpleCov.start do
4
+ if ENV['CI']=='true'
5
+ require 'codecov'
6
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
7
+ end
8
+ end
9
+
10
+ # Configure Rails Environment
11
+ ENV["RAILS_ENV"] = "test"
12
+
13
+ require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
14
+ ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
15
+ require "rails/test_help"
16
+ require "rails/all"
17
+
18
+ # Filter out Minitest backtrace while allowing backtrace from other libraries
19
+ # to be shown.
20
+ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
21
+
22
+ # Load support files
23
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
24
+
25
+ # Load resource helpers
26
+ Dir[File.join(File.dirname(__FILE__), 'resources', '**', '*.rb')].each do |file|
27
+ require file
28
+ end
29
+
30
+ require 'minitest/autorun'
31
+ require 'shoulda-context'
32
+ require 'mocha/setup'
33
+ require 'webmock/minitest'
34
+
35
+ WebMock.disable_net_connect!(:allow => "codecov.io")
36
+
37
+ class MiniTest::Test
38
+ @@default_headers = {
39
+ 'Accept' => '*/*',
40
+ 'Authorization' => 'Token fb761e07-a12b-40bb-a42f-2202ecfd1046',
41
+ 'Content-Type' => 'application/json',
42
+ 'User-Agent' => "Montage Ruby v#{Montage::VERSION}"
43
+ }
44
+
45
+ def setup
46
+ # Stub the request for getting the movie schema definition
47
+ #
48
+ stub_request(:get, "http://testco.dev.montagehot.club/api/v1/schemas/movies/")
49
+ .with(headers: @@default_headers).to_return(
50
+ status: 200,
51
+ body: MontageRails::MovieResource.schema_definition.to_json,
52
+ headers: {
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 request for getting the actor schema definition
82
+ #
83
+ stub_request(:get, "http://testco.dev.montagehot.club/api/v1/schemas/actors/")
84
+ .with(headers: @@default_headers).to_return(
85
+ status: 200,
86
+ body: MontageRails::ActorResource.schema_definition.to_json,
87
+ headers: {
88
+ 'Content-Type' => 'application/json'
89
+ }
90
+ )
91
+
92
+ # Stub the creation of Steve Martin
93
+ #
94
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/save/").
95
+ with(body: [ MontageRails::ActorResource.steve_martin ].to_json, headers: @@default_headers).to_return(
96
+ body: MontageRails::ActorResource.save_steve_response.to_json,
97
+ headers: { 'Content-Type' => 'application/json' }
98
+ )
99
+
100
+ # Stub the creation of Mark Hamill
101
+ #
102
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/save/").
103
+ with(body: [ MontageRails::ActorResource.mark_hamill ].to_json, headers: @@default_headers).to_return(
104
+ body: MontageRails::ActorResource.save_mark_response.to_json,
105
+ headers: { 'Content-Type' => 'application/json' }
106
+ )
107
+
108
+ # Stub the actor query
109
+ #
110
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/query/").
111
+ with(body: MontageRails::ActorResource.query.to_json, headers: @@default_headers).to_return(
112
+ body: MontageRails::ActorResource.query_result.to_json,
113
+ headers: { 'Content-Type' => 'application/json'}
114
+ )
115
+
116
+ # Stub the movie query
117
+ #
118
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
119
+ with(body: MontageRails::MovieResource.movie_query.to_json, headers: @@default_headers).to_return(
120
+ body: MontageRails::MovieResource.query_result.to_json,
121
+ headers: { 'Content-Type' => 'application/json'}
122
+ )
123
+
124
+ # Stub the movie relation query for actors
125
+ #
126
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/query/").
127
+ with(body: MontageRails::ActorResource.relation_query.to_json, headers: @@default_headers).to_return(
128
+ body: MontageRails::ActorResource.relation_response.to_json,
129
+ headers: { 'Content-Type' => 'application/json'}
130
+ )
131
+
132
+ # Stub the movie relation query for getting the first actor
133
+ #
134
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/actors/query/").
135
+ with(body: MontageRails::ActorResource.relation_first_query.to_json, headers: @@default_headers).to_return(
136
+ body: MontageRails::ActorResource.relation_response.to_json,
137
+ headers: { 'Content-Type' => 'application/json'}
138
+ )
139
+
140
+ # Stub the schema definition request for studios
141
+ #
142
+ stub_request(:get, "http://testco.dev.montagehot.club/api/v1/schemas/studios/").
143
+ with(headers: @@default_headers).to_return(
144
+ body: MontageRails::StudioResource.schema_definition.to_json,
145
+ headers: { 'Content-Type' => 'application/json' }
146
+ )
147
+
148
+ # Stub the save studio action
149
+ #
150
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/studios/save/").
151
+ with(body: [ MontageRails::StudioResource.to_hash ].to_json, headers: @@default_headers).to_return(
152
+ body: MontageRails::StudioResource.save_response.to_json,
153
+ headers: { 'Content-Type' => 'application/json' }
154
+ )
155
+
156
+ # Stub the get studio response
157
+ #
158
+ stub_request(:get, "http://testco.dev.montagehot.club/api/v1/schemas/studios/19442e09-5c2d-4e5d-8f34-675570e81414/").
159
+ with(headers: @@default_headers).to_return(
160
+ body: MontageRails::StudioResource.get_studio_response.to_json,
161
+ headers: { 'Content-Type' => 'applicaiton/json' }
162
+ )
163
+
164
+ # Stub the find by query for movies
165
+ #
166
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
167
+ with(body: MontageRails::MovieResource.find_movie_query.to_json, headers: @@default_headers).to_return(
168
+ body: MontageRails::MovieResource.query_result.to_json,
169
+ headers: { 'Content-Type' => 'application/json' }
170
+ )
171
+
172
+ # Stub the find by query for movies that returns no results
173
+ #
174
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
175
+ with(body: MontageRails::MovieResource.movie_not_found_query.to_json, headers: @@default_headers).to_return(
176
+ body: { data: [] }.to_json,
177
+ headers: { 'Content-Type' => 'application/json' }
178
+ )
179
+
180
+ # Stub the all query for movies
181
+ #
182
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
183
+ with(body: MontageRails::MovieResource.all_movies_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 greater than relation
189
+ #
190
+ stub_request(:post, "http://testco.dev.montagehot.club/api/v1/schemas/movies/query/").
191
+ with(body: MontageRails::MovieResource.gt_query.to_json, headers: @@default_headers).to_return(
192
+ body: MontageRails::MovieResource.query_result.to_json,
193
+ headers: { 'Content-Type' => 'application/json' }
194
+ )
195
+ end
196
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: montage_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dphaener
@@ -250,7 +250,73 @@ email:
250
250
  executables: []
251
251
  extensions: []
252
252
  extra_rdoc_files: []
253
- files: []
253
+ files:
254
+ - MIT-LICENSE
255
+ - Rakefile
256
+ - lib/montage_rails.rb
257
+ - lib/montage_rails/base.rb
258
+ - lib/montage_rails/base/column.rb
259
+ - lib/montage_rails/errors.rb
260
+ - lib/montage_rails/log_subscriber.rb
261
+ - lib/montage_rails/query_cache.rb
262
+ - lib/montage_rails/railtie.rb
263
+ - lib/montage_rails/relation.rb
264
+ - lib/montage_rails/version.rb
265
+ - lib/tasks/montage_rails_tasks.rake
266
+ - test/dummy/README.rdoc
267
+ - test/dummy/Rakefile
268
+ - test/dummy/app/assets/javascripts/application.js
269
+ - test/dummy/app/assets/stylesheets/application.css
270
+ - test/dummy/app/controllers/application_controller.rb
271
+ - test/dummy/app/helpers/application_helper.rb
272
+ - test/dummy/app/models/actor.rb
273
+ - test/dummy/app/models/movie.rb
274
+ - test/dummy/app/models/studio.rb
275
+ - test/dummy/app/models/test.rb
276
+ - test/dummy/app/views/layouts/application.html.erb
277
+ - test/dummy/bin/bundle
278
+ - test/dummy/bin/rails
279
+ - test/dummy/bin/rake
280
+ - test/dummy/bin/setup
281
+ - test/dummy/config.ru
282
+ - test/dummy/config/application.rb
283
+ - test/dummy/config/boot.rb
284
+ - test/dummy/config/database.yml
285
+ - test/dummy/config/environment.rb
286
+ - test/dummy/config/environments/development.rb
287
+ - test/dummy/config/environments/production.rb
288
+ - test/dummy/config/environments/test.rb
289
+ - test/dummy/config/initializers/assets.rb
290
+ - test/dummy/config/initializers/backtrace_silencers.rb
291
+ - test/dummy/config/initializers/cookies_serializer.rb
292
+ - test/dummy/config/initializers/filter_parameter_logging.rb
293
+ - test/dummy/config/initializers/inflections.rb
294
+ - test/dummy/config/initializers/mime_types.rb
295
+ - test/dummy/config/initializers/montage.rb
296
+ - test/dummy/config/initializers/session_store.rb
297
+ - test/dummy/config/initializers/wrap_parameters.rb
298
+ - test/dummy/config/locales/en.yml
299
+ - test/dummy/config/routes.rb
300
+ - test/dummy/config/secrets.yml
301
+ - test/dummy/db/development.sqlite3
302
+ - test/dummy/db/schema.rb
303
+ - test/dummy/db/test.sqlite3
304
+ - test/dummy/log/RAILS_ENV=development.log
305
+ - test/dummy/log/development.log
306
+ - test/dummy/log/test.log
307
+ - test/dummy/public/404.html
308
+ - test/dummy/public/422.html
309
+ - test/dummy/public/500.html
310
+ - test/dummy/public/favicon.ico
311
+ - test/montage_rails/base/column_test.rb
312
+ - test/montage_rails/base_test.rb
313
+ - test/montage_rails/query_cache_test.rb
314
+ - test/montage_rails/relation_test.rb
315
+ - test/montage_rails_test.rb
316
+ - test/resources/actor_resource.rb
317
+ - test/resources/movie_resource.rb
318
+ - test/resources/studio_resource.rb
319
+ - test/test_helper.rb
254
320
  homepage: https://github.com/EditLLC/rails-montage
255
321
  licenses:
256
322
  - MIT
@@ -275,4 +341,58 @@ rubygems_version: 2.4.5
275
341
  signing_key:
276
342
  specification_version: 4
277
343
  summary: Rails integration for the Ruby Montage API wrapper
278
- test_files: []
344
+ test_files:
345
+ - test/dummy/app/assets/javascripts/application.js
346
+ - test/dummy/app/assets/stylesheets/application.css
347
+ - test/dummy/app/controllers/application_controller.rb
348
+ - test/dummy/app/helpers/application_helper.rb
349
+ - test/dummy/app/models/actor.rb
350
+ - test/dummy/app/models/movie.rb
351
+ - test/dummy/app/models/studio.rb
352
+ - test/dummy/app/models/test.rb
353
+ - test/dummy/app/views/layouts/application.html.erb
354
+ - test/dummy/bin/bundle
355
+ - test/dummy/bin/rails
356
+ - test/dummy/bin/rake
357
+ - test/dummy/bin/setup
358
+ - test/dummy/config/application.rb
359
+ - test/dummy/config/boot.rb
360
+ - test/dummy/config/database.yml
361
+ - test/dummy/config/environment.rb
362
+ - test/dummy/config/environments/development.rb
363
+ - test/dummy/config/environments/production.rb
364
+ - test/dummy/config/environments/test.rb
365
+ - test/dummy/config/initializers/assets.rb
366
+ - test/dummy/config/initializers/backtrace_silencers.rb
367
+ - test/dummy/config/initializers/cookies_serializer.rb
368
+ - test/dummy/config/initializers/filter_parameter_logging.rb
369
+ - test/dummy/config/initializers/inflections.rb
370
+ - test/dummy/config/initializers/mime_types.rb
371
+ - test/dummy/config/initializers/montage.rb
372
+ - test/dummy/config/initializers/session_store.rb
373
+ - test/dummy/config/initializers/wrap_parameters.rb
374
+ - test/dummy/config/locales/en.yml
375
+ - test/dummy/config/routes.rb
376
+ - test/dummy/config/secrets.yml
377
+ - test/dummy/config.ru
378
+ - test/dummy/db/development.sqlite3
379
+ - test/dummy/db/schema.rb
380
+ - test/dummy/db/test.sqlite3
381
+ - test/dummy/log/development.log
382
+ - test/dummy/log/RAILS_ENV=development.log
383
+ - test/dummy/log/test.log
384
+ - test/dummy/public/404.html
385
+ - test/dummy/public/422.html
386
+ - test/dummy/public/500.html
387
+ - test/dummy/public/favicon.ico
388
+ - test/dummy/Rakefile
389
+ - test/dummy/README.rdoc
390
+ - test/montage_rails/base/column_test.rb
391
+ - test/montage_rails/base_test.rb
392
+ - test/montage_rails/query_cache_test.rb
393
+ - test/montage_rails/relation_test.rb
394
+ - test/montage_rails_test.rb
395
+ - test/resources/actor_resource.rb
396
+ - test/resources/movie_resource.rb
397
+ - test/resources/studio_resource.rb
398
+ - test/test_helper.rb