Sha256: 63051e0c35d723943a278c18db8cbfee7fd5167b5081fd9c847905c9cf0aec58

Contents?: true

Size: 619 Bytes

Versions: 17

Compression:

Stored size: 619 Bytes

Contents

require 'contest'
require 'swirl/helpers'

class SlopTest < Test::Unit::TestCase
  include Swirl::Helpers

  test "camalize" do
    assert_equal "foo", Slop.camalize(:foo)
    assert_equal "fooBar", Slop.camalize(:foo_bar)
  end

  test "gets sloppy" do
    slop = Slop.new({"fooBar" => "baz"})
    assert_equal "baz", slop[:foo_bar]
  end

  test "honors keys already camalized" do
    slop = Slop.new({"fooBar" => "baz"})
    assert_equal "baz", slop["fooBar"]
  end

  test "raise InvalidKey if key not found" do
    slop = Slop.new({})
    assert_raises Slop::InvalidKey do
      slop[:not_here]
    end
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
swirl-1.7.5 test/slop_test.rb
swirl-1.7.4 test/slop_test.rb
swirl-1.7.3 test/slop_test.rb
swirl-1.7.2 test/slop_test.rb
swirl-1.7.1 test/slop_test.rb
swirl-1.7.0 test/slop_test.rb
swirl-1.6.2 test/slop_test.rb
swirl-1.6.1 test/slop_test.rb
swirl-1.6.0 test/slop_test.rb
swirl-1.5.3 test/slop_test.rb
swirl-1.5.2 test/slop_test.rb
swirl-1.5.0 test/slop_test.rb
swirl-1.4 test/slop_test.rb
swirl-1.3 test/slop_test.rb
swirl-1.2 test/slop_test.rb
swirl-1.1 test/slop_test.rb
swirl-1.0 test/slop_test.rb