Adapt translatable shared specs
Adapt translatable shared specs to define an owner when running at frontend feature specs.
This commit is contained in:
committed by
voodoorai2000
parent
cf370cab84
commit
3d04b388ad
@@ -32,6 +32,7 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar
|
|||||||
fields - optional_fields
|
fields - optional_fields
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let(:user) { create(:administrator).user }
|
||||||
let(:translatable) do
|
let(:translatable) do
|
||||||
if factory_name == "budget_phase"
|
if factory_name == "budget_phase"
|
||||||
budget = create(:budget)
|
budget = create(:budget)
|
||||||
@@ -41,9 +42,12 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar
|
|||||||
create(factory_name, attributes)
|
create(factory_name, attributes)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:path) { send(path_name, *resource_hierarchy_for(translatable)) }
|
let(:path) { send(path_name, *resource_hierarchy_for(translatable)) }
|
||||||
before { login_as(create(:administrator).user) }
|
|
||||||
|
before do
|
||||||
|
login_as(user)
|
||||||
|
translatable.update(author: user) if front_end_path_to_visit?(path_name)
|
||||||
|
end
|
||||||
|
|
||||||
context "Manage translations" do
|
context "Manage translations" do
|
||||||
before do
|
before do
|
||||||
@@ -353,3 +357,7 @@ def update_button_text
|
|||||||
"Save changes"
|
"Save changes"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def front_end_path_to_visit?(path)
|
||||||
|
path[/admin|managment|valuation/].blank?
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user