Move nested_documentable helper methods to a new common actions module
This commit is contained in:
@@ -316,54 +316,3 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def do_login_for(user)
|
||||
common_do_login_for(user, management: management)
|
||||
end
|
||||
|
||||
def documentable_redirected_to_resource_show_or_navigate_to
|
||||
find("a", text: "Not now, go to my proposal")
|
||||
click_on "Not now, go to my proposal"
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
def documentable_attach_new_file(path, success = true)
|
||||
click_link "Add new document"
|
||||
|
||||
document = all(".document").last
|
||||
attach_file "Choose document", path
|
||||
|
||||
within document do
|
||||
if success
|
||||
expect(page).to have_css ".loading-bar.complete"
|
||||
else
|
||||
expect(page).to have_css ".loading-bar.errors"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def expect_document_has_title(index, title)
|
||||
document = all(".document")[index]
|
||||
|
||||
within document do
|
||||
expect(find("input[name$='[title]']").value).to eq title
|
||||
end
|
||||
end
|
||||
|
||||
def documentable_fill_new_valid_proposal
|
||||
fill_in_new_proposal_title with: "Proposal title #{rand(9999)}"
|
||||
fill_in "Proposal summary", with: "Proposal summary"
|
||||
check :proposal_terms_of_service
|
||||
end
|
||||
|
||||
def documentable_fill_new_valid_dashboard_action
|
||||
fill_in :dashboard_action_title, with: "Dashboard title"
|
||||
fill_in_ckeditor "Description", with: "Dashboard description"
|
||||
end
|
||||
|
||||
def documentable_fill_new_valid_budget_investment
|
||||
fill_in_new_investment_title with: "Budget investment title"
|
||||
fill_in_ckeditor "Description", with: "Budget investment description"
|
||||
check :budget_investment_terms_of_service
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ module CommonActions
|
||||
include Budgets
|
||||
include Comments
|
||||
include Debates
|
||||
include Documents
|
||||
include Emails
|
||||
include Maps
|
||||
include Notifications
|
||||
|
||||
52
spec/support/common_actions/documents.rb
Normal file
52
spec/support/common_actions/documents.rb
Normal file
@@ -0,0 +1,52 @@
|
||||
module Documents
|
||||
def do_login_for(user)
|
||||
common_do_login_for(user, management: management)
|
||||
end
|
||||
|
||||
def documentable_redirected_to_resource_show_or_navigate_to
|
||||
find("a", text: "Not now, go to my proposal")
|
||||
click_on "Not now, go to my proposal"
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
def documentable_attach_new_file(path, success = true)
|
||||
click_link "Add new document"
|
||||
|
||||
document = all(".document").last
|
||||
attach_file "Choose document", path
|
||||
|
||||
within document do
|
||||
if success
|
||||
expect(page).to have_css ".loading-bar.complete"
|
||||
else
|
||||
expect(page).to have_css ".loading-bar.errors"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def expect_document_has_title(index, title)
|
||||
document = all(".document")[index]
|
||||
|
||||
within document do
|
||||
expect(find("input[name$='[title]']").value).to eq title
|
||||
end
|
||||
end
|
||||
|
||||
def documentable_fill_new_valid_proposal
|
||||
fill_in_new_proposal_title with: "Proposal title #{rand(9999)}"
|
||||
fill_in "Proposal summary", with: "Proposal summary"
|
||||
check :proposal_terms_of_service
|
||||
end
|
||||
|
||||
def documentable_fill_new_valid_dashboard_action
|
||||
fill_in :dashboard_action_title, with: "Dashboard title"
|
||||
fill_in_ckeditor "Description", with: "Dashboard description"
|
||||
end
|
||||
|
||||
def documentable_fill_new_valid_budget_investment
|
||||
fill_in_new_investment_title with: "Budget investment title"
|
||||
fill_in_ckeditor "Description", with: "Budget investment description"
|
||||
check :budget_investment_terms_of_service
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user