Sha256: 3627c0e5c434a9abca457bda6bd81e859249da450ea5c5ed41997e2c87a71c71

Contents?: true

Size: 893 Bytes

Versions: 50

Compression:

Stored size: 893 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?api_key=test_d7fd0429940&api_username=test_user").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?api_key=test_d7fd0429940&api_username=test_user")).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

50 entries across 50 versions & 1 rubygems

Version Path
discourse_api-0.33.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.32.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.31.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.30.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.29.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.28.1 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.28.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.27.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.26.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.25.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.24.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.23.1 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.23.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.22.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.20.1 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.20.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.19.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.18.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.17.0 spec/discourse_api/api/notifications_spec.rb
discourse_api-0.16.1 spec/discourse_api/api/notifications_spec.rb