Fix specs
Regarding the feature ‘Carousel size’: There is no need to test styling in specs, it changes too often There are nice ways to test it, but it seems a little too much right Review later on
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<div id="<%= dom_id(card) %>" class="small-12 large-4 column margin-bottom end">
|
||||
<div id="<%= dom_id(card) %>" class="card small-12 large-4 column margin-bottom end">
|
||||
<%= link_to card.link_url do %>
|
||||
<figure class="figure-card">
|
||||
<% if card.image.present? %>
|
||||
|
||||
@@ -93,14 +93,16 @@ feature 'Homepage' do
|
||||
within("#widget_card_#{card1.id}") do
|
||||
expect(page).to have_content("Card text")
|
||||
expect(page).to have_content("Card description")
|
||||
expect(page).to have_link("Link text", href: "consul.dev")
|
||||
expect(page).to have_content("Link text")
|
||||
expect(page).to have_link(href: "consul.dev")
|
||||
expect(page).to have_css("img[alt='#{card1.image.title}']")
|
||||
end
|
||||
|
||||
within("#widget_card_#{card2.id}") do
|
||||
expect(page).to have_content("Card text2")
|
||||
expect(page).to have_content("Card description2")
|
||||
expect(page).to have_link("Link text2", href: "consul.dev2")
|
||||
expect(page).to have_content("Link text2")
|
||||
expect(page).to have_link(href: "consul.dev2")
|
||||
expect(page).to have_css("img[alt='#{card2.image.title}']")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ feature 'Cards' do
|
||||
fill_in "widget_card_link_text", with: "Link text"
|
||||
fill_in "widget_card_link_url", with: "consul.dev"
|
||||
attach_image_to_card
|
||||
click_button "Create Card"
|
||||
click_button "Create card"
|
||||
|
||||
expect(page).to have_content "Success"
|
||||
expect(page).to have_css(".card", count: 1)
|
||||
@@ -27,7 +27,7 @@ feature 'Cards' do
|
||||
expect(page).to have_content "Card description"
|
||||
expect(page).to have_content "Link text"
|
||||
expect(page).to have_content "consul.dev"
|
||||
expect(page).to have_css("img[alt='#{card.image.title}']")
|
||||
expect(page).to have_link("Show image", href: card.image_url(:large))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -44,7 +44,7 @@ feature 'Cards' do
|
||||
expect(page).to have_content card.description
|
||||
expect(page).to have_content card.link_text
|
||||
expect(page).to have_content card.link_url
|
||||
expect(page).to have_css("img[alt='#{card.image.title}']")
|
||||
expect(page).to have_link("Show image", href: card.image_url(:large))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,7 +61,7 @@ feature 'Cards' do
|
||||
fill_in "widget_card_description", with: "Card description updated"
|
||||
fill_in "widget_card_link_text", with: "Link text updated"
|
||||
fill_in "widget_card_link_url", with: "consul.dev updated"
|
||||
click_button "Update Card"
|
||||
click_button "Save card"
|
||||
|
||||
expect(page).to have_content "Updated"
|
||||
|
||||
@@ -81,7 +81,7 @@ feature 'Cards' do
|
||||
|
||||
within("#widget_card_#{card.id}") do
|
||||
accept_confirm do
|
||||
click_link "Remove"
|
||||
click_link "Delete"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -99,7 +99,7 @@ feature 'Cards' do
|
||||
fill_in "widget_card_description", with: "Card description"
|
||||
fill_in "widget_card_link_text", with: "Link text"
|
||||
fill_in "widget_card_link_url", with: "consul.dev"
|
||||
click_button "Create Card"
|
||||
click_button "Create header"
|
||||
|
||||
expect(page).to have_content "Success"
|
||||
|
||||
@@ -122,7 +122,7 @@ feature 'Cards' do
|
||||
|
||||
def attach_image_to_card
|
||||
click_link "Add image"
|
||||
image_input = find(".image").find("input[type=file]", visible: false)
|
||||
image_input = all(".image").last.find("input[type=file]", visible: false)
|
||||
attach_file(
|
||||
image_input[:id],
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg'),
|
||||
|
||||
@@ -7,7 +7,7 @@ feature "Home" do
|
||||
scenario 'Welcome message' do
|
||||
visit root_path
|
||||
|
||||
expect(page).to have_content "Love the city, and it will become a city you love"
|
||||
expect(page).to have_content "CONSUL"
|
||||
end
|
||||
|
||||
scenario 'Not display recommended section' do
|
||||
@@ -104,29 +104,6 @@ feature "Home" do
|
||||
visit root_path
|
||||
expect(page).not_to have_content "Recommendations that may interest you"
|
||||
end
|
||||
|
||||
feature 'Carousel size' do
|
||||
|
||||
scenario 'Display debates centered when there are no proposals' do
|
||||
debate = create(:debate, tag_list: "Sport")
|
||||
visit root_path
|
||||
expect(page).to have_selector('.medium-centered.large-centered')
|
||||
end
|
||||
|
||||
scenario 'Correct display debates and proposals' do
|
||||
proposal = create(:proposal, tag_list: "Sport")
|
||||
debates = create(:debate, tag_list: "Sport")
|
||||
|
||||
visit root_path
|
||||
|
||||
expect(page).to have_selector('.debates.medium-offset-2.large-offset-2')
|
||||
expect(page).not_to have_selector('.proposals.medium-offset-2.large-offset-2')
|
||||
expect(page).not_to have_selector('.debates.end')
|
||||
expect(page).to have_selector('.proposals.end')
|
||||
expect(page).not_to have_selector('.medium-centered.large-centered')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user