Sha256: b4e0da00e218b16219a0679c96bff8c52b8b6ccfa7d9b82c76d685be2f826032

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require 'helper'

class PseudocephalopodTest < Test::Unit::TestCase
  
  class SlugScopeTest
    cattr_accessor :slug_scope_key
    self.slug_scope_key = "my-test-scope"
  end
  
  should 'return the correct counter versions' do
    assert_equal 'awesome',      Pseudocephalopod.with_counter('awesome')
    assert_equal 'awesome',      Pseudocephalopod.with_counter('awesome', 0)
    assert_equal 'awesome',      Pseudocephalopod.with_counter('awesome', -1)
    assert_equal 'awesome--2',   Pseudocephalopod.with_counter('awesome', 2)
    assert_equal 'awesome--100', Pseudocephalopod.with_counter('awesome', 100)
  end

  should 'correct allow you to slug scope keys' do
    assert_equal "my-test-scope", Pseudocephalopod.key_for_scope(SlugScopeTest)
    assert_equal "my-test-scope", Pseudocephalopod.key_for_scope(SlugScopeTest.new)
    assert_equal "my-test-scope", Pseudocephalopod.key_for_scope("my-test-scope")
    assert_equal "",              Pseudocephalopod.key_for_scope(nil)
    assert_equal "1",             Pseudocephalopod.key_for_scope(1)
    assert_equal "awesome",       Pseudocephalopod.key_for_scope(:awesome)
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pseudocephalopod-0.3.1 test/pseudocephalopod_test.rb
pseudocephalopod-0.3.0 test/pseudocephalopod_test.rb
pseudocephalopod-0.2.5 test/pseudocephalopod_test.rb
pseudocephalopod-0.2.4 test/pseudocephalopod_test.rb
pseudocephalopod-0.2.3 test/pseudocephalopod_test.rb
pseudocephalopod-0.2.2 test/pseudocephalopod_test.rb
pseudocephalopod-0.2.1 test/pseudocephalopod_test.rb
pseudocephalopod-0.2.0 test/pseudocephalopod_test.rb