Sha256: 593756153932543b9108de593d99d61b5a98ea5fdae833d60dc73e41f7039778

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

RSpec.describe "operation with documentation" do
  # see Test::Client definition in `/spec/support/test_client.rb`
  before do
    class Test::Client < Evil::Client
      operation do |settings|
        documentation "https://docs.example.com/v#{settings.version}/index.html"
        http_method :get
        path { "data" }
      end

      operation :clear_data
      operation :find_data do |settings|
        documentation "https://docs.example.com/v#{settings.version}/findData"
      end
    end

    stub_request(:any, //)
  end

  let(:client) { Test::Client.new("foo", version: 3, user: "bar") }

  it "displays default documentation in exception messages" do
    begin
      client.operations[:clear_data].call
    rescue => error
      expect(error.message).to include "https://docs.example.com/v3/index.html"
    else
      fail
    end
  end

  it "reloads default value with operation-specific one" do
    begin
      client.operations[:find_data].call
    rescue => error
      expect(error.message).to include "https://docs.example.com/v3/findData"
    else
      fail
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
evil-client-0.2.3 spec/features/operation_with_documentation_spec.rb
evil-client-0.2.2 spec/features/operation_with_documentation_spec.rb
evil-client-0.2.1 spec/features/operation_with_documentation_spec.rb