Simpler calls to *_translatable shared specs

Enable translations interface setting inside shared specs when needed.

Co-Authored-By: javierm <javim@elretirao.net>
This commit is contained in:
Senén Rodero Rodríguez
2019-05-09 19:24:52 +02:00
committed by voodoorai2000
parent 73563e5d86
commit 264b3f0f82
5 changed files with 31 additions and 41 deletions

View File

@@ -24,16 +24,11 @@ describe "Budget Investments" do
context "Concerns" do context "Concerns" do
it_behaves_like "notifiable in-app", Budget::Investment it_behaves_like "notifiable in-app", Budget::Investment
it_behaves_like "relationable", Budget::Investment it_behaves_like "relationable", Budget::Investment
context "Translatable at front end" do it_behaves_like "new_translatable",
before do "budget_investment",
Setting["feature.translation_interface"] = true "new_budget_investment_path",
end %w[title],
it_behaves_like "new_translatable", { "description" => :ckeditor }
"budget_investment",
"new_budget_investment_path",
%w[title],
{ "description" => :ckeditor }
end
end end
context "Load" do context "Load" do

View File

@@ -11,21 +11,16 @@ describe "Debates" do
context "Concerns" do context "Concerns" do
it_behaves_like "notifiable in-app", Debate it_behaves_like "notifiable in-app", Debate
it_behaves_like "relationable", Debate it_behaves_like "relationable", Debate
context "Translatable at front end" do it_behaves_like "new_translatable",
before do "debate",
Setting["feature.translation_interface"] = true "new_debate_path",
end %w[title],
it_behaves_like "new_translatable", { "description" => :ckeditor }
"debate", it_behaves_like "edit_translatable",
"new_debate_path", "debate",
%w[title], "edit_debate_path",
{ "description" => :ckeditor } %w[title],
it_behaves_like "edit_translatable", { "description" => :ckeditor }
"debate",
"edit_debate_path",
%w[title],
{ "description" => :ckeditor }
end
end end
scenario "Index" do scenario "Index" do

View File

@@ -15,21 +15,16 @@ describe "Proposals" do
context "Concerns" do context "Concerns" do
it_behaves_like "notifiable in-app", Proposal it_behaves_like "notifiable in-app", Proposal
it_behaves_like "relationable", Proposal it_behaves_like "relationable", Proposal
context "Translatable at front end" do it_behaves_like "new_translatable",
before do "proposal",
Setting["feature.translation_interface"] = true "new_proposal_path",
end %w[title summary],
it_behaves_like "new_translatable", { "description" => :ckeditor }
"proposal", it_behaves_like "edit_translatable",
"new_proposal_path", "proposal",
%w[title summary], "edit_proposal_path",
{ "description" => :ckeditor } %w[title summary],
it_behaves_like "edit_translatable", { "description" => :ckeditor }
"proposal",
"edit_proposal_path",
%w[title summary],
{ "description" => :ckeditor }
end
end end
context "Index" do context "Index" do

View File

@@ -46,7 +46,11 @@ shared_examples "edit_translatable" do |factory_name, path_name, input_fields, t
before do before do
login_as(user) login_as(user)
translatable.update(author: user) if front_end_path_to_visit?(path_name)
if front_end_path_to_visit?(path_name)
Setting["feature.translation_interface"] = true
translatable.update(author: user)
end
end end
context "Manage translations" do context "Manage translations" do

View File

@@ -43,6 +43,7 @@ shared_examples "new_translatable" do |factory_name, path_name, input_fields, te
end end
before do before do
Setting["feature.translation_interface"] = true
login_as(user) login_as(user)
end end