Change single quotes to double quotes
This commit is contained in:
@@ -6,7 +6,7 @@ shared_examples "admin_milestoneable" do |factory_name, path_name|
|
||||
let(:path) { send(path_name, *resource_hierarchy_for(milestoneable)) }
|
||||
|
||||
context "Index" do
|
||||
scenario 'Displaying milestones' do
|
||||
scenario "Displaying milestones" do
|
||||
milestone = create(:milestone, milestoneable: milestoneable)
|
||||
create(:image, imageable: milestone)
|
||||
document = create(:document, documentable: milestone)
|
||||
@@ -18,11 +18,11 @@ shared_examples "admin_milestoneable" do |factory_name, path_name|
|
||||
expect(page).to have_content(milestone.id)
|
||||
expect(page).to have_content(milestone.publication_date.to_date)
|
||||
expect(page).to have_content(milestone.status.name)
|
||||
expect(page).to have_link 'Show image'
|
||||
expect(page).to have_link "Show image"
|
||||
expect(page).to have_link document.title
|
||||
end
|
||||
|
||||
scenario 'Displaying no_milestones text' do
|
||||
scenario "Displaying no_milestones text" do
|
||||
visit path
|
||||
|
||||
expect(page).to have_content("Milestone")
|
||||
@@ -35,15 +35,15 @@ shared_examples "admin_milestoneable" do |factory_name, path_name|
|
||||
status = create(:milestone_status)
|
||||
visit path
|
||||
|
||||
click_link 'Create new milestone'
|
||||
click_link "Create new milestone"
|
||||
|
||||
select status.name, from: 'milestone_status_id'
|
||||
fill_in 'Description', with: 'New description milestone'
|
||||
fill_in 'milestone_publication_date', with: Date.current
|
||||
select status.name, from: "milestone_status_id"
|
||||
fill_in "Description", with: "New description milestone"
|
||||
fill_in "milestone_publication_date", with: Date.current
|
||||
|
||||
click_button 'Create milestone'
|
||||
click_button "Create milestone"
|
||||
|
||||
expect(page).to have_content 'New description milestone'
|
||||
expect(page).to have_content "New description milestone"
|
||||
expect(page).to have_content Date.current
|
||||
expect(page).to have_content status.name
|
||||
end
|
||||
@@ -51,22 +51,22 @@ shared_examples "admin_milestoneable" do |factory_name, path_name|
|
||||
scenario "Status select is disabled if there are no statuses available" do
|
||||
visit path
|
||||
|
||||
click_link 'Create new milestone'
|
||||
click_link "Create new milestone"
|
||||
expect(find("#milestone_status_id").disabled?).to be true
|
||||
end
|
||||
|
||||
scenario "Show validation errors on milestone form" do
|
||||
visit path
|
||||
|
||||
click_link 'Create new milestone'
|
||||
click_link "Create new milestone"
|
||||
|
||||
fill_in 'Description', with: 'New description milestone'
|
||||
fill_in "Description", with: "New description milestone"
|
||||
|
||||
click_button 'Create milestone'
|
||||
click_button "Create milestone"
|
||||
|
||||
within "#new_milestone" do
|
||||
expect(page).to have_content "can't be blank", count: 1
|
||||
expect(page).to have_content 'New description milestone'
|
||||
expect(page).to have_content "New description milestone"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,16 +96,16 @@ shared_examples "admin_milestoneable" do |factory_name, path_name|
|
||||
|
||||
expect(page).to have_css("img[alt='#{milestone.image.title}']")
|
||||
|
||||
fill_in 'Description', with: 'Changed description'
|
||||
fill_in 'milestone_publication_date', with: Date.current
|
||||
fill_in 'milestone_documents_attributes_0_title', with: 'New document title'
|
||||
fill_in "Description", with: "Changed description"
|
||||
fill_in "milestone_publication_date", with: Date.current
|
||||
fill_in "milestone_documents_attributes_0_title", with: "New document title"
|
||||
|
||||
click_button 'Update milestone'
|
||||
click_button "Update milestone"
|
||||
|
||||
expect(page).to have_content 'Changed description'
|
||||
expect(page).to have_content "Changed description"
|
||||
expect(page).to have_content Date.current
|
||||
expect(page).to have_link 'Show image'
|
||||
expect(page).to have_link 'New document title'
|
||||
expect(page).to have_link "Show image"
|
||||
expect(page).to have_link "New document title"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,7 +117,7 @@ shared_examples "admin_milestoneable" do |factory_name, path_name|
|
||||
|
||||
click_link "Delete milestone"
|
||||
|
||||
expect(page).not_to have_content 'Title will it remove'
|
||||
expect(page).not_to have_content "Title will it remove"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,11 +70,11 @@ shared_examples "documentable" do |documentable_factory_name,
|
||||
|
||||
describe "When allow attached documents setting is enabled" do
|
||||
before do
|
||||
Setting['feature.allow_attached_documents'] = true
|
||||
Setting["feature.allow_attached_documents"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting['feature.allow_attached_documents'] = false
|
||||
Setting["feature.allow_attached_documents"] = false
|
||||
end
|
||||
|
||||
scenario "Documents list should be available" do
|
||||
@@ -97,11 +97,11 @@ shared_examples "documentable" do |documentable_factory_name,
|
||||
|
||||
describe "When allow attached documents setting is disabled" do
|
||||
before do
|
||||
Setting['feature.allow_attached_documents'] = false
|
||||
Setting["feature.allow_attached_documents"] = false
|
||||
end
|
||||
|
||||
after do
|
||||
Setting['feature.allow_attached_documents'] = true
|
||||
Setting["feature.allow_attached_documents"] = true
|
||||
end
|
||||
|
||||
scenario "Documents list should not be available" do
|
||||
|
||||
@@ -3,7 +3,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
||||
|
||||
let!(:arguments) { {} }
|
||||
let!(:followable) { create(followable_class_name) }
|
||||
let!(:followable_dom_name) { followable_class_name.tr('_', '-') }
|
||||
let!(:followable_dom_name) { followable_class_name.tr("_", "-") }
|
||||
|
||||
before do
|
||||
followable_path_arguments.each do |argument_name, path_to_value|
|
||||
|
||||
@@ -15,7 +15,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
let(:management) { management }
|
||||
|
||||
before do
|
||||
Setting['feature.map'] = true
|
||||
Setting["feature.map"] = true
|
||||
end
|
||||
|
||||
describe "At #{mappable_new_path}" do
|
||||
@@ -69,7 +69,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
end
|
||||
|
||||
scenario "Can not display map on #{mappable_factory_name} when feature.map is disabled", :js do
|
||||
Setting['feature.map'] = false
|
||||
Setting["feature.map"] = false
|
||||
do_login_for user
|
||||
visit send(mappable_new_path, arguments)
|
||||
|
||||
@@ -80,7 +80,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
expect(page).not_to have_css(".map_location")
|
||||
end
|
||||
|
||||
scenario 'Errors on create' do
|
||||
scenario "Errors on create" do
|
||||
do_login_for user
|
||||
visit send(mappable_new_path, arguments)
|
||||
|
||||
@@ -89,7 +89,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
expect(page).to have_content "Map location can't be blank"
|
||||
end
|
||||
|
||||
scenario 'Skip map', :js do
|
||||
scenario "Skip map", :js do
|
||||
do_login_for user
|
||||
visit send(mappable_new_path, arguments)
|
||||
|
||||
@@ -100,7 +100,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
expect(page).not_to have_content "Map location can't be blank"
|
||||
end
|
||||
|
||||
scenario 'Toggle map', :js do
|
||||
scenario "Toggle map", :js do
|
||||
do_login_for user
|
||||
visit send(mappable_new_path, arguments)
|
||||
|
||||
@@ -168,7 +168,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
end
|
||||
|
||||
scenario "Can not display map on #{mappable_factory_name} edit when feature.map is disabled", :js do
|
||||
Setting['feature.map'] = false
|
||||
Setting["feature.map"] = false
|
||||
do_login_for mappable.author
|
||||
|
||||
visit send(mappable_edit_path, id: mappable.id)
|
||||
@@ -178,7 +178,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
expect(page).not_to have_css(".map_location")
|
||||
end
|
||||
|
||||
scenario 'No errors on update', :js do
|
||||
scenario "No errors on update", :js do
|
||||
skip ""
|
||||
do_login_for mappable.author
|
||||
|
||||
@@ -189,7 +189,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
expect(page).not_to have_content "Map location can't be blank"
|
||||
end
|
||||
|
||||
scenario 'No need to skip map on update' do
|
||||
scenario "No need to skip map on update" do
|
||||
do_login_for mappable.author
|
||||
|
||||
visit send(mappable_edit_path, id: mappable.id)
|
||||
@@ -227,7 +227,7 @@ shared_examples "mappable" do |mappable_factory_name,
|
||||
end
|
||||
|
||||
scenario "Should not display map on #{mappable_factory_name} show page when feature.map is disable", :js do
|
||||
Setting['feature.map'] = false
|
||||
Setting["feature.map"] = false
|
||||
arguments[:id] = mappable.id
|
||||
|
||||
visit send(mappable_show_path, arguments)
|
||||
@@ -249,17 +249,17 @@ def do_login_for(user)
|
||||
end
|
||||
|
||||
def fill_in_proposal_form
|
||||
fill_in 'proposal_title', with: 'Help refugees'
|
||||
fill_in 'proposal_question', with: '¿Would you like to give assistance to war refugees?'
|
||||
fill_in 'proposal_summary', with: 'In summary, what we want is...'
|
||||
fill_in "proposal_title", with: "Help refugees"
|
||||
fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?"
|
||||
fill_in "proposal_summary", with: "In summary, what we want is..."
|
||||
end
|
||||
|
||||
def submit_proposal_form
|
||||
check :proposal_terms_of_service
|
||||
click_button 'Create proposal'
|
||||
click_button "Create proposal"
|
||||
|
||||
if page.has_content?('Not now, go to my proposal')
|
||||
click_link 'Not now, go to my proposal'
|
||||
if page.has_content?("Not now, go to my proposal")
|
||||
click_link "Not now, go to my proposal"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -279,7 +279,7 @@ end
|
||||
|
||||
def submit_budget_investment_form
|
||||
check :budget_investment_terms_of_service
|
||||
click_button 'Create Investment'
|
||||
click_button "Create Investment"
|
||||
end
|
||||
|
||||
def set_arguments(arguments, mappable, mappable_path_arguments)
|
||||
|
||||
@@ -24,22 +24,22 @@ shared_examples "milestoneable" do |factory_name, path_name|
|
||||
find("#tab-milestones-label").click
|
||||
|
||||
within("#tab-milestones") do
|
||||
expect(first_milestone.description).to appear_before('Last milestone with a link to https://consul.dev')
|
||||
expect(first_milestone.description).to appear_before("Last milestone with a link to https://consul.dev")
|
||||
expect(page).to have_content(Date.tomorrow)
|
||||
expect(page).to have_content(Date.yesterday)
|
||||
expect(page).not_to have_content(Date.current)
|
||||
expect(page.find("#image_#{first_milestone.id}")['alt']).to have_content(image.title)
|
||||
expect(page.find("#image_#{first_milestone.id}")["alt"]).to have_content(image.title)
|
||||
expect(page).to have_link(document.title)
|
||||
expect(page).to have_link("https://consul.dev")
|
||||
expect(page).to have_content(first_milestone.status.name)
|
||||
end
|
||||
|
||||
select('Español', from: 'locale-switcher')
|
||||
select("Español", from: "locale-switcher")
|
||||
|
||||
find("#tab-milestones-label").click
|
||||
|
||||
within("#tab-milestones") do
|
||||
expect(page).to have_content('Último hito con el link https://consul.dev')
|
||||
expect(page).to have_content("Último hito con el link https://consul.dev")
|
||||
expect(page).to have_link("https://consul.dev")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,11 +52,11 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
login_as user_to_login
|
||||
visit send(path, arguments)
|
||||
documentable.class.max_documents_allowed.times.each do
|
||||
documentable_attach_new_file(Rails.root.join('spec/fixtures/files/empty.pdf'))
|
||||
documentable_attach_new_file(Rails.root.join("spec/fixtures/files/empty.pdf"))
|
||||
end
|
||||
|
||||
expect(page).to have_css ".max-documents-notice", visible: true
|
||||
expect(page).to have_content 'Remove document'
|
||||
expect(page).to have_content "Remove document"
|
||||
end
|
||||
|
||||
scenario "Should hide max documents warning after any document removal", :js do
|
||||
@@ -81,7 +81,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
document = find(".document input[type=file]", visible: false)
|
||||
attach_file(
|
||||
document[:id],
|
||||
Rails.root.join('spec/fixtures/files/empty.pdf'),
|
||||
Rails.root.join("spec/fixtures/files/empty.pdf"),
|
||||
make_visible: true
|
||||
)
|
||||
end
|
||||
@@ -94,7 +94,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
login_as user_to_login
|
||||
visit send(path, arguments)
|
||||
|
||||
documentable_attach_new_file(Rails.root.join('spec/fixtures/files/empty.pdf'))
|
||||
documentable_attach_new_file(Rails.root.join("spec/fixtures/files/empty.pdf"))
|
||||
|
||||
expect_document_has_title(0, "empty.pdf")
|
||||
end
|
||||
@@ -111,7 +111,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
document_input = find("input[type=file]", visible: false)
|
||||
attach_file(
|
||||
document_input[:id],
|
||||
Rails.root.join('spec/fixtures/files/empty.pdf'),
|
||||
Rails.root.join("spec/fixtures/files/empty.pdf"),
|
||||
make_visible: true
|
||||
)
|
||||
end
|
||||
@@ -123,7 +123,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
login_as user_to_login
|
||||
visit send(path, arguments)
|
||||
|
||||
documentable_attach_new_file(Rails.root.join('spec/fixtures/files/empty.pdf'))
|
||||
documentable_attach_new_file(Rails.root.join("spec/fixtures/files/empty.pdf"))
|
||||
|
||||
expect(page).to have_css ".loading-bar.complete"
|
||||
end
|
||||
@@ -133,7 +133,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
visit send(path, arguments)
|
||||
|
||||
documentable_attach_new_file(
|
||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
||||
Rails.root.join("spec/fixtures/files/logo_header.png"),
|
||||
false
|
||||
)
|
||||
|
||||
@@ -144,7 +144,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
login_as user_to_login
|
||||
visit send(path, arguments)
|
||||
|
||||
documentable_attach_new_file(Rails.root.join('spec/fixtures/files/empty.pdf'))
|
||||
documentable_attach_new_file(Rails.root.join("spec/fixtures/files/empty.pdf"))
|
||||
|
||||
expect_document_has_cached_attachment(0, ".pdf")
|
||||
end
|
||||
@@ -154,7 +154,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
visit send(path, arguments)
|
||||
|
||||
documentable_attach_new_file(
|
||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
||||
Rails.root.join("spec/fixtures/files/logo_header.png"),
|
||||
false
|
||||
)
|
||||
|
||||
@@ -178,7 +178,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
login_as user_to_login
|
||||
visit send(path, arguments)
|
||||
|
||||
documentable_attach_new_file(Rails.root.join('spec/fixtures/files/empty.pdf'))
|
||||
documentable_attach_new_file(Rails.root.join("spec/fixtures/files/empty.pdf"))
|
||||
click_link "Remove document"
|
||||
|
||||
expect(page).not_to have_css("#nested-documents .document")
|
||||
@@ -201,7 +201,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
visit send(path, arguments)
|
||||
send(fill_resource_method_name) if fill_resource_method_name
|
||||
|
||||
documentable_attach_new_file(Rails.root.join('spec/fixtures/files/empty.pdf'))
|
||||
documentable_attach_new_file(Rails.root.join("spec/fixtures/files/empty.pdf"))
|
||||
click_on submit_button
|
||||
|
||||
expect(page).to have_content documentable_success_notice
|
||||
@@ -212,7 +212,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
visit send(path, arguments)
|
||||
send(fill_resource_method_name) if fill_resource_method_name
|
||||
|
||||
documentable_attach_new_file(Rails.root.join('spec/fixtures/files/empty.pdf'))
|
||||
documentable_attach_new_file(Rails.root.join("spec/fixtures/files/empty.pdf"))
|
||||
click_on submit_button
|
||||
|
||||
documentable_redirected_to_resource_show_or_navigate_to
|
||||
@@ -287,11 +287,11 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
|
||||
describe "When allow attached documents setting is disabled" do
|
||||
before do
|
||||
Setting['feature.allow_attached_documents'] = false
|
||||
Setting["feature.allow_attached_documents"] = false
|
||||
end
|
||||
|
||||
after do
|
||||
Setting['feature.allow_attached_documents'] = true
|
||||
Setting["feature.allow_attached_documents"] = true
|
||||
end
|
||||
|
||||
scenario "Add new document button should not be available" do
|
||||
|
||||
@@ -13,7 +13,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
|
||||
before do
|
||||
|
||||
Setting['feature.allow_images'] = true
|
||||
Setting["feature.allow_images"] = true
|
||||
|
||||
imageable_path_arguments&.each do |argument_name, path_to_value|
|
||||
arguments.merge!("#{argument_name}": imageable.send(path_to_value))
|
||||
@@ -23,7 +23,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
end
|
||||
|
||||
after do
|
||||
Setting['feature.allow_images'] = nil
|
||||
Setting["feature.allow_images"] = nil
|
||||
end
|
||||
|
||||
describe "at #{path}" do
|
||||
@@ -52,7 +52,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
image_input = find(".image").find("input[type=file]", visible: false)
|
||||
attach_file(
|
||||
image_input[:id],
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg'),
|
||||
Rails.root.join("spec/fixtures/files/clippy.jpg"),
|
||||
make_visible: true
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
||||
)
|
||||
|
||||
expect_image_has_title("clippy.jpg")
|
||||
@@ -81,7 +81,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
image_input = find(".image").find("input[type=file]", visible: false)
|
||||
attach_file(
|
||||
image_input[:id],
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg'),
|
||||
Rails.root.join("spec/fixtures/files/clippy.jpg"),
|
||||
make_visible: true
|
||||
)
|
||||
|
||||
@@ -98,7 +98,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
||||
)
|
||||
|
||||
expect(page).to have_selector ".loading-bar.complete"
|
||||
@@ -110,7 +110,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
||||
Rails.root.join("spec/fixtures/files/logo_header.png"),
|
||||
false
|
||||
)
|
||||
|
||||
@@ -123,7 +123,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
||||
)
|
||||
|
||||
expect_image_has_cached_attachment(".jpg")
|
||||
@@ -135,7 +135,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/logo_header.png'),
|
||||
Rails.root.join("spec/fixtures/files/logo_header.png"),
|
||||
false
|
||||
)
|
||||
|
||||
@@ -164,7 +164,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
||||
)
|
||||
|
||||
within "#nested-image .image" do
|
||||
@@ -194,7 +194,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
||||
)
|
||||
|
||||
click_on submit_button
|
||||
@@ -209,7 +209,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path,
|
||||
|
||||
imageable_attach_new_file(
|
||||
imageable_factory_name,
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg')
|
||||
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
||||
)
|
||||
|
||||
click_on submit_button
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
shared_examples "relationable" do |relationable_model_name|
|
||||
|
||||
let(:relationable) { create(relationable_model_name.name.parameterize('_').to_sym) }
|
||||
let(:relationable) { create(relationable_model_name.name.parameterize("_").to_sym) }
|
||||
let(:related1) { create([:proposal, :debate, :budget_investment].sample) }
|
||||
let(:related2) { create([:proposal, :debate, :budget_investment].sample) }
|
||||
let(:user) { create(:user) }
|
||||
|
||||
scenario 'related contents are listed' do
|
||||
scenario "related contents are listed" do
|
||||
related_content = create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user))
|
||||
|
||||
visit relationable.url
|
||||
@@ -19,21 +19,21 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'related contents list is not rendered if there are no relations' do
|
||||
scenario "related contents list is not rendered if there are no relations" do
|
||||
visit relationable.url
|
||||
expect(page).not_to have_css("#related-content-list")
|
||||
end
|
||||
|
||||
scenario 'related contents can be added' do
|
||||
scenario "related contents can be added" do
|
||||
login_as(user)
|
||||
visit relationable.url
|
||||
|
||||
expect(page).to have_selector('#related_content', visible: false)
|
||||
expect(page).to have_selector("#related_content", visible: false)
|
||||
click_on("Add related content")
|
||||
expect(page).to have_selector('#related_content', visible: true)
|
||||
expect(page).to have_selector("#related_content", visible: true)
|
||||
|
||||
within("#related_content") do
|
||||
fill_in 'url', with: "#{Setting['url'] + related1.url}"
|
||||
fill_in "url", with: "#{Setting["url"] + related1.url}"
|
||||
click_button "Add"
|
||||
end
|
||||
|
||||
@@ -57,21 +57,21 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'if related content URL is invalid returns error' do
|
||||
scenario "if related content URL is invalid returns error" do
|
||||
login_as(user)
|
||||
visit relationable.url
|
||||
|
||||
click_on("Add related content")
|
||||
|
||||
within("#related_content") do
|
||||
fill_in 'url', with: "http://invalidurl.com"
|
||||
fill_in "url", with: "http://invalidurl.com"
|
||||
click_button "Add"
|
||||
end
|
||||
|
||||
expect(page).to have_content("Link not valid. Remember to start with #{Setting[:url]}.")
|
||||
end
|
||||
|
||||
scenario 'returns error when relating content URL to itself' do
|
||||
scenario "returns error when relating content URL to itself" do
|
||||
login_as(user)
|
||||
visit relationable.url
|
||||
|
||||
@@ -85,7 +85,7 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
expect(page).to have_content("Link not valid. You cannot relate a content to itself")
|
||||
end
|
||||
|
||||
scenario 'related content can be scored positively', :js do
|
||||
scenario "related content can be scored positively", :js do
|
||||
related_content = create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user))
|
||||
|
||||
login_as(user)
|
||||
@@ -102,7 +102,7 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
|
||||
end
|
||||
|
||||
scenario 'related content can be scored negatively', :js do
|
||||
scenario "related content can be scored negatively", :js do
|
||||
related_content = create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user))
|
||||
|
||||
login_as(user)
|
||||
@@ -118,7 +118,7 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
expect(related_content.opposite_related_content.related_content_scores.find_by(user_id: user.id, related_content_id: related_content.opposite_related_content.id).value).to eq(-1)
|
||||
end
|
||||
|
||||
scenario 'if related content has negative score it will be hidden' do
|
||||
scenario "if related content has negative score it will be hidden" do
|
||||
related_content = create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user))
|
||||
|
||||
2.times do
|
||||
|
||||
@@ -104,7 +104,7 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar
|
||||
|
||||
expect_page_to_have_translatable_field field, :en, with: text_for(field, :en)
|
||||
|
||||
select('Español', from: 'locale-switcher')
|
||||
select("Español", from: "locale-switcher")
|
||||
|
||||
expect_page_to_have_translatable_field field, :es, with: updated_text
|
||||
end
|
||||
@@ -190,7 +190,7 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar
|
||||
expect_page_to_have_translatable_field field, :es, with: text_for(field, :es)
|
||||
end
|
||||
|
||||
scenario 'Change value of a translated field to blank', :js do
|
||||
scenario "Change value of a translated field to blank", :js do
|
||||
skip("can't have translatable blank fields") if optional_fields.empty?
|
||||
|
||||
field = optional_fields.sample
|
||||
@@ -198,11 +198,11 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar
|
||||
visit path
|
||||
expect_page_to_have_translatable_field field, :en, with: text_for(field, :en)
|
||||
|
||||
fill_in_field field, :en, with: ''
|
||||
fill_in_field field, :en, with: ""
|
||||
click_button update_button_text
|
||||
|
||||
visit path
|
||||
expect_page_to_have_translatable_field field, :en, with: ''
|
||||
expect_page_to_have_translatable_field field, :en, with: ""
|
||||
end
|
||||
|
||||
scenario "Add a translation for a locale with non-underscored name", :js do
|
||||
@@ -214,7 +214,7 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar
|
||||
|
||||
visit path
|
||||
|
||||
select('Português brasileiro', from: 'locale-switcher')
|
||||
select("Português brasileiro", from: "locale-switcher")
|
||||
|
||||
field = fields.sample
|
||||
expect_page_to_have_translatable_field field, :"pt-BR", with: text_for(field, :"pt-BR")
|
||||
@@ -227,7 +227,7 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar
|
||||
|
||||
expect(find("a.js-globalize-locale-link.is-active")).to have_content "English"
|
||||
|
||||
select('Español', from: 'locale-switcher')
|
||||
select("Español", from: "locale-switcher")
|
||||
|
||||
expect(find("a.js-globalize-locale-link.is-active")).to have_content "Español"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user