Sha256: e4f4781f27dc5ce4cf7c3ee8e8ba2bbabb259717e2173634e3ac387abb577891

Contents?: true

Size: 921 Bytes

Versions: 18

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

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

  describe "#get_post" do
    before do
      stub_get("http://localhost:3000/posts/11.json?api_key=test_d7fd0429940&api_username=test_user").to_return(body: fixture("post.json"), headers: { content_type: "application/json" })
    end

    it "fetches a post" do
      the_post = client.get_post(11)
      expect(the_post).to be_a Hash
      expect(the_post['id']).to eq(11)
    end
  end

  describe "#wikify_post" do
    before do
      stub_put("http://localhost:3000/posts/9999/wiki?api_key=test_d7fd0429940&api_username=test_user")
    end

    it "fails on unknown post" do
      client.wikify_post(9999)
      expect(a_put("http://localhost:3000/posts/9999/wiki?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made
    end
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
discourse_api-0.10.1 spec/discourse_api/api/posts_spec.rb
discourse_api-0.10.0 spec/discourse_api/api/posts_spec.rb
discourse_api-0.9.1 spec/discourse_api/api/posts_spec.rb
discourse_api-0.9.0 spec/discourse_api/api/posts_spec.rb
discourse_api-0.8.1 spec/discourse_api/api/posts_spec.rb
discourse_api-0.8.0 spec/discourse_api/api/posts_spec.rb
discourse_api-0.7.0 spec/discourse_api/api/posts_spec.rb
discourse_api-0.6.2 spec/discourse_api/api/posts_spec.rb
discourse_api-0.6.1 spec/discourse_api/api/posts_spec.rb
discourse_api-0.6.0 spec/discourse_api/api/posts_spec.rb
discourse_api-0.5.1 spec/discourse_api/api/posts_spec.rb
discourse_api-0.5.0 spec/discourse_api/api/posts_spec.rb
discourse_api-0.4.4 spec/discourse_api/api/posts_spec.rb
discourse_api-0.4.3 spec/discourse_api/api/posts_spec.rb
discourse_api-0.4.2 spec/discourse_api/api/posts_spec.rb
discourse_api-0.4.1 spec/discourse_api/api/posts_spec.rb
discourse_api-0.4.0 spec/discourse_api/api/posts_spec.rb
discourse_api-0.3.6 spec/discourse_api/api/posts_spec.rb