forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ams_spec_helper.rb
52 lines (43 loc) · 1.51 KB
/
ams_spec_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'text_helper'
require 'canvas/lock_explanation'
require 'active_model_serializers'
require 'action_controller'
require 'active_support'
require 'active_record'
require 'mocha/api'
require 'api'
# You can include just this file if your serializer doesn't need too much
# from the whole stack to run your tests faster!
module ActiveModel
class FakeController
if CANVAS_RAILS2
include ActionController::PolymorphicRoutes
include ActionController::UrlWriter
self.default_url_options[:host] = 'example.com'
else
include Rails.application.routes.url_helpers
def default_url_options
{ host: 'example.com' }
end
end
attr_accessor :accepts_jsonapi, :stringify_json_ids, :session, :context
def initialize(options={})
@accepts_jsonapi = options.fetch(:accepts_jsonapi, true)
@stringify_json_ids = options.fetch(:stringify_json_ids, true)
@session = options[:session]
@context = options[:context]
end
def accepts_jsonapi?
!!accepts_jsonapi
end
def stringify_json_ids?
!!stringify_json_ids
end
end
end
require File.expand_path(File.dirname(__FILE__)) + '/../app/serializers/canvas/api_serialization.rb'
require File.expand_path(File.dirname(__FILE__)) + '/../app/serializers/canvas/api_serializer.rb'
require File.expand_path(File.dirname(__FILE__)) + '/../app/serializers/canvas/api_array_serializer.rb'
Dir[File.expand_path(File.dirname(__FILE__) + '/../app/serializers/*.rb')].each do |file|
require file
end