Sha256: da1c1e3c0f3aa68aab4cfa59d80029a5e97abaec2eb98582ca0da5c19b3cde98

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

require 'test_helper'

class Flucti::Resources::BasicResourceTest < Test::Unit::TestCase
  include Flucti::Resources
  
  class Foo < BasicResource
    self.attribute_for_to_s = :name
  end
  
  class HostedService < BasicResource
  end
  
  def test_to_s
    foo = Foo.new
    assert_match(/Foo/, foo.to_s)
    
    foo.name = nil
    assert_match(/Foo/, foo.to_s)
    
    foo.name = "test"
    assert_match("test", foo.to_s)
  end
  
  def test_vps_accessor
    foo = Foo.new "vps" => {"id" => 1}
    assert_equal VPS.new("id" => 1), foo.vps
    assert_equal 1, foo.vps_id
    
    assert_equal VPS.new("id" => 1), foo.container
    assert_equal 1, foo.container_id
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Flucti-flucti-cli-0.1.16 test/flucti/resources_test.rb