Sha256: 628b94830ac6fcf65ea847a80ea556f55290f0f1a534d82bca58617f609a381b

Contents?: true

Size: 834 Bytes

Versions: 14

Compression:

Stored size: 834 Bytes

Contents

require 'spec_helper'

describe DiscourseApi::API::Search do
  subject { DiscourseApi::Client.new("http://localhost:3000", "test_d7fd0429940", "test_user" )}

  describe "#search" do
    before do
      stub_get("http://localhost:3000/search/query?api_key=test_d7fd0429940&api_username=test_user").with(query: { term: "test"} ).to_return(body: fixture("search.json"), headers: { content_type: "application/json" })
    end

    it "requests the correct resource" do
      subject.search("test")
      expect(a_get("http://localhost:3000/search/query?api_key=test_d7fd0429940&api_username=test_user").with(query: { term: "test"} )).to have_been_made
    end

    it "returns the requested search" do
      results = subject.search("test")
      expect(results).to be_an Array
      expect(results.first).to be_a Hash
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
discourse_api-0.10.0 spec/discourse_api/api/search_spec.rb
discourse_api-0.9.1 spec/discourse_api/api/search_spec.rb
discourse_api-0.9.0 spec/discourse_api/api/search_spec.rb
discourse_api-0.8.1 spec/discourse_api/api/search_spec.rb
discourse_api-0.8.0 spec/discourse_api/api/search_spec.rb
discourse_api-0.7.0 spec/discourse_api/api/search_spec.rb
discourse_api-0.6.2 spec/discourse_api/api/search_spec.rb
discourse_api-0.6.1 spec/discourse_api/api/search_spec.rb
discourse_api-0.6.0 spec/discourse_api/api/search_spec.rb
discourse_api-0.5.1 spec/discourse_api/api/search_spec.rb
discourse_api-0.5.0 spec/discourse_api/api/search_spec.rb
discourse_api-0.4.4 spec/discourse_api/api/search_spec.rb
discourse_api-0.4.3 spec/discourse_api/api/search_spec.rb
discourse_api-0.4.2 spec/discourse_api/api/search_spec.rb