Change single quotes to double quotes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user