Sha256: 46c3d4bd61a2d9458ba5acf7eedb401d70228bc2594c8424fddc8846d3c8ce4f

Contents?: true

Size: 1.37 KB

Versions: 51

Compression:

Stored size: 1.37 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
      portal.persisted?.should eq(false)
    end

    it "should get the current user's portal" do
      stub_api_get("/portal", "portal/my.json")
      portal = Portal.my
      portal.persisted?.should 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
      s.should 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
      s.should have_been_requested
    end

  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
spark_api-1.4.34 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.32 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.31 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.29 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.28 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.27 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.26 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.25 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.24 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.23 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.22 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.21 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.20 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.19 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.18 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.17 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.16 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.15 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.14 spec/unit/spark_api/models/portal_spec.rb
spark_api-1.4.13 spec/unit/spark_api/models/portal_spec.rb