Skip to content

Commit

Permalink
Cleaning up gemspec and setting up travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
balvig committed Dec 6, 2012
1 parent 265aa31 commit 02149b2
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: ruby
script: 'rake'
rvm:
- 1.9.2
- 1.9.3
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ source "http://rubygems.org"

# Specify your gem's dependencies in i18n_toolbox.gemspec
gemspec

gem "rails", "~> 3.0.7"
gem "sqlite3-ruby"
3 changes: 3 additions & 0 deletions i18n_toolbox.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ 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_dependency "rails", "~> 3"
s.add_development_dependency 'sqlite3'
end
15 changes: 8 additions & 7 deletions test/helpers/i18n_helper_test.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# encoding: UTF-8
require 'test_helper'

class I18nToolbox::I18nHelperTest < ActionView::TestCase
class I18nToolbox::I18nHelperTest < ActionView::TestCase
test "image_tag given localize => true should return a localized image" do
I18n.locale = :ja
assert_match 'images/ja/logo.png', image_tag('logo.png', :localize => true)
I18n.locale = :en
assert_match 'images/en/logo.png', image_tag('logo.png', :localize => true)
assert_match 'images/logo.png', image_tag('logo.png', :localize => false)
end

test "image_tag should otherwise work as usual" do
assert_match 'images/logo.png', image_tag('logo.png')
end

test "possessive should add localized 's" do
I18n.backend = I18n::Backend::KeyValue.new({})
I18n.backend.store_translations :en, :i18n_toolbox => {:possessive => "%{owner}'s %{thing}", :possessive_s => "%{owner}' %{thing}"}
I18n.backend.store_translations :ja, :i18n_toolbox => {:possessive => "%{owner}の%{thing}"}
I18n.backend.store_translations :fr, :i18n_toolbox => {:possessive => "%{thing} de %{owner}"}

assert_nil possessive(nil,nil)
I18n.locale = :en
assert_equal "Bob's house", possessive('Bob','house')
Expand All @@ -30,12 +31,12 @@ class I18nToolbox::I18nHelperTest < ActionView::TestCase
assert_equal "La maison de Bob", possessive('Bob','La maison')
assert_equal "La maison de Miles", possessive('Miles','La maison')
end

test "truncate should respect different lengths for different locales" do
I18n.backend = I18n::Backend::KeyValue.new({})
I18n.backend.store_translations :en, :i18n_toolbox => {:character_ratio => 1}
I18n.backend.store_translations :ja, :i18n_toolbox => {:character_ratio => 0.5}

I18n.locale = :en
assert_equal 'Top Gun is one of the best ...', truncate('Top Gun is one of the best movies ever made', :localize => true)
I18n.locale = :ja
Expand All @@ -44,4 +45,4 @@ class I18nToolbox::I18nHelperTest < ActionView::TestCase
I18n.locale = :da
assert_equal 'Top Gun is one of the best ...', truncate('Top Gun is one of the best movies ever made', :localize => true)
end
end
end
1 change: 0 additions & 1 deletion test/rails_app/log/development.log

This file was deleted.

Empty file removed test/rails_app/log/production.log
Empty file.
Empty file removed test/rails_app/log/server.log
Empty file.
Empty file removed test/rails_app/log/test.log
Empty file.

0 comments on commit 02149b2

Please sign in to comment.