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
|
||||
end
|
||||
|
||||
let(:user) { create(:administrator).user }
|
||||
let(:translatable) do
|
||||
if factory_name == "budget_phase"
|
||||
budget = create(:budget)
|
||||
@@ -41,9 +42,12 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar
|
||||
create(factory_name, attributes)
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
before do
|
||||
@@ -353,3 +357,7 @@ def update_button_text
|
||||
"Save changes"
|
||||
end
|
||||
end
|
||||
|
||||
def front_end_path_to_visit?(path)
|
||||
path[/admin|managment|valuation/].blank?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user