forked from prograils/lit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request prograils#14 from Bonias/fix-array-translations-up…
…dating Fixed array translations updating - strong parameters allowed only strings.
- Loading branch information
Showing
11 changed files
with
88 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
hello_world: | ||
localization_key: 'scopes.hello_world' | ||
created_at: <%= Time.now %> | ||
updated_at: <%= Time.now %> | ||
|
||
array: | ||
localization_key: 'scopes.array' | ||
created_at: <%= Time.now %> | ||
updated_at: <%= Time.now %> | ||
|
||
string: | ||
localization_key: 'scopes.string' | ||
created_at: <%= Time.now %> | ||
updated_at: <%= Time.now %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html | ||
|
||
one: | ||
locale: | ||
localization_key: | ||
translated_value: MyText | ||
default_value: MyText | ||
string: | ||
locale: en | ||
localization_key: array | ||
translated_value: value | ||
default_value: value | ||
created_at: <%= Time.now %> | ||
updated_at: <%= Time.now %> | ||
|
||
two: | ||
locale: | ||
localization_key: | ||
translated_value: MyText | ||
default_value: MyText | ||
array: | ||
locale: en | ||
localization_key: array | ||
translated_value: | ||
- one | ||
- two | ||
- three | ||
default_value: | ||
- one | ||
- two | ||
- three | ||
created_at: <%= Time.now %> | ||
updated_at: <%= Time.now %> |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'test_helper' | ||
|
||
module Lit | ||
class LocalizationsControllerTest < ActionController::TestCase | ||
fixtures :all | ||
|
||
setup do | ||
Lit.authentication_function = nil | ||
@routes = Lit::Engine.routes | ||
@localization = lit_localizations(:array) | ||
end | ||
|
||
test "should get edit" do | ||
get :edit, :localization_key_id => @localization.localization_key.id, :id => @localization.id, :format => :js | ||
assert_response :success | ||
assert_not_nil assigns(:localization) | ||
end | ||
|
||
test "should get previous_versions" do | ||
get :previous_versions, :localization_key_id => @localization.localization_key.id, :id => @localization.id, | ||
:format => :js | ||
assert_response :success | ||
assert_not_nil assigns(:localization) | ||
assert_not_nil assigns(:versions) | ||
end | ||
|
||
test "should update localization when translated_value is a string" do | ||
@localization = lit_localizations(:string) | ||
put :update, :localization_key_id => @localization.localization_key.id, :id => @localization.id, | ||
:localization => { :translated_value => "new-value", :locale_id => @localization.locale_id }, :format => :js | ||
assert_response :success | ||
@localization.reload | ||
assert_equal "new-value", @localization.translated_value | ||
end | ||
|
||
test "should update localization when translated_value is a array" do | ||
@localization = lit_localizations(:array) | ||
put :update, :localization_key_id => @localization.localization_key.id, :id => @localization.id, | ||
:localization => { :translated_value => ["three", "two", "one"], :locale_id => @localization.locale_id }, | ||
:format => :js | ||
assert_response :success | ||
@localization.reload | ||
assert_equal ["three", "two", "one"], @localization.translated_value | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters