Sha256: 44883d63fed1d053e431ac3975ae586de89815e6a93888da381b49e229374525

Contents?: true

Size: 1.39 KB

Versions: 12

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe Portal do

  before :each do
    stub_auth_request
  end

  context "/portal" do

    it "should return a new portal if the current user doesn't have one yet" do
      stub_api_get("/portal", "portal/my_non_existant.json")
      portal = Portal.my
      expect(portal.persisted?).to eq(false)
    end

    it "should get the current user's portal" do
      stub_api_get("/portal", "portal/my.json")
      portal = Portal.my
      expect(portal.persisted?).to eq(true)
    end

    it "should create a portal for the current user" do
      stub_api_post("/portal", "portal/new.json", "portal/post.json")
      portal = Portal.new({
        "DisplayName" => "GreatPortal",
        "Enabled" => true,
        "RequiredFields" => [ "Address", "Phone" ]
      })
      portal.save
    end

    it "should enable the current user's portal" do
      stub_api_get("/portal", "portal/my.json")
      s = stub_api_put("/portal/20100912153422758914000000", "portal/enable.json", "portal/post.json")
      portal = Portal.my
      portal.enable
      expect(s).to have_been_requested
    end

    it "should disable the current user's portal" do
      stub_api_get("/portal", "portal/my.json")
      s = stub_api_put("/portal/20100912153422758914000000", "portal/disable.json", "portal/post.json")
      portal = Portal.my
      portal.disable
      expect(s).to have_been_requested
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spark_api-1.6.3 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.6.2 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.6.1 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.5.7 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.6.0 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.5.6 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.5.5 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.5.4 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.5.3 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.5.2 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.5.1 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.5.0 spec/unit/spark_api/models/portal_spec.rb