Sha256: 634b379f692130811e0cc583a6ee1f2c23d0a9103e274ab39201a0bd21f1a6ea

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe DiscourseApi::API::UserActions do
  subject { DiscourseApi::Client.new("#{host}", "test_d7fd0429940", "test_user") }

  describe "#user_replies" do
    before do
      stub_get("#{host}/user_actions.json?username=testuser&filter=5").to_return(body: fixture("replies.json"), headers: { content_type: "application/json" })
    end

    it "requests the correct resource" do
      subject.user_replies("testuser")
      expect(a_get("#{host}/user_actions.json?username=testuser&filter=5")).to have_been_made
    end

    it "returns the requested user" do
      replies = subject.user_replies("testuser")
      expect(replies).to be_an Array
    end
  end

  describe "#user_topics_and_replies" do
    before do
      stub_get("#{host}/user_actions.json?username=testuser&filter=4,5").to_return(body: fixture("replies_and_topics.json"), headers: { content_type: "application/json" })
    end

    it "requests the correct resource" do
      subject.user_topics_and_replies("testuser")
      expect(a_get("#{host}/user_actions.json?username=testuser&filter=4,5")).to have_been_made
    end

    it "returns the requested user" do
      replies = subject.user_topics_and_replies("testuser")
      expect(replies).to be_an Array
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
discourse_api-0.39.3 spec/discourse_api/api/user_actions_spec.rb
discourse_api-0.39.2 spec/discourse_api/api/user_actions_spec.rb
discourse_api-0.39.1 spec/discourse_api/api/user_actions_spec.rb
discourse_api-0.39.0 spec/discourse_api/api/user_actions_spec.rb
discourse_api-0.38.0 spec/discourse_api/api/user_actions_spec.rb