Sha256: 8eec04ece6cec829c1126798732a211223e0a0fa026a1119749c0aca2b1f6899

Contents?: true

Size: 518 Bytes

Versions: 8

Compression:

Stored size: 518 Bytes

Contents

module SurveyGizmoSpec
  module Methods
    def stub_api_call(method, result = true)
      stub_request(method, /#{@base}/).to_return(json_response(result, {}))
    end

    def request_params(opts = {})
      {"user:pass" => 'test@test.com:password'}.merge(opts)
    end

    def json_response(result, data)
      body = {:result_ok => result}
      result ? body.merge!(:data => data) : body.merge!(:message => data)
      {:headers => {'Content-Type' => 'application/json'}, :body => body.to_json}
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
survey-gizmo-ruby-1.0.5 spec/support/methods.rb
survey-gizmo-ruby-1.0.4 spec/support/methods.rb
survey-gizmo-ruby-1.0.3 spec/support/methods.rb
survey-gizmo-ruby-1.0.1 spec/support/methods.rb
survey-gizmo-ruby-0.9.6 spec/support/methods.rb
survey-gizmo-ruby-0.7.1 spec/support/methods.rb
survey-gizmo-ruby-0.7.0 spec/support/methods.rb
survey-gizmo-ruby-0.6.0 spec/support/methods.rb