Sha256: 24b20d2ac9779af5a5d91a0f60081e40e43f62e2c60ba491cb812052c306a2c9

Contents?: true

Size: 1.43 KB

Versions: 44

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

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

  describe "#email_settings" do
    before do
      stub_get("http://localhost:3000/admin/email.json?api_key=test_d7fd0429940&api_username=test_user").to_return(body: fixture("email_settings.json"), headers: { content_type: "application/json" })
    end

    it "requests the correct resource" do
      subject.email_settings
      expect(a_get("http://localhost:3000/admin/email.json?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made
    end

    it "returns the requested settings" do
      settings = subject.email_settings
      expect(settings).to be_a Hash
      expect(settings).to have_key('delivery_method')
      expect(settings).to have_key('settings')
    end
  end

  describe "#list_email_all" do
    before do
      stub_get("http://localhost:3000/admin/email/all.json?api_key=test_d7fd0429940&api_username=test_user").to_return(body: fixture("email_list_all.json"), headers: { content_type: "application/json" })
    end

    it "requests the correct resource" do
      subject.list_email('all')
      expect(a_get("http://localhost:3000/admin/email/all.json?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made
    end

    it "returns all email" do
      all_email = subject.list_email('all')
      expect(all_email).to be_an Array
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

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