Sha256: dc9c783670aa6ed0af232548047eb83e97a9062b46db11da81bdf64ec09f0304

Contents?: true

Size: 659 Bytes

Versions: 6

Compression:

Stored size: 659 Bytes

Contents

require 'json'
require_relative '../scenario_db'

def validate_json_string (fixture)
  begin
    data = JSON.parse(fixture)
    return true
  rescue JSON::ParserError => e
    return false
  end
end

def valid_scenario (scenario_name)
  scenarios = self.scenario_db.get_scenario_names
  scenarios.include?(scenario_name)
end

def default?(name)
  name == "default"
end

def get_fixture(route_type, path, scenario_name)
  fixture =   self.scenario_db.get_fixture_from_routes(route_type, path, scenario_name)

  if fixture.nil? and default?(scenario_name)
    fixture = self.scenario_db.get_fixture_from_routes(route_type, path, 'default')
  end

  fixture
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scenario_server-0.0.7 lib/scenarios/application/app_helpers.rb
scenario_server-0.0.6 lib/scenarios/application/app_helpers.rb
scenario_server-0.0.4 lib/scenarios/application/app_helpers.rb
scenario_server-0.0.3 lib/scenarios/application/app_helpers.rb
scenario_server-0.0.2 lib/scenarios/application/app_helpers.rb
scenario_server-0.0.1 lib/scenarios/application/app_helpers.rb