Sha256: 68e1c6e4712f2ff5bcea0f03cdc9bfa6393f8f13dfc1b9ec442bda0eb8cd399b

Contents?: true

Size: 832 Bytes

Versions: 9

Compression:

Stored size: 832 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.json?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.json?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

9 entries across 9 versions & 1 rubygems

Version Path
discourse_api-0.4.1 spec/discourse_api/api/search_spec.rb
discourse_api-0.4.0 spec/discourse_api/api/search_spec.rb
discourse_api-0.3.6 spec/discourse_api/api/search_spec.rb
discourse_api-0.3.0 spec/discourse_api/api/search_spec.rb
discourse_api-0.2.9 spec/discourse_api/api/search_spec.rb
discourse_api-0.2.8 spec/discourse_api/api/search_spec.rb
discourse_api-0.2.7 spec/discourse_api/api/search_spec.rb
discourse_api-0.2.5 spec/discourse_api/api/search_spec.rb
discourse_api-0.2.4 spec/discourse_api/api/search_spec.rb