Sha256: f760221f9c1b98a66b23615d497be4d5364e03b11fecc40d4ed1188608615bf5

Contents?: true

Size: 954 Bytes

Versions: 17

Compression:

Stored size: 954 Bytes

Contents

require 'spec_helper'

describe LHC do
  context 'GET' do
    before do
      stub_request(:get, "http://datastore/v2/feedbacks").to_return(status: 200, body: "{}")
    end
    it "is able to call .request without LHC raising NoMethodError: undefined method `blank?' for nil:NilClass when calling it outside of the rails context" do
      expect { LHC.request(url: "http://datastore/v2/feedbacks", method: :get) }.not_to raise_error
    end
  end

  context 'POST' do
    before do
      stub_request(:post, "http://datastore/v2/feedbacks").to_return(status: 200, body: "{}")
    end

    it "is able to call .request without LHC raising NoMethodError: undefined method `deep_symbolize_keys' for {}:Hash" do
      options = {
        url: "http://datastore/v2/feedbacks",
        method: :post,
        body: {},
        headers: { 'Content-Type' => 'application/json' }
      }
      expect { LHC.request(options) }.not_to raise_error
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
lhc-10.1.0 spec/basic_methods/request_without_rails_spec.rb
lhc-10.0.2 spec/basic_methods/request_without_rails_spec.rb
lhc-9.4.4 spec/basic_methods/request_without_rails_spec.rb
lhc-10.0.1 spec/basic_methods/request_without_rails_spec.rb
lhc-10.0.0 spec/basic_methods/request_without_rails_spec.rb
lhc-9.4.3 spec/basic_methods/request_without_rails_spec.rb
lhc-9.4.2 spec/basic_methods/request_without_rails_spec.rb
lhc-9.4.1 spec/basic_methods/request_without_rails_spec.rb
lhc-9.4.0 spec/basic_methods/request_without_rails_spec.rb
lhc-9.3.1 spec/basic_methods/request_without_rails_spec.rb
lhc-9.3.0 spec/basic_methods/request_without_rails_spec.rb
lhc-9.2.0 spec/basic_methods/request_without_rails_spec.rb
lhc-9.1.2 spec/basic_methods/request_without_rails_spec.rb
lhc-9.1.2.pre spec/basic_methods/request_without_rails_spec.rb
lhc-9.1.1 spec/basic_methods/request_without_rails_spec.rb
lhc-9.1.0 spec/basic_methods/request_without_rails_spec.rb
lhc-9.0.0 spec/basic_methods/request_without_rails_spec.rb