Module: RubyPitaya::AppSpecHelper
- Included in:
- AppSpecHelperClass
- Defined in:
- lib/rubypitaya/core/spec-helpers/app_spec_helper.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_config(*keys, value) ⇒ Object
- #add_setup(*keys, value) ⇒ Object
- #authenticate(user_id) ⇒ Object
- #config ⇒ Object
- #initialize(context) ⇒ Object
- #log ⇒ Object
- #postman ⇒ Object
- #request(route, params = {}) ⇒ Object
- #response ⇒ Object
- #services ⇒ Object
- #session ⇒ Object
- #set_config(config) ⇒ Object
- #set_postman(postman) ⇒ Object
- #set_setup(setup) ⇒ Object
- #setup ⇒ Object
Class Method Details
.finalize_after_suite ⇒ Object
37 38 39 40 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 37 def self.finalize_after_suite clear_all_services_data disconnect_services end |
.initialize_before_suite ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 12 def self.initialize_before_suite default_setup = Setup.new.get_config default_config = ConfigCore.new @@log = Logger.new('/dev/null') @@setup = SetupSpecHelper.new(default_setup) @@config = ConfigSpecHelper.new(default_config) @@session = Session.new @@postman = PostmanSpecHelper.new @@services = ServiceHolder.new is_cheats_enabled = @@setup.fetch('rubypitaya.server.cheats', true) @@handler_router ||= HandlerRouter.new(is_cheats_enabled) @@initializer_content = InitializerContent.new(@@log, @@services, @@setup, @@config) @@initializer_broadcast = InitializerBroadcast.new @@initializer_broadcast.run(@@initializer_content) connect_services end |
.update_before_each ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 42 def self.update_before_each @@response = {} @@setup.clear @@config.clear @@session.clear clear_all_services_data end |
Instance Method Details
#add_config(*keys, value) ⇒ Object
86 87 88 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 86 def add_config(*keys, value) @@config.add(*keys, value) end |
#add_setup(*keys, value) ⇒ Object
90 91 92 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 90 def add_setup(*keys, value) @@setup.add(*keys, value) end |
#authenticate(user_id) ⇒ Object
70 71 72 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 70 def authenticate(user_id) @@session.uid = user_id end |
#config ⇒ Object
102 103 104 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 102 def config @@config end |
#initialize(context) ⇒ Object
50 51 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 50 def initialize(context) end |
#log ⇒ Object
94 95 96 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 94 def log @@log end |
#postman ⇒ Object
110 111 112 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 110 def postman @@postman end |
#request(route, params = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 53 def request(route, params = {}) handler_name, action_name = route.split('.')[1..-1] @@response = @@handler_router.call(handler_name, action_name, @@session, @@postman, @@services, @@setup, @@config, @@log, params) rescue RouteError => error @@response = { code: error.code, message: error. } end |
#response ⇒ Object
66 67 68 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 66 def response @@response end |
#services ⇒ Object
114 115 116 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 114 def services @@services end |
#session ⇒ Object
106 107 108 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 106 def session @@session end |
#set_config(config) ⇒ Object
74 75 76 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 74 def set_config(config) @@config.config_mock = config end |
#set_postman(postman) ⇒ Object
82 83 84 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 82 def set_postman(postman) @@postman.postman_mock = postman end |
#set_setup(setup) ⇒ Object
78 79 80 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 78 def set_setup(setup) @@setup.setup_mock = setup end |
#setup ⇒ Object
98 99 100 |
# File 'lib/rubypitaya/core/spec-helpers/app_spec_helper.rb', line 98 def setup @@setup end |