From 58ce72b99fe88bffcc914f9d6350e22fa707b092 Mon Sep 17 00:00:00 2001 From: Andrew Haines Date: Wed, 6 Feb 2013 11:40:27 +0000 Subject: [PATCH] 1.9 hash syntax --- test/inputs/collection_select_input_test.rb | 82 ++++++++++----------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/test/inputs/collection_select_input_test.rb b/test/inputs/collection_select_input_test.rb index 3c736a64..497ffeec 100644 --- a/test/inputs/collection_select_input_test.rb +++ b/test/inputs/collection_select_input_test.rb @@ -97,65 +97,65 @@ class CollectionSelectInputTest < ActionView::TestCase end test 'input should translate include blank when set to :translate' do - store_translations(:en, :simple_form => { :include_blanks => { :user => { - :age => 'Rather not say' + store_translations(:en, simple_form: { include_blanks: { user: { + age: 'Rather not say' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :include_blank => :translate + with_input_for @user, :age, :select, collection: 18..30, include_blank: :translate assert_select 'select option[value=]', 'Rather not say' end end test 'input should translate include blank when set to :t' do - store_translations(:en, :simple_form => { :include_blanks => { :user => { - :age => 'Rather not say' + store_translations(:en, simple_form: { include_blanks: { user: { + age: 'Rather not say' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :include_blank => :t + with_input_for @user, :age, :select, collection: 18..30, include_blank: :t assert_select 'select option[value=]', 'Rather not say' end end test 'input should translate include blank with a particular key' do - store_translations(:en, :simple_form => { :include_blanks => { - :age => 'Rather not say', - :user => { :age => 'Should be overridden' } + store_translations(:en, simple_form: { include_blanks: { + age: 'Rather not say', + user: { age: 'Should be overridden' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :include_blank => :age + with_input_for @user, :age, :select, collection: 18..30, include_blank: :age assert_select 'select option[value=]', 'Rather not say' end end test 'input should not translate include blank when set to a string' do - store_translations(:en, :simple_form => { :include_blanks => { :user => { - :age => 'Rather not say' + store_translations(:en, simple_form: { include_blanks: { user: { + age: 'Rather not say' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :include_blank => 'Young at heart' + with_input_for @user, :age, :select, collection: 18..30, include_blank: 'Young at heart' assert_select 'select option[value=]', 'Young at heart' end end test 'input should not translate include blank when automatically set' do - store_translations(:en, :simple_form => { :include_blanks => { :user => { - :age => 'Rather not say' + store_translations(:en, simple_form: { include_blanks: { user: { + age: 'Rather not say' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30 + with_input_for @user, :age, :select, collection: 18..30 assert_select 'select option[value=]', '' end end test 'input should not translate include blank when set to true' do - store_translations(:en, :simple_form => { :include_blanks => { :user => { - :age => 'Rather not say' + store_translations(:en, simple_form: { include_blanks: { user: { + age: 'Rather not say' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :include_blank => true + with_input_for @user, :age, :select, collection: 18..30, include_blank: true assert_select 'select option[value=]', '' end end test 'input should not translate include blank when set to false' do - store_translations(:en, :simple_form => { :include_blanks => { :user => { - :age => 'Rather not say' + store_translations(:en, simple_form: { include_blanks: { user: { + age: 'Rather not say' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :include_blank => false + with_input_for @user, :age, :select, collection: 18..30, include_blank: false assert_no_select 'select option[value=]' end end @@ -176,56 +176,56 @@ class CollectionSelectInputTest < ActionView::TestCase end test 'input should translate prompt when set to :translate' do - store_translations(:en, :simple_form => { :prompts => { :user => { - :age => 'Select age:' + store_translations(:en, simple_form: { prompts: { user: { + age: 'Select age:' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :prompt => :translate + with_input_for @user, :age, :select, collection: 18..30, prompt: :translate assert_select 'select option[value=]', 'Select age:' end end test 'input should translate prompt when set to :t' do - store_translations(:en, :simple_form => { :prompts => { :user => { - :age => 'Select age:' + store_translations(:en, simple_form: { prompts: { user: { + age: 'Select age:' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :prompt => :t + with_input_for @user, :age, :select, collection: 18..30, prompt: :t assert_select 'select option[value=]', 'Select age:' end end test 'input should translate prompt with a particular key' do - store_translations(:en, :simple_form => { :prompts => { - :age => 'Select age:', - :user => { :age => 'Should be overridden' } + store_translations(:en, simple_form: { prompts: { + age: 'Select age:', + user: { age: 'Should be overridden' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :prompt => :age + with_input_for @user, :age, :select, collection: 18..30, prompt: :age assert_select 'select option[value=]', 'Select age:' end end test 'input should not translate prompt when set to a string' do - store_translations(:en, :simple_form => { :prompts => { :user => { - :age => 'Select age:' + store_translations(:en, simple_form: { prompts: { user: { + age: 'Select age:' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :prompt => 'Do it:' + with_input_for @user, :age, :select, collection: 18..30, prompt: 'Do it:' assert_select 'select option[value=]', 'Do it:' end end test 'input should not translate prompt when set to false' do - store_translations(:en, :simple_form => { :prompts => { :user => { - :age => 'Select age:' + store_translations(:en, simple_form: { prompts: { user: { + age: 'Select age:' } } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :prompt => false + with_input_for @user, :age, :select, collection: 18..30, prompt: false assert_no_select 'select option[value=]' end end test 'input should use Rails prompt translation as a fallback' do - store_translations(:en, :helpers => { :select => { - :prompt => 'Select value:' + store_translations(:en, helpers: { select: { + prompt: 'Select value:' } } ) do - with_input_for @user, :age, :select, :collection => 18..30, :prompt => :translate + with_input_for @user, :age, :select, collection: 18..30, prompt: :translate assert_select 'select option[value=]', "Select value:" end end