diff --git a/app/views/welcome/_card.html.erb b/app/views/welcome/_card.html.erb index a3ed3e37c..473138e53 100644 --- a/app/views/welcome/_card.html.erb +++ b/app/views/welcome/_card.html.erb @@ -1,4 +1,4 @@ -
+
<%= link_to card.link_url do %>
<% if card.image.present? %> diff --git a/spec/features/admin/homepage/homepage_spec.rb b/spec/features/admin/homepage/homepage_spec.rb index 67623a2ba..d047546a0 100644 --- a/spec/features/admin/homepage/homepage_spec.rb +++ b/spec/features/admin/homepage/homepage_spec.rb @@ -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 diff --git a/spec/features/admin/widgets/cards_spec.rb b/spec/features/admin/widgets/cards_spec.rb index 57609d0fb..ac5d3b9fd 100644 --- a/spec/features/admin/widgets/cards_spec.rb +++ b/spec/features/admin/widgets/cards_spec.rb @@ -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'), diff --git a/spec/features/home_spec.rb b/spec/features/home_spec.rb index 90a267eea..48eda6fdf 100644 --- a/spec/features/home_spec.rb +++ b/spec/features/home_spec.rb @@ -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