Add shared nested_documentable specs to admin dashboard actions specs.
Not render Documents count on dashboard actions views. Add skips on nested_documentable when factory_name is equal to dashboard_actions.
This commit is contained in:
@@ -7,6 +7,15 @@ feature 'Admin dashboard actions' do
|
|||||||
login_as(admin.user)
|
login_as(admin.user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it_behaves_like "nested documentable",
|
||||||
|
"administrator",
|
||||||
|
"dashboard_action",
|
||||||
|
"new_admin_dashboard_action_path",
|
||||||
|
{ },
|
||||||
|
"documentable_fill_new_valid_dashboard_action",
|
||||||
|
"Save",
|
||||||
|
"Action created successfully"
|
||||||
|
|
||||||
context 'when visiting index' do
|
context 'when visiting index' do
|
||||||
context 'and no actions defined' do
|
context 'and no actions defined' do
|
||||||
before do
|
before do
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
let!(:administrator) { create(:user) }
|
let!(:administrator) { create(:user) }
|
||||||
let!(:user) { create(:user, :level_two) }
|
let!(:user) { create(:user, :level_two) }
|
||||||
let!(:arguments) { {} }
|
let!(:arguments) { {} }
|
||||||
|
if documentable_factory_name == "dashboard_action"
|
||||||
|
let!(:documentable) { create(documentable_factory_name) }
|
||||||
|
else
|
||||||
let!(:documentable) { create(documentable_factory_name, author: user) }
|
let!(:documentable) { create(documentable_factory_name, author: user) }
|
||||||
|
end
|
||||||
let!(:user_to_login) { send(login_as_name)}
|
let!(:user_to_login) { send(login_as_name)}
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@@ -133,7 +137,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
visit send(path, arguments)
|
visit send(path, arguments)
|
||||||
|
|
||||||
documentable_attach_new_file(
|
documentable_attach_new_file(
|
||||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
Rails.root.join("spec/fixtures/files/logo_header.gif"),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -154,7 +158,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
visit send(path, arguments)
|
visit send(path, arguments)
|
||||||
|
|
||||||
documentable_attach_new_file(
|
documentable_attach_new_file(
|
||||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
Rails.root.join("spec/fixtures/files/logo_header.gif"),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -208,6 +212,9 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should show new document after successful creation with one uploaded file", :js do
|
scenario "Should show new document after successful creation with one uploaded file", :js do
|
||||||
|
if documentable_factory_name == "dashboard_action"
|
||||||
|
skip("Not render Documents count on dashboard_actions")
|
||||||
|
end
|
||||||
login_as user_to_login
|
login_as user_to_login
|
||||||
visit send(path, arguments)
|
visit send(path, arguments)
|
||||||
send(fill_resource_method_name) if fill_resource_method_name
|
send(fill_resource_method_name) if fill_resource_method_name
|
||||||
@@ -227,6 +234,9 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
|
|
||||||
scenario "Should show resource with new document after successful creation with
|
scenario "Should show resource with new document after successful creation with
|
||||||
maximum allowed uploaded files", :js do
|
maximum allowed uploaded files", :js do
|
||||||
|
if documentable_factory_name == "dashboard_action"
|
||||||
|
skip("Not render Documents count on dashboard_actions")
|
||||||
|
end
|
||||||
login_as user_to_login
|
login_as user_to_login
|
||||||
visit send(path, arguments)
|
visit send(path, arguments)
|
||||||
FILENAMES ||= %w(clippy empty logo).freeze
|
FILENAMES ||= %w(clippy empty logo).freeze
|
||||||
@@ -359,6 +369,11 @@ def documentable_fill_new_valid_proposal
|
|||||||
check :proposal_terms_of_service
|
check :proposal_terms_of_service
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def documentable_fill_new_valid_dashboard_action
|
||||||
|
fill_in :dashboard_action_title, with: "Dashboard title"
|
||||||
|
fill_in :dashboard_action_short_description, with: "Dashboard description"
|
||||||
|
end
|
||||||
|
|
||||||
def documentable_fill_new_valid_budget_investment
|
def documentable_fill_new_valid_budget_investment
|
||||||
page.select documentable.heading.name_scoped_by_group, from: :budget_investment_heading_id
|
page.select documentable.heading.name_scoped_by_group, from: :budget_investment_heading_id
|
||||||
fill_in :budget_investment_title, with: "Budget investment title"
|
fill_in :budget_investment_title, with: "Budget investment title"
|
||||||
|
|||||||
Reference in New Issue
Block a user