Sha256: aef47435fc3aa162bf2427acd75d0c866059f7c32ac99c0de957f7a152dc2785

Contents?: true

Size: 1.42 KB

Versions: 22

Compression:

Stored size: 1.42 KB

Contents

require "spec_helper"

feature "Fetching individual resources" do  

  scenario "Fetching untyped attributes" do
    stub_auth_request(:get, "http://admin:admin@abiquo.example.com/api/admin/datacenters/1").to_return(:body => <<-XML)
      <datacenter>
        <name>Resource Name</name>
        <id>12345</id>
      </datacenter>
    XML

    datacenter = Abiquo::Resource("http://abiquo.example.com/api/admin/datacenters/1", auth)
    datacenter.name.should == "Resource Name"
    datacenter.id.should == "12345"

    expect { datacenter.wadus }.to raise_error(NoMethodError)
  end

  scenario "Fetching typed attributes" do
    stub_auth_request(:get, "http://admin:admin@abiquo.example.com/api/admin/datacenters/1").to_return(:body => <<-XML)
      <datacenter>
        <id>12345</id>
        <name>Resource Name</name>
      </datacenter>
    XML

    datacenter = Abiquo::Resource("http://abiquo.example.com/api/admin/datacenters/1", auth)

    datacenter.id.should == "12345"
  end

  scenario "Inspecting a resource" do
    xml = %q{
      <datacenter>
        <id>12345</id>
        <name>Resource Name</name>
      </datacenter>      
    }
    stub_auth_request(:get, "http://admin:admin@abiquo.example.com/api/admin/datacenters/1").to_return(:body => xml)

    datacenter = Abiquo::Resource("http://abiquo.example.com/api/admin/datacenters/1", auth)

    Nokogiri.parse(datacenter.inspect).to_xml.should == Nokogiri.parse(xml).to_xml
  end
  
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
abiquo-etk-0.6.4 vendor/abiquo-0.1.2/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.6.3 vendor/abiquo-0.1.2/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.6.2 vendor/abiquo-0.1.2/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.6.1 vendor/abiquo-0.1.2/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.5.8 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.5.3 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.42 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.33 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.32 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.29 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.25 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.24 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.23 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.22 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.20 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.19 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.18 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.17 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.16 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb
abiquo-etk-0.4.15 vendor/api_ruby_client/spec/acceptance/fetch_single_resources_spec.rb