Using a JSON file with FakeWeb

Tagged with FakeWeb JSON Rails

Language: Ruby

View as text

FakeWeb.register_uri(:get, "{keyword}",
                     :string => JSON.parse("#{RAILS_ROOT}/test/files/search/#{keyword}.json").read))
Original snippet written by Christopher Warren
Last updated at 19:36 PM on Feb 02, 2009 by Christopher Warren

SnippetStash costs money to host and develop. The service is free for everyone to use
but if you found it useful please consider making a small donation.