26 lines
682 B
Ruby
26 lines
682 B
Ruby
# 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
|
|
|
|
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
|
|
|
|
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 |