2014-05-06 15:13:58 +00:00
|
|
|
# spec/support/fake_github.rb
|
|
|
|
require 'sinatra/base'
|
|
|
|
|
|
|
|
class FakeBetterVideo < Sinatra::Base
|
|
|
|
get '/orders/MDS.OrdersWS.svc/addVideo' do
|
|
|
|
json_response 200, 'bettervideo_0.json'
|
|
|
|
end
|
|
|
|
|
2014-05-06 16:20:19 +00:00
|
|
|
post '/orders/MDS.OrdersWS.svc/addVideo' do
|
|
|
|
if params.to_s.include? "videolistingmissing"
|
|
|
|
json_response 200, 'bettervideo_102.json'
|
|
|
|
elsif params.to_s.include? "contactdev"
|
|
|
|
json_response 200, 'bettervideo_1.json'
|
|
|
|
else
|
|
|
|
json_response 200, 'bettervideo_0.json'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-05-06 15:13:58 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def json_response(response_code, file_name)
|
|
|
|
content_type :json
|
|
|
|
status response_code
|
|
|
|
File.open(File.dirname(__FILE__) + '/fixtures/' + file_name, 'rb').read
|
|
|
|
end
|
|
|
|
end
|