From ac66865ea3d0eb0de8e19fef49293feb9e61281b Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Mon, 23 Jun 2008 14:49:02 +0200 Subject: update tests according to removal of self.locale from helpers --- actionpack/test/template/active_record_helper_i18n_test.rb | 13 ------------- actionpack/test/template/date_helper_i18n_test.rb | 12 ------------ actionpack/test/template/number_helper_i18n_test.rb | 11 ----------- 3 files changed, 36 deletions(-) diff --git a/actionpack/test/template/active_record_helper_i18n_test.rb b/actionpack/test/template/active_record_helper_i18n_test.rb index 3a2197ac93..d1b92c7e4d 100644 --- a/actionpack/test/template/active_record_helper_i18n_test.rb +++ b/actionpack/test/template/active_record_helper_i18n_test.rb @@ -7,24 +7,11 @@ class ActiveRecordHelperI18nTest < Test::Unit::TestCase def setup @object = stub :errors => stub(:count => 1, :full_messages => ['full_messages']) stubs(:content_tag).returns 'content_tag' - stubs(:locale) I18n.stubs(:t).with(:'header_message', :locale => 'en-US', :scope => [:active_record, :error], :count => 1, :object_name => '').returns "1 error prohibited this from being saved" I18n.stubs(:t).with(:'message', :locale => 'en-US', :scope => [:active_record, :error]).returns 'There were problems with the following fields:' end - def test_error_messages_for_given_a_locale_it_does_not_check_request_for_locale - expects(:locale).never - @object.errors.stubs(:count).returns 0 - error_messages_for(:object => @object, :locale => 'en-US') - end - - def test_error_messages_for_given_no_locale_it_checks_request_for_locale - expects(:locale).returns 'en-US' - @object.errors.stubs(:count).returns 0 - error_messages_for(:object => @object) - end - def test_error_messages_for_given_a_header_message_option_it_does_not_translate_header_message I18n.expects(:translate).with(:'header_message', :locale => 'en-US', :scope => [:active_record, :error], :count => 1, :object_name => '').never error_messages_for(:object => @object, :header_message => 'header message', :locale => 'en-US') diff --git a/actionpack/test/template/date_helper_i18n_test.rb b/actionpack/test/template/date_helper_i18n_test.rb index f245ca1fc8..3e1eed61fd 100644 --- a/actionpack/test/template/date_helper_i18n_test.rb +++ b/actionpack/test/template/date_helper_i18n_test.rb @@ -5,22 +5,11 @@ class DateHelperDistanceOfTimeInWordsI18nTests < Test::Unit::TestCase attr_reader :request def setup - stubs(:locale) @from = Time.mktime(2004, 6, 6, 21, 45, 0) end # distance_of_time_in_words - def test_distance_of_time_in_words_given_a_locale_it_does_not_check_request_for_locale - expects(:locale).never - distance_of_time_in_words @from, @from + 1.second, false, :locale => 'en-US' - end - - def test_distance_of_time_in_words_given_no_locale_it_checks_request_for_locale - expects(:locale).returns 'en-US' - distance_of_time_in_words @from, @from + 1.second - end - def test_distance_of_time_in_words_calls_i18n { # with include_seconds [2.seconds, true] => [:'less_than_x_seconds', 5], @@ -64,7 +53,6 @@ class DateHelperSelectTagsI18nTests < Test::Unit::TestCase attr_reader :request def setup - # stubs(:locale) I18n.stubs(:translate).with(:'date.month_names', 'en-US').returns Date::MONTHNAMES end diff --git a/actionpack/test/template/number_helper_i18n_test.rb b/actionpack/test/template/number_helper_i18n_test.rb index 5db60ece04..bee9ceaa71 100644 --- a/actionpack/test/template/number_helper_i18n_test.rb +++ b/actionpack/test/template/number_helper_i18n_test.rb @@ -5,21 +5,10 @@ class NumberHelperI18nTests < Test::Unit::TestCase attr_reader :request def setup - stubs(:locale) @defaults = {:separator => ".", :unit => "$", :format => "%u%n", :delimiter => ",", :precision => 2} I18n.backend.store_translations 'en-US', :currency => {:format => @defaults} end - def test_number_to_currency_given_a_locale_it_does_not_check_request_for_locale - expects(:locale).never - number_to_currency(1, :locale => 'en-US') - end - - def test_number_to_currency_given_no_locale_it_checks_request_for_locale - expects(:locale).returns 'en-US' - number_to_currency(1) - end - def test_number_to_currency_translates_currency_formats I18n.expects(:translate).with(:'currency.format', 'en-US').returns @defaults number_to_currency(1, :locale => 'en-US') -- cgit v1.2.3