translation_center 1.7.2 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -2
- data/Rakefile +8 -13
- data/app/assets/javascripts/translation_center/application.js +1 -1
- data/app/assets/stylesheets/translation_center/application.css +1 -1
- data/app/assets/stylesheets/translation_center/translation_keys.css +3 -1
- data/app/controllers/translation_center/application_controller.rb +2 -2
- data/app/controllers/translation_center/translation_keys_controller.rb +4 -4
- data/app/models/translation_center/activity_query.rb +2 -3
- data/app/models/translation_center/category.rb +7 -2
- data/app/models/translation_center/translation.rb +54 -32
- data/app/models/translation_center/translation_key.rb +29 -18
- data/app/views/layouts/translation_center/application.html.haml +0 -2
- data/app/views/translation_center/translation_keys/_translation_keys.html.haml +3 -1
- data/app/views/translation_center/translations/_show.html.haml +3 -3
- data/config/routes.rb +3 -3
- data/db/development.sqlite3 +0 -0
- data/{test/dummy/db/migrate/20130410082611_devise_create_users.rb → db/migrate/20130410082600_devise_create_users.rb} +0 -0
- data/{test/dummy/db/migrate/20130410082701_create_articles.rb → db/migrate/20130410082601_create_articles.rb} +0 -0
- data/{test/dummy/db/migrate/20130410084711234392_create_translation_center_categories.rb → db/migrate/20130410084602_create_translation_center_categories.rb} +0 -0
- data/{test/dummy/db/migrate/20130410084711235054_create_translation_center_translation_keys.rb → db/migrate/20130410084603_create_translation_center_translation_keys.rb} +0 -0
- data/{test/dummy/db/migrate/20130410084711235601_create_translation_center_translations.rb → db/migrate/20130410084604_create_translation_center_translations.rb} +0 -0
- data/{test/dummy/db/migrate/20130410084711_acts_as_votable_migration.rb → db/migrate/20130410084605_acts_as_votable_migration.rb} +1 -0
- data/{test/dummy/db/migrate/20130410084711235602_install_audited.rb → db/migrate/20130410084606_install_audited.rb} +0 -0
- data/{test/dummy/db/migrate/20130410113111070575_add_de_status_translation_center_translation_keys.rb → db/migrate/20130410113607_add_de_status_translation_center_translation_keys.rb} +0 -0
- data/{test/dummy/db/migrate/20130417134539377014_add_ar_status_translation_center_translation_keys.rb → db/migrate/20130417134608_add_ar_status_translation_center_translation_keys.rb} +0 -0
- data/{test/dummy/db/migrate/20130506103956_fix_translation_user_relation.rb → db/migrate/20130506103609_fix_translation_user_relation.rb} +0 -0
- data/{test/dummy/db/migrate/20130801102022_add_indicies.rb → db/migrate/20130801102610_add_indicies.rb} +0 -0
- data/{test/dummy/db → db}/schema.rb +13 -13
- data/{test/dummy/public/favicon.ico → db/test.sqlite3} +0 -0
- data/lib/generators/translation_center/add_lang/add_lang_generator.rb +5 -2
- data/lib/generators/translation_center/install/install_generator.rb +4 -4
- data/lib/translation_center/acts_as_translator.rb +1 -1
- data/lib/translation_center/engine.rb +7 -0
- data/lib/translation_center/translation_helpers.rb +1 -1
- data/lib/translation_center/translations_transfer.rb +6 -5
- data/lib/translation_center/version.rb +1 -1
- data/spec/controllers/categories_controller_spec.rb +47 -0
- data/spec/controllers/center_controller_spec.rb +77 -0
- data/spec/controllers/translation_keys_controller_spec.rb +87 -0
- data/spec/controllers/translations_controller_spec.rb +70 -0
- data/{test → spec}/dummy/README.rdoc +0 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -1
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -1
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/{test → spec}/dummy/app/models/user.rb +2 -5
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -1
- data/{test → spec}/dummy/config.ru +0 -0
- data/{test → spec}/dummy/config/application.rb +10 -5
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/spec/dummy/config/database.yml +25 -0
- data/{test → spec}/dummy/config/environment.rb +2 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -0
- data/{test → spec}/dummy/config/environments/production.rb +0 -0
- data/{test → spec}/dummy/config/environments/test.rb +2 -2
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{test → spec}/dummy/config/initializers/devise.rb +3 -1
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/dummy/config/initializers/secret_token.rb +1 -1
- data/{test → spec}/dummy/config/initializers/session_store.rb +1 -1
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +1 -1
- data/{test → spec}/dummy/config/locales/devise.en.yml +0 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +7 -0
- data/{test → spec}/dummy/config/translation_center.yml +23 -6
- data/spec/dummy/db/migrate/20130410082611_devise_create_users.translation_center.rb +46 -0
- data/spec/dummy/db/migrate/20130410082701_create_articles.translation_center.rb +10 -0
- data/spec/dummy/db/migrate/20130410084702_create_translation_center_categories.translation_center.rb +9 -0
- data/spec/dummy/db/migrate/20130410084703_create_translation_center_translation_keys.translation_center.rb +14 -0
- data/spec/dummy/db/migrate/20130410084704_create_translation_center_translations.translation_center.rb +13 -0
- data/spec/dummy/db/migrate/20130410084711_acts_as_votable_migration.translation_center.rb +24 -0
- data/spec/dummy/db/migrate/20130410084712_install_audited.translation_center.rb +28 -0
- data/spec/dummy/db/migrate/20130410113113_add_de_status_translation_center_translation_keys.translation_center.rb +5 -0
- data/spec/dummy/db/migrate/20130417134534_add_ar_status_translation_center_translation_keys.rb +5 -0
- data/spec/dummy/db/migrate/20130506103956_fix_translation_user_relation.translation_center.rb +12 -0
- data/spec/dummy/db/migrate/20130801102021_add_indicies.translation_center.rb +8 -0
- data/spec/dummy/db/schema.rb +111 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/{test → spec}/dummy/script/rails +0 -0
- data/spec/factories/category_factory.rb +5 -0
- data/spec/factories/translation_factory.rb +8 -0
- data/spec/factories/translation_key_factory.rb +5 -0
- data/spec/factories/user_factory.rb +6 -0
- data/spec/factories/vote_factory.rb +13 -0
- data/spec/lib/generators/translation_center/add_lang/add_lang_generator_spec.rb +26 -0
- data/spec/models/translation_center/category_spec.rb +39 -0
- data/spec/models/translation_center/translation_key_spec.rb +145 -0
- data/spec/models/translation_center/translation_spec.rb +117 -0
- data/spec/schema.rb +112 -0
- data/spec/spec_helper.rb +52 -0
- data/spec/support/devise.rb +3 -0
- metadata +360 -208
- data/test/dummy/app/assets/images/translation_center_logo.png +0 -0
- data/test/dummy/app/assets/javascripts/articles.js +0 -2
- data/test/dummy/app/assets/stylesheets/articles.css +0 -4
- data/test/dummy/app/assets/stylesheets/scaffold.css +0 -56
- data/test/dummy/app/controllers/application_controller.rb +0 -6
- data/test/dummy/app/controllers/articles_controller.rb +0 -85
- data/test/dummy/app/helpers/articles_helper.rb +0 -2
- data/test/dummy/app/models/article.rb +0 -7
- data/test/dummy/app/views/articles/_form.html.haml +0 -16
- data/test/dummy/app/views/articles/edit.html.haml +0 -7
- data/test/dummy/app/views/articles/index.html.haml +0 -32
- data/test/dummy/app/views/articles/new.html.haml +0 -5
- data/test/dummy/app/views/articles/show.html.haml +0 -14
- data/test/dummy/config/database.yml +0 -42
- data/test/dummy/config/locales/ar.yml +0 -6
- data/test/dummy/config/locales/de.yml +0 -2
- data/test/dummy/config/locales/en.yml +0 -361
- data/test/dummy/config/routes.rb +0 -10
- data/test/dummy/spec/spec_helper.rb +0 -38
- data/test/dummy/test/fixtures/articles.yml +0 -9
- data/test/dummy/test/fixtures/posts.yml +0 -9
- data/test/dummy/test/fixtures/users.yml +0 -11
- data/test/dummy/test/functional/articles_controller_test.rb +0 -49
- data/test/dummy/test/functional/posts_controller_test.rb +0 -49
- data/test/dummy/test/unit/article_test.rb +0 -7
- data/test/dummy/test/unit/helpers/articles_helper_test.rb +0 -4
- data/test/dummy/test/unit/helpers/posts_helper_test.rb +0 -4
- data/test/dummy/test/unit/post_test.rb +0 -7
- data/test/dummy/test/unit/user_test.rb +0 -7
- data/test/fixtures/translation_center/categories.yml +0 -7
- data/test/fixtures/translation_center/translation_keys.yml +0 -11
- data/test/fixtures/translation_center/translations.yml +0 -15
- data/test/functional/translation_center/categories_controller_test.rb +0 -51
- data/test/functional/translation_center/center_controller_test.rb +0 -9
- data/test/functional/translation_center/translation_keys_controller_test.rb +0 -51
- data/test/functional/translation_center/translations_controller_test.rb +0 -51
- data/test/integration/navigation_test.rb +0 -10
- data/test/test_helper.rb +0 -15
- data/test/translation_center_test.rb +0 -7
- data/test/unit/helpers/translation_center/categories_helper_test.rb +0 -6
- data/test/unit/helpers/translation_center/center_helper_test.rb +0 -6
- data/test/unit/helpers/translation_center/translation_keys_helper_test.rb +0 -6
- data/test/unit/helpers/translation_center/translations_helper_test.rb +0 -6
- data/test/unit/translation_center/category_test.rb +0 -9
- data/test/unit/translation_center/translation_key_test.rb +0 -9
- data/test/unit/translation_center/translation_test.rb +0 -9
data/test/dummy/config/routes.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("../../config/environment", __FILE__)
|
4
|
-
require 'rspec/rails'
|
5
|
-
require 'rspec/autorun'
|
6
|
-
|
7
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
-
# in spec/support/ and its subdirectories.
|
9
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
# ## Mock Framework
|
13
|
-
#
|
14
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
-
#
|
16
|
-
# config.mock_with :mocha
|
17
|
-
# config.mock_with :flexmock
|
18
|
-
# config.mock_with :rr
|
19
|
-
|
20
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
-
|
23
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
-
# examples within a transaction, remove the following line or assign false
|
25
|
-
# instead of true.
|
26
|
-
config.use_transactional_fixtures = true
|
27
|
-
|
28
|
-
# If true, the base class of anonymous controllers will be inferred
|
29
|
-
# automatically. This will be the default behavior in future versions of
|
30
|
-
# rspec-rails.
|
31
|
-
config.infer_base_class_for_anonymous_controllers = false
|
32
|
-
|
33
|
-
# Run specs in random order to surface order dependencies. If you find an
|
34
|
-
# order dependency and want to debug it, you can fix the order by providing
|
35
|
-
# the seed, which is printed after each run.
|
36
|
-
# --seed 1234
|
37
|
-
config.order = "random"
|
38
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
|
2
|
-
|
3
|
-
# This model initially had no columns defined. If you add columns to the
|
4
|
-
# model remove the '{}' from the fixture names and add the columns immediately
|
5
|
-
# below each fixture, per the syntax in the comments below
|
6
|
-
#
|
7
|
-
one: {}
|
8
|
-
# column: value
|
9
|
-
#
|
10
|
-
two: {}
|
11
|
-
# column: value
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ArticlesControllerTest < ActionController::TestCase
|
4
|
-
setup do
|
5
|
-
@article = articles(:one)
|
6
|
-
end
|
7
|
-
|
8
|
-
test "should get index" do
|
9
|
-
get :index
|
10
|
-
assert_response :success
|
11
|
-
assert_not_nil assigns(:articles)
|
12
|
-
end
|
13
|
-
|
14
|
-
test "should get new" do
|
15
|
-
get :new
|
16
|
-
assert_response :success
|
17
|
-
end
|
18
|
-
|
19
|
-
test "should create article" do
|
20
|
-
assert_difference('Article.count') do
|
21
|
-
post :create, article: @article.attributes
|
22
|
-
end
|
23
|
-
|
24
|
-
assert_redirected_to article_path(assigns(:article))
|
25
|
-
end
|
26
|
-
|
27
|
-
test "should show article" do
|
28
|
-
get :show, id: @article.to_param
|
29
|
-
assert_response :success
|
30
|
-
end
|
31
|
-
|
32
|
-
test "should get edit" do
|
33
|
-
get :edit, id: @article.to_param
|
34
|
-
assert_response :success
|
35
|
-
end
|
36
|
-
|
37
|
-
test "should update article" do
|
38
|
-
put :update, id: @article.to_param, article: @article.attributes
|
39
|
-
assert_redirected_to article_path(assigns(:article))
|
40
|
-
end
|
41
|
-
|
42
|
-
test "should destroy article" do
|
43
|
-
assert_difference('Article.count', -1) do
|
44
|
-
delete :destroy, id: @article.to_param
|
45
|
-
end
|
46
|
-
|
47
|
-
assert_redirected_to articles_path
|
48
|
-
end
|
49
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PostsControllerTest < ActionController::TestCase
|
4
|
-
setup do
|
5
|
-
@post = posts(:one)
|
6
|
-
end
|
7
|
-
|
8
|
-
test "should get index" do
|
9
|
-
get :index
|
10
|
-
assert_response :success
|
11
|
-
assert_not_nil assigns(:posts)
|
12
|
-
end
|
13
|
-
|
14
|
-
test "should get new" do
|
15
|
-
get :new
|
16
|
-
assert_response :success
|
17
|
-
end
|
18
|
-
|
19
|
-
test "should create post" do
|
20
|
-
assert_difference('Post.count') do
|
21
|
-
post :create, post: { content: @post.content, title: @post.title }
|
22
|
-
end
|
23
|
-
|
24
|
-
assert_redirected_to post_path(assigns(:post))
|
25
|
-
end
|
26
|
-
|
27
|
-
test "should show post" do
|
28
|
-
get :show, id: @post
|
29
|
-
assert_response :success
|
30
|
-
end
|
31
|
-
|
32
|
-
test "should get edit" do
|
33
|
-
get :edit, id: @post
|
34
|
-
assert_response :success
|
35
|
-
end
|
36
|
-
|
37
|
-
test "should update post" do
|
38
|
-
put :update, id: @post, post: { content: @post.content, title: @post.title }
|
39
|
-
assert_redirected_to post_path(assigns(:post))
|
40
|
-
end
|
41
|
-
|
42
|
-
test "should destroy post" do
|
43
|
-
assert_difference('Post.count', -1) do
|
44
|
-
delete :destroy, id: @post
|
45
|
-
end
|
46
|
-
|
47
|
-
assert_redirected_to posts_path
|
48
|
-
end
|
49
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
2
|
-
|
3
|
-
one:
|
4
|
-
translation_key_id: 1
|
5
|
-
value: MyString
|
6
|
-
lang: MyString
|
7
|
-
status: MyString
|
8
|
-
user_id: 1
|
9
|
-
|
10
|
-
two:
|
11
|
-
translation_key_id: 1
|
12
|
-
value: MyString
|
13
|
-
lang: MyString
|
14
|
-
status: MyString
|
15
|
-
user_id: 1
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module TranslationCenter
|
4
|
-
class CategoriesControllerTest < ActionController::TestCase
|
5
|
-
setup do
|
6
|
-
@category = categories(:one)
|
7
|
-
end
|
8
|
-
|
9
|
-
test "should get index" do
|
10
|
-
get :index
|
11
|
-
assert_response :success
|
12
|
-
assert_not_nil assigns(:categories)
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should get new" do
|
16
|
-
get :new
|
17
|
-
assert_response :success
|
18
|
-
end
|
19
|
-
|
20
|
-
test "should create category" do
|
21
|
-
assert_difference('Category.count') do
|
22
|
-
post :create, category: { name: @category.name }
|
23
|
-
end
|
24
|
-
|
25
|
-
assert_redirected_to category_path(assigns(:category))
|
26
|
-
end
|
27
|
-
|
28
|
-
test "should show category" do
|
29
|
-
get :show, id: @category
|
30
|
-
assert_response :success
|
31
|
-
end
|
32
|
-
|
33
|
-
test "should get edit" do
|
34
|
-
get :edit, id: @category
|
35
|
-
assert_response :success
|
36
|
-
end
|
37
|
-
|
38
|
-
test "should update category" do
|
39
|
-
put :update, id: @category, category: { name: @category.name }
|
40
|
-
assert_redirected_to category_path(assigns(:category))
|
41
|
-
end
|
42
|
-
|
43
|
-
test "should destroy category" do
|
44
|
-
assert_difference('Category.count', -1) do
|
45
|
-
delete :destroy, id: @category
|
46
|
-
end
|
47
|
-
|
48
|
-
assert_redirected_to categories_path
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module TranslationCenter
|
4
|
-
class TranslationKeysControllerTest < ActionController::TestCase
|
5
|
-
setup do
|
6
|
-
@translation_key = translation_keys(:one)
|
7
|
-
end
|
8
|
-
|
9
|
-
test "should get index" do
|
10
|
-
get :index
|
11
|
-
assert_response :success
|
12
|
-
assert_not_nil assigns(:translation_keys)
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should get new" do
|
16
|
-
get :new
|
17
|
-
assert_response :success
|
18
|
-
end
|
19
|
-
|
20
|
-
test "should create translation_key" do
|
21
|
-
assert_difference('TranslationKey.count') do
|
22
|
-
post :create, translation_key: { category_id: @translation_key.category_id, last_accessed: @translation_key.last_accessed, name: @translation_key.name }
|
23
|
-
end
|
24
|
-
|
25
|
-
assert_redirected_to translation_key_path(assigns(:translation_key))
|
26
|
-
end
|
27
|
-
|
28
|
-
test "should show translation_key" do
|
29
|
-
get :show, id: @translation_key
|
30
|
-
assert_response :success
|
31
|
-
end
|
32
|
-
|
33
|
-
test "should get edit" do
|
34
|
-
get :edit, id: @translation_key
|
35
|
-
assert_response :success
|
36
|
-
end
|
37
|
-
|
38
|
-
test "should update translation_key" do
|
39
|
-
put :update, id: @translation_key, translation_key: { category_id: @translation_key.category_id, last_accessed: @translation_key.last_accessed, name: @translation_key.name }
|
40
|
-
assert_redirected_to translation_key_path(assigns(:translation_key))
|
41
|
-
end
|
42
|
-
|
43
|
-
test "should destroy translation_key" do
|
44
|
-
assert_difference('TranslationKey.count', -1) do
|
45
|
-
delete :destroy, id: @translation_key
|
46
|
-
end
|
47
|
-
|
48
|
-
assert_redirected_to translation_keys_path
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module TranslationCenter
|
4
|
-
class TranslationsControllerTest < ActionController::TestCase
|
5
|
-
setup do
|
6
|
-
@translation = translations(:one)
|
7
|
-
end
|
8
|
-
|
9
|
-
test "should get index" do
|
10
|
-
get :index
|
11
|
-
assert_response :success
|
12
|
-
assert_not_nil assigns(:translations)
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should get new" do
|
16
|
-
get :new
|
17
|
-
assert_response :success
|
18
|
-
end
|
19
|
-
|
20
|
-
test "should create translation" do
|
21
|
-
assert_difference('Translation.count') do
|
22
|
-
post :create, translation: { lang: @translation.lang, status: @translation.status, translation_key_id: @translation.translation_key_id, user_id: @translation.user_id, value: @translation.value }
|
23
|
-
end
|
24
|
-
|
25
|
-
assert_redirected_to translation_path(assigns(:translation))
|
26
|
-
end
|
27
|
-
|
28
|
-
test "should show translation" do
|
29
|
-
get :show, id: @translation
|
30
|
-
assert_response :success
|
31
|
-
end
|
32
|
-
|
33
|
-
test "should get edit" do
|
34
|
-
get :edit, id: @translation
|
35
|
-
assert_response :success
|
36
|
-
end
|
37
|
-
|
38
|
-
test "should update translation" do
|
39
|
-
put :update, id: @translation, translation: { lang: @translation.lang, status: @translation.status, translation_key_id: @translation.translation_key_id, user_id: @translation.user_id, value: @translation.value }
|
40
|
-
assert_redirected_to translation_path(assigns(:translation))
|
41
|
-
end
|
42
|
-
|
43
|
-
test "should destroy translation" do
|
44
|
-
assert_difference('Translation.count', -1) do
|
45
|
-
delete :destroy, id: @translation
|
46
|
-
end
|
47
|
-
|
48
|
-
assert_redirected_to translations_path
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|