Module: CollectiveData::TestHelper

Defined in:
lib/collective_data/test_helper.rb

Instance Method Summary collapse

Instance Method Details

#collective_data_response_path(response_file) ⇒ Object



14
15
16
17
18
# File 'lib/collective_data/test_helper.rb', line 14

def collective_data_response_path(response_file)
  file = File.expand_path(File.join(File.dirname(__FILE__), "..", "..","features", "support", "fixtures", "#{response_file}.json"))
  raise "Unknown response file" unless File.exist?(file)
  file
end

#fake_collective_data_request(request_type, response_file) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/collective_data/test_helper.rb', line 4

def fake_collective_data_request(request_type, response_file)
  case request_type
  when :npi
    FakeWeb.register_uri :get, "#{Provider.site}#{Provider.prefix}providers/#{response_file}.json",
     :body => collective_data_response_path(response_file)
  else
    raise "Unable to fake this data request."
  end
end