Top Level Namespace
Defined Under Namespace
Modules: Scenarios Classes: ScenarioDB, ScenarioServer
Instance Method Summary collapse
- #default?(name) ⇒ Boolean
- #get_fixture(route_type, path, scenario_name) ⇒ Object
- #valid_scenario(scenario_name) ⇒ Object
- #validate_json_string(fixture) ⇒ Object
Instance Method Details
#default?(name) ⇒ Boolean
18 19 20 |
# File 'lib/scenarios/application/app_helpers.rb', line 18 def default?(name) name == "default" end |
#get_fixture(route_type, path, scenario_name) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/scenarios/application/app_helpers.rb', line 22 def get_fixture(route_type, path, scenario_name) status_code, header, fixture = self.scenario_db.get_fixture_from_routes(route_type, path, scenario_name) if fixture.nil? and default?(scenario_name) status_code, header, fixture = self.scenario_db.get_fixture_from_routes(route_type, path, 'default') end if status_code == nil status_code = 200 end return status_code, header, fixture end |
#valid_scenario(scenario_name) ⇒ Object
13 14 15 16 |
# File 'lib/scenarios/application/app_helpers.rb', line 13 def valid_scenario (scenario_name) scenarios = self.scenario_db.get_scenario_names scenarios.include?(scenario_name) end |
#validate_json_string(fixture) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/scenarios/application/app_helpers.rb', line 4 def validate_json_string (fixture) begin data = JSON.parse(fixture) return true rescue JSON::ParserError => e return false end end |