Sha256: 51f470367e6f5afe86bed7131f4cac19623f84c1b21cb6c594db11896e5d09bc

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

# frozen_string_literal: true
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

2 entries across 2 versions & 1 rubygems

Version Path
discourse_api-2.0.1 spec/discourse_api/api/notifications_spec.rb
discourse_api-2.0.0 spec/discourse_api/api/notifications_spec.rb