Sha256: 4174b6a02f71c74c5131a143dabd32e9cdf51f7ce0aa713057133d80b10f6a6e

Contents?: true

Size: 687 Bytes

Versions: 2

Compression:

Stored size: 687 Bytes

Contents

require 'spec_helper'

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

  describe "#search" do
    before do
      stub_get("http://localhost/search.json").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/search.json").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

2 entries across 2 versions & 1 rubygems

Version Path
discourse_api-0.1.2 spec/discourse_api/api/search_spec.rb
discourse_api-0.1.1 spec/discourse_api/api/search_spec.rb