hadupils 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -11,3 +11,8 @@
11
11
  * Removed evil rubygems requirement from executable
12
12
  * Added this glorious changelog
13
13
 
14
+ ### 0.1.2
15
+
16
+ * Fixed embarrassing mispelling of "shoulda-context" in gemspec
17
+ development dependencies
18
+
@@ -4,13 +4,17 @@ module Hadupils::Commands
4
4
  handler.run params
5
5
  end
6
6
 
7
+ def self.normalize_command(command)
8
+ command.to_s.downcase
9
+ end
10
+
7
11
  def self.handler_for(command)
8
- @handlers and @handlers[command.downcase.to_sym]
12
+ @handlers and @handlers[normalize_command(command)]
9
13
  end
10
14
 
11
15
  def self.register_handler(command, handler)
12
16
  @handlers ||= {}
13
- @handlers[command.downcase.to_sym] = handler
17
+ @handlers[normalize_command(command)] = handler
14
18
  end
15
19
 
16
20
  class SimpleCommand
@@ -8,6 +8,24 @@ class Hadupils::CommandsTest < Test::Unit::TestCase
8
8
  end
9
9
  end
10
10
 
11
+ # Addresses bug when run on older rubies
12
+ context 'handler pretty name normalization' do
13
+ context 'via handler_for' do
14
+ should 'not invoke downcase on requested handler' do
15
+ pretty = mock()
16
+ pretty.expects(:downcase).never
17
+ Hadupils::Commands.handler_for(pretty)
18
+ end
19
+
20
+ should 'produce downcased string' do
21
+ pretty = mock()
22
+ pretty.expects(:to_s).returns(s = mock())
23
+ s.expects(:downcase)
24
+ Hadupils::Commands.handler_for(pretty)
25
+ end
26
+ end
27
+ end
28
+
11
29
  context 'Hive' do
12
30
  setup do
13
31
  @klass = Hadupils::Commands::Hive
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hadupils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-15 00:00:00.000000000 Z
12
+ date: 2013-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler