Sha256: b996d5547f6b4997614410a82f84bbafe545020e9301565de4182bd68ab6f301

Contents?: true

Size: 1.16 KB

Versions: 23

Compression:

Stored size: 1.16 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))

context "A SuperHash" do
  # Test creation
  # ------------------------ #
  context "created from #new" do
    context "and given a hash" do
      setup { CityGrid::Abstraction::SuperHash.new(:test => "wassup") }
      should("return a hash") { topic.is_a? Hash }
      should("its value can be accessible through its key") { topic[:test] == "wassup"}
    end
  end

  # Test accessing of values
  # ------------------------ #
  context "that's single level" do
    context "with symbol as key" do
      setup { CityGrid::Abstraction::SuperHash.new(:test => "wassup") }
      should("can access key as method") { topic.test }
    end

    context "with string as key" do
      setup { CityGrid::Abstraction::SuperHash.new("test" => "wasssup") }
      should("can access key as method"){ topic.test }
    end
  end

  context "that has a subhash" do
    setup { CityGrid::Abstraction::SuperHash.new(:test => {:wassup => "hows it going?"}) }
    should("return another SuperHash") { topic.test.is_a? CityGrid::Abstraction::SuperHash }
    should("return correct hash") { topic.test.wassup == "hows it going?" }
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
citygrid_api-0.0.28 test/test_super_hash.rb
citygrid_api-0.0.27 test/test_super_hash.rb
citygrid_api-0.0.26 test/test_super_hash.rb
citygrid_api-0.0.25 test/test_super_hash.rb
citygrid_api-0.0.24 test/test_super_hash.rb
citygrid_api-0.0.23 test/test_super_hash.rb
citygrid_api-0.0.22 test/test_super_hash.rb
citygrid_api-0.0.21 test/test_super_hash.rb
citygrid_api-0.0.20 test/test_super_hash.rb
citygrid_api-0.0.19 test/test_super_hash.rb
citygrid_api-0.0.18 test/test_super_hash.rb
citygrid_api-0.0.17 test/test_super_hash.rb
citygrid_api-0.0.16 test/test_super_hash.rb
citygrid_api-0.0.15 test/test_super_hash.rb
citygrid_api-0.0.14 test/test_super_hash.rb
citygrid_api-0.0.13 test/test_super_hash.rb
citygrid_api-0.0.12 test/test_super_hash.rb
citygrid_api-0.0.11 test/test_super_hash.rb
citygrid_api-0.0.10 test/test_super_hash.rb
citygrid_api-0.0.9 test/test_super_hash.rb