Skip to content

Commit

Permalink
get tests green
Browse files Browse the repository at this point in the history
Irish is off by default? But this causes tests to fail... so turn it on by default.

add Hoe as a dependency in namecase.gemspec

mark testfile as UTF8

update to latest Hoe interface
  • Loading branch information
mustmodify committed Feb 27, 2014
1 parent b7b9c31 commit 2b2f039
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Gemfile
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gemspec
1 change: 1 addition & 0 deletions Manifest.txt
@@ -1,3 +1,4 @@
Gemfile
History.txt
LICENSE.txt
Manifest.txt
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -2,6 +2,6 @@ require 'rubygems'
require 'hoe'
require './lib/namecase.rb'

Hoe.new('namecase', NameCase::VERSION) do |p|
Hoe.spec('namecase') do |p|
p.developer('Aaron Patterson', 'aaronp@rubyforge.org')
end
2 changes: 1 addition & 1 deletion lib/namecase.rb
Expand Up @@ -3,7 +3,7 @@ module NameCase

# Returns a new +String+ with the contents properly namecased
def nc(options = {})
options = { :lazy => true, :irish => false }.merge options
options = { :lazy => true, :irish => true }.merge options

# Skip if string is mixed case
if options[:lazy]
Expand Down
2 changes: 2 additions & 0 deletions namecase.gemspec
Expand Up @@ -14,4 +14,6 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_development_dependency "hoe"
end
17 changes: 10 additions & 7 deletions test/test_namecase.rb
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
#
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
$:.unshift File.join(File.dirname(__FILE__), "..", "test")

Expand Down Expand Up @@ -31,25 +33,26 @@ def setup

def test_namecase
@proper_names.each do |name|
nc_name = NameCase.new(name)
assert_equal(name, nc_name.downcase.nc)
assert_equal(name, NameCase.nc(name))
assert_equal(name, NameCase(name.downcase))
n = name.dup
n.extend(NameCase)
assert_equal(name, n.nc)
assert_equal(name, NameCase(name))
end
end

def test_namecase_modify
@proper_names.each do |name|
nc_name = NameCase.new(name)
assert_equal(name, nc_name.downcase.nc!)
nc_name = NameCase!(name.downcase)
assert_equal(name, nc_name)
end
end

def test_namecase_multibyte
$KCODE = 'u'

proper_cased = 'Iñtërnâtiônàlizætiøn'
nc_name = NameCase.new(proper_cased)
assert_equal(proper_cased, nc_name.downcase.nc)
nc_name = NameCase(proper_cased.downcase)
assert_equal(proper_cased, nc_name)
end
end

0 comments on commit 2b2f039

Please sign in to comment.