Sha256: 06c1aa8be4a2afc329df6c04e9023fb6f760fea9e12bf129eb92bb438ce049b5

Contents?: true

Size: 797 Bytes

Versions: 4

Compression:

Stored size: 797 Bytes

Contents

require 'spec_helper'

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

  describe "#notifications" do

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

4 entries across 4 versions & 1 rubygems

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