Sha256: bdb50afd090ca193cd0fdb6d38b5b20e9366c77a657a5de8d0d291e61e7c46f3

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

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

  describe "#user_replies" do
    before do
      stub_get("http://localhost:3000/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("http://localhost:3000/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("http://localhost:3000/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("http://localhost:3000/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

4 entries across 4 versions & 1 rubygems

Version Path
discourse_api-0.37.0 spec/discourse_api/api/user_actions_spec.rb
discourse_api-0.36.0 spec/discourse_api/api/user_actions_spec.rb
discourse_api-0.35.0 spec/discourse_api/api/user_actions_spec.rb
discourse_api-0.34.0 spec/discourse_api/api/user_actions_spec.rb