adds initial proposal's feature spec
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<section role="main">
|
||||
|
||||
<div class="wrap row">
|
||||
<div id="Proposals" class="Proposals-list small-12 medium-9 column js-order-<%= @order.dasherize %>">
|
||||
<div id="proposals" class="Proposals-list small-12 medium-9 column js-order-<%= @order.dasherize %>">
|
||||
<div class="filters">
|
||||
<div class="small-12 medium-7 column">
|
||||
<% if @search_terms %>
|
||||
|
||||
52
spec/features/proposals_spec.rb
Normal file
52
spec/features/proposals_spec.rb
Normal file
@@ -0,0 +1,52 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Proposals' do
|
||||
|
||||
scenario 'Index' do
|
||||
proposal = [create(:proposal), create(:proposal), create(:proposal)]
|
||||
|
||||
visit proposals_path
|
||||
|
||||
expect(page).to have_selector('#proposals .proposal', count: 3)
|
||||
proposal.each do |proposal|
|
||||
within('#proposals') do
|
||||
expect(page).to have_content proposal.title
|
||||
expect(page).to have_css("a[href='#{proposal_path(proposal)}']", text: proposal.description)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Paginated Index' do
|
||||
per_page = Kaminari.config.default_per_page
|
||||
(per_page + 2).times { create(:proposal) }
|
||||
|
||||
visit proposals_path
|
||||
|
||||
expect(page).to have_selector('#proposals .proposal', count: per_page)
|
||||
|
||||
within("ul.pagination") do
|
||||
expect(page).to have_content("1")
|
||||
expect(page).to have_content("2")
|
||||
expect(page).to_not have_content("3")
|
||||
click_link "Next", exact: false
|
||||
end
|
||||
|
||||
expect(page).to have_selector('#proposals .proposal', count: 2)
|
||||
end
|
||||
|
||||
scenario 'Show' do
|
||||
proposal = create(:proposal)
|
||||
|
||||
visit proposal_path(proposal)
|
||||
|
||||
expect(page).to have_content proposal.title
|
||||
expect(page).to have_content "Proposal description"
|
||||
expect(page).to have_content proposal.author.name
|
||||
expect(page).to have_content I18n.l(proposal.created_at.to_date)
|
||||
expect(page).to have_selector(avatar(proposal.author.name))
|
||||
|
||||
within('.social-share-button') do
|
||||
expect(page.all('a').count).to be(3) # Twitter, Facebook, Google+
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user