Sha256: 9dc6ba7de043f25ffcd483d3d6bcd37df8a6b41c7501b93ad174e9e46405df18

Contents?: true

Size: 429 Bytes

Versions: 36

Compression:

Stored size: 429 Bytes

Contents

module SurveyGizmoSpec
  module Methods
    def stub_api_call(method, result = true)
      stub_request(method, /#{@base}/).to_return(json_response(result, {}))
    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

36 entries across 36 versions & 1 rubygems

Version Path
survey-gizmo-ruby-8.0.0 spec/support/methods.rb
survey-gizmo-ruby-7.1.1 spec/support/methods.rb
survey-gizmo-ruby-7.1.0 spec/support/methods.rb
survey-gizmo-ruby-7.0.0 spec/support/methods.rb
survey-gizmo-ruby-6.7.0 spec/support/methods.rb
survey-gizmo-ruby-6.6.0 spec/support/methods.rb
survey-gizmo-ruby-6.5.1 spec/support/methods.rb
survey-gizmo-ruby-6.5.0 spec/support/methods.rb
survey-gizmo-ruby-6.4.1 spec/support/methods.rb
survey-gizmo-ruby-6.4.0 spec/support/methods.rb
survey-gizmo-ruby-6.3.2 spec/support/methods.rb
survey-gizmo-ruby-6.3.1 spec/support/methods.rb
survey-gizmo-ruby-6.3.0 spec/support/methods.rb
survey-gizmo-ruby-6.2.13 spec/support/methods.rb
survey-gizmo-ruby-6.2.12 spec/support/methods.rb
survey-gizmo-ruby-6.2.11 spec/support/methods.rb
survey-gizmo-ruby-6.2.10 spec/support/methods.rb
survey-gizmo-ruby-6.2.9 spec/support/methods.rb
survey-gizmo-ruby-6.2.6 spec/support/methods.rb
survey-gizmo-ruby-6.2.5 spec/support/methods.rb