Sha256: e8a5f22e78ebe0efa845888672712c3efd047a584765cddbf98164e8c2fa5a3c

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

require "test_helper"

class PlistTest < Test::Unit::TestCase
  should "define a reader accessor for each attribute in mapping" do
    AppStore::Dummy.plist :mapping => { "plist_attribute" => :class_attribute_from_plist_attribute }
    assert ::AppStore::Dummy.instance_methods.include? "class_attribute_from_plist_attribute"
  end
  
  should "set variable defined through mapping at initialization" do
    AppStore::Dummy.plist :mapping => { "plist_attribute" => :dummy_attribute }
    dummy = ::AppStore::Dummy.new :plist => {"plist_attribute" => 42}
    assert_equal 42, dummy.dummy_attribute
  end
  
  should "raise an exception if type is set through :accepted_type and given type does not match" do
    AppStore::Dummy.plist :accepted_type => "bleh"
    assert_raise(AppStore::ParseError) { AppStore::Dummy.new :plist => {"type" => 'toto'} }
  end

  should "not raise an exception if type is set through :accepted_type and given type does match" do
    AppStore::Dummy.plist :accepted_type => "bleh"
    assert_nothing_raised(AppStore::ParseError) { AppStore::Dummy.new :plist => {"type" => 'bleh'} }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
app_store-0.1.2 test/plist_test.rb
app_store-0.1.0 test/plist_test.rb
app_store-0.0.4 test/plist_test.rb
app_store-0.0.3 test/plist_test.rb
app_store-0.0.1 test/plist_test.rb