diff --git a/db/schema.rb b/db/schema.rb index fc9c3e387..2ec4f7e43 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -95,9 +95,8 @@ ActiveRecord::Schema.define(version: 20170704105112) do create_table "budget_ballots", force: :cascade do |t| t.integer "user_id" t.integer "budget_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "ballot_lines_count", default: 0 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "budget_groups", force: :cascade do |t| diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 82700255a..e2d85a4f5 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -329,7 +329,7 @@ feature 'Budget Investments' do end end - scenario "Not sow flaggable buttons" do + scenario "Don't display flaggable buttons" do investment = create(:budget_investment, heading: heading) visit budget_investment_path(budget_id: budget.id, id: investment.id) diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index 0e7a1c6f7..be6411aed 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -36,7 +36,7 @@ feature 'Proposal Notifications' do expect(Notification.count).to eq(1) end - scenario "Send a notification (Follower user)" do + scenario "Send a notification (Follower)" do author = create(:user) proposal = create(:proposal, author: author) user_follower = create(:user) @@ -47,7 +47,7 @@ feature 'Proposal Notifications' do expect(Notification.count).to eq(1) end - scenario "Send a notification (Follower user and Active voter)" do + scenario "Send a notification (Follower and Voter)" do author = create(:user) proposal = create(:proposal, author: author) diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index fac6b1155..e770ca2f3 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -218,7 +218,7 @@ feature 'Users' do @user = create(:user) end - scenario 'show interests' do + scenario 'Display interests' do proposal = create(:proposal, tag_list: "Sport") create(:follow, :followed_proposal, followable: proposal, user: @user) @@ -234,7 +234,7 @@ feature 'Users' do expect(page).to have_content("Sport") end - scenario 'not show interests when proposal has been destroyed' do + scenario 'Not display interests when proposal has been destroyed' do proposal = create(:proposal, tag_list: "Sport") create(:follow, :followed_proposal, followable: proposal, user: @user) proposal.destroy @@ -251,14 +251,14 @@ feature 'Users' do expect(page).not_to have_content("Sport") end - scenario 'no visible by default' do + scenario 'No visible by default' do visit user_path(@user) expect(page).to have_content(@user.username) expect(page).not_to have_css('#public_interests') end - scenario 'user can show public page' do + scenario 'User can display public page' do login_as(@user) visit account_path @@ -271,7 +271,7 @@ feature 'Users' do expect(page).to have_css('#public_interests') end - scenario 'is always visible for the owner' do + scenario 'Is always visible for the owner' do login_as(@user) visit account_path @@ -282,7 +282,7 @@ feature 'Users' do expect(page).to have_css('#public_interests') end - scenario 'is always visible for admins' do + scenario 'Is always visible for admins' do login_as(@user) visit account_path @@ -296,7 +296,7 @@ feature 'Users' do expect(page).to have_css('#public_interests') end - scenario 'is always visible for moderators' do + scenario 'Is always visible for moderators' do login_as(@user) visit account_path diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index 46fa4653b..f01ee04fc 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -8,17 +8,17 @@ describe Follow do expect(follow).to be_valid end - it "should not be valid without an user_id" do + it "should not be valid without a user_id" do follow.user_id = nil expect(follow).to_not be_valid end - it "should not be valid without an followable_id" do + it "should not be valid without a followable_id" do follow.followable_id = nil expect(follow).to_not be_valid end - it "should not be valid without an followable_type" do + it "should not be valid without a followable_type" do follow.followable_type = nil expect(follow).to_not be_valid end diff --git a/spec/shared/features/followable.rb b/spec/shared/features/followable.rb index 992d625f5..7285ee15f 100644 --- a/spec/shared/features/followable.rb +++ b/spec/shared/features/followable.rb @@ -1,4 +1,4 @@ -RSpec.shared_examples "followable" do |followable_class_name, followable_path, followable_path_arguments| +shared_examples "followable" do |followable_class_name, followable_path, followable_path_arguments| include ActionView::Helpers let!(:arguments) { {} } @@ -11,73 +11,73 @@ RSpec.shared_examples "followable" do |followable_class_name, followable_path, f end end - scenario "Should not show follow button when there is no logged user" do - visit send(followable_path, arguments) + context "Show" do - within "##{dom_id(followable)}" do - expect(page).not_to have_link("Follow") + scenario "Should not display follow button when there is no logged user" do + visit send(followable_path, arguments) + + within "##{dom_id(followable)}" do + expect(page).not_to have_link("Follow") + end end - end - scenario "Should show follow button when user is logged in" do - user = create(:user) - login_as(user) + scenario "Should display follow button when user is logged in" do + user = create(:user) + login_as(user) - visit send(followable_path, arguments) + visit send(followable_path, arguments) + + within "##{dom_id(followable)}" do + expect(page).to have_link("Follow") + end + end + + scenario "Should display follow button when user is logged and is not following" do + user = create(:user) + login_as(user) + + visit send(followable_path, arguments) - within "##{dom_id(followable)}" do expect(page).to have_link("Follow") end - end - scenario "Following", :js do - user = create(:user) - login_as(user) + scenario "Should display unfollow button when click on follow button", :js do + user = create(:user) + login_as(user) - visit send(followable_path, arguments) - within "##{dom_id(followable)}" do - click_link "Follow" - page.find("#follow-#{followable_dom_name}-#{followable.id}").click + visit send(followable_path, arguments) + within "##{dom_id(followable)}" do + click_link "Follow" + page.find("#follow-#{followable_dom_name}-#{followable.id}").click - expect(page).to have_css("#unfollow-expand-#{followable_dom_name}-#{followable.id}") + expect(page).to have_css("#unfollow-expand-#{followable_dom_name}-#{followable.id}") + end end - expect(Follow.followed?(user, followable)).to be - end + scenario "Display unfollow button when user already following" do + user = create(:user) + follow = create(:follow, user: user, followable: followable) + login_as(user) - scenario "Show unfollow button when user already follow this followable" do - user = create(:user) - follow = create(:follow, user: user, followable: followable) - login_as(user) + visit send(followable_path, arguments) - visit send(followable_path, arguments) - - expect(page).to have_link("Unfollow") - end - - scenario "Unfollowing", :js do - user = create(:user) - follow = create(:follow, user: user, followable: followable) - login_as(user) - - visit send(followable_path, arguments) - within "##{dom_id(followable)}" do - click_link "Unfollow" - page.find("#unfollow-#{followable_dom_name}-#{followable.id}").click - - expect(page).to have_css("#follow-expand-#{followable_dom_name}-#{followable.id}") + expect(page).to have_link("Unfollow") end - expect(Follow.followed?(user, followable)).not_to be - end + scenario "Should display follow button when click on unfollow button", :js do + user = create(:user) + follow = create(:follow, user: user, followable: followable) + login_as(user) - scenario "Show follow button when user is not following this followable" do - user = create(:user) - login_as(user) + visit send(followable_path, arguments) + within "##{dom_id(followable)}" do + click_link "Unfollow" + page.find("#unfollow-#{followable_dom_name}-#{followable.id}").click - visit send(followable_path, arguments) + expect(page).to have_css("#follow-expand-#{followable_dom_name}-#{followable.id}") + end + end - expect(page).to have_link("Follow") end end