@@ -4,7 +4,7 @@ class ProxyAttributesParsingTest < I18n::Alchemy::ProxyTestCase
44 # Attributes
55 def test_initializes_proxy_with_attributes
66 @localized = @product . localized (
7- : name => "Banana" , : price => "0,99" , : released_at => "28/02/2011" )
7+ name : "Banana" , price : "0,99" , released_at : "28/02/2011" )
88
99 assert_equal 0.99 , @product . price
1010 assert_equal "0,99" , @localized . price
@@ -14,7 +14,7 @@ def test_initializes_proxy_with_attributes
1414 end
1515
1616 def test_assign_attributes
17- @localized . assign_attributes ( : price => '1,99' )
17+ @localized . assign_attributes ( price : '1,99' )
1818 assert_equal "1,99" , @localized . price
1919 end
2020
@@ -31,7 +31,7 @@ def test_assign_attributes_does_not_change_given_attributes_hash
3131 end
3232
3333 def test_attributes_assignment
34- @localized . attributes = { : price => '1,99' }
34+ @localized . attributes = { price : '1,99' }
3535 assert_equal "1,99" , @localized . price
3636 end
3737
@@ -42,7 +42,7 @@ def test_attributes_assignment_does_not_change_given_attributes_hash
4242 end
4343
4444 def test_update
45- @localized . update ( : price => '2,88' )
45+ @localized . update ( price : '2,88' )
4646 assert_equal '2,88' , @localized . price
4747 assert_equal 2.88 , @product . reload . price
4848 end
@@ -54,13 +54,13 @@ def test_update_does_not_change_given_attributes_hash
5454 end
5555
5656 def test_update_attributes
57- @localized . update_attributes ( : price => '2,88' )
57+ @localized . update_attributes ( price : '2,88' )
5858 assert_equal '2,88' , @localized . price
5959 assert_equal 2.88 , @product . reload . price
6060 end
6161
6262 def test_update!
63- @localized . update! ( : price => '2,88' )
63+ @localized . update! ( price : '2,88' )
6464 assert_equal '2,88' , @localized . price
6565 assert_equal 2.88 , @product . reload . price
6666 end
@@ -72,7 +72,7 @@ def test_update_bang_does_not_change_given_attributes_hash
7272 end
7373
7474 def test_update_attributes!
75- @localized . update_attributes! ( : price => '2,88' )
75+ @localized . update_attributes! ( price : '2,88' )
7676 assert_equal '2,88' , @localized . price
7777 assert_equal 2.88 , @product . reload . price
7878 end
@@ -85,40 +85,40 @@ def test_update_attribute
8585
8686 # Nested Attributes
8787 def test_should_assign_for_nested_attributes_for_collection_association
88- @supplier_localized . assign_attributes ( : products_attributes => [ { : price => '1,99' } , { : price => '2,93' } ] )
88+ @supplier_localized . assign_attributes ( products_attributes : [ { price : '1,99' } , { price : '2,93' } ] )
8989 assert_equal 2 , @supplier_localized . products . size
9090 assert_equal '1,99' , @supplier_localized . products . first . localized . price
9191 assert_equal '2,93' , @supplier_localized . products . last . localized . price
9292 end
9393
9494 def test_should_assign_for_nested_attributes_passing_a_hash_for_collection_with_unique_keys
95- @supplier_localized . assign_attributes ( : products_attributes => { "0" => { : price => '2,93' , " _destroy" => " false" } , "1" => { : price => '2,85' , " _destroy" => " false" } } )
95+ @supplier_localized . assign_attributes ( products_attributes : { '0' => { price : '2,93' , _destroy : ' false' } , '1' => { price : '2,85' , _destroy : ' false' } } )
9696 prices = @supplier . products . map { |p | p . localized . price } . sort
9797 assert_equal [ '2,85' , '2,93' ] , prices
9898 end
9999
100100 def test_should_assign_for_nested_attributes_for_one_to_one_association
101- @supplier_localized . assign_attributes ( : account_attributes => { : account_number => 10 , : total_money => '100,87' } )
101+ @supplier_localized . assign_attributes ( account_attributes : { account_number : 10 , total_money : '100,87' } )
102102 account = @supplier_localized . account
103103 assert_equal '10' , account . account_number . to_s
104104 assert_equal '100,87' , account . localized . total_money
105105 end
106106
107107 def test_update_for_nested_attributes
108- @supplier_localized . update ( : account_attributes => { : total_money => '99,87' } )
108+ @supplier_localized . update ( account_attributes : { total_money : '99,87' } )
109109 assert_equal '99,87' , @supplier_localized . account . localized . total_money
110110 end
111111
112112 def test_attributes_assignment_for_nested
113- @supplier_localized . attributes = { : account_attributes => { : total_money => '88,12' } }
113+ @supplier_localized . attributes = { account_attributes : { total_money : '88,12' } }
114114 assert_equal '88,12' , @supplier_localized . account . localized . total_money
115115 end
116116
117117 private
118118
119119 def assert_attributes_hash_is_unchanged
120- attributes = { : quantity => 1 }
120+ attributes = { quantity : 1 }
121121 yield attributes
122- assert_equal ( { : quantity => 1 } , attributes )
122+ assert_equal ( { quantity : 1 } , attributes )
123123 end
124124end
0 commit comments