Permalink
Browse files

Add missing specs for Inflecto.underscore

  • Loading branch information...
1 parent 7e9a08e commit d24f5c68fc0d9f68dc69c27ce00d69e4823a0766 @indrekj indrekj committed May 27, 2013
Showing with 28 additions and 1 deletion.
  1. +12 −1 spec/spec_helper.rb
  2. +16 −0 spec/unit/inflecto/class_methods/underscore_spec.rb
View
@@ -17,7 +17,7 @@
command_name 'spec:unit'
add_filter 'config'
add_filter 'spec'
- minimum_coverage 88.31
+ minimum_coverage 100
end
end
@@ -28,6 +28,17 @@
require file
end
+# Mutant is already using inflecto. If it mutates inflecto methods then our
+# tests start to fail. Instead, we force mutant to use unmutated version of
+# inflecto.
+module Mutant
+ module Inflecto
+ ::Inflecto.singleton_methods.each do |name|
+ define_singleton_method name, ::Inflecto.method(name).to_proc
+ end
+ end
+end
+
RSpec.configure do |config|
# Helps to ensure that inflecto does not modify original input
def i(object)
@@ -16,4 +16,20 @@
it 'underscores Merb::BootLoader::Rackup as merb/boot_loader/rackup' do
Inflecto.underscore(i('Merb::BootLoader::Rackup')).should == 'merb/boot_loader/rackup'
end
+
+ it 'underscores data-mapper as data_mapper' do
+ Inflecto.underscore(i('data-mapper')).should == 'data_mapper'
+ end
+
+ it 'underscores CLI as cli' do
+ Inflecto.underscore(i('CLI')).should == 'cli'
+ end
+
+ it 'underscores castleKing as castle_king' do
+ Inflecto.underscore(i('castleKing')).should == 'castle_king'
+ end
+
+ it 'underscores CLIRunner as cli_runner' do
+ Inflecto.underscore(i('CLIRunner')).should == 'cli_runner'
+ end
end

0 comments on commit d24f5c6

Please sign in to comment.