Sha256: 5a411a94c9b1ad5112e9e6f5d2439fc3608a2295d7d05864bb3ae663a70bb847

Contents?: true

Size: 755 Bytes

Versions: 5

Compression:

Stored size: 755 Bytes

Contents

require 'spec_helper'

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

  describe "#notifications" do

    before do
      stub_get("#{host}/notifications.json").to_return(body: fixture("notifications.json"), headers: { content_type: "application/json" })
    end

    it "requests the correct resource" do
      subject.notifications
      expect(a_get("#{host}/notifications.json")).to have_been_made
    end

    it "returns the requested notifications" do
      notifications = subject.notifications
      expect(notifications).to be_an Array
      expect(notifications.first).to be_an Hash
      expect(notifications[0]['notification_type']).to eq(9)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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