Use display in followable shared specs names when referring to DOM elements renderization. Add whitespace to proposal page.
This commit is contained in:
committed by
Senén Rodero Rodríguez
parent
5fe894aa6b
commit
e54e33f296
@@ -95,9 +95,8 @@ ActiveRecord::Schema.define(version: 20170704105112) do
|
|||||||
create_table "budget_ballots", force: :cascade do |t|
|
create_table "budget_ballots", force: :cascade do |t|
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.integer "budget_id"
|
t.integer "budget_id"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.integer "ballot_lines_count", default: 0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "budget_groups", force: :cascade do |t|
|
create_table "budget_groups", force: :cascade do |t|
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Not sow flaggable buttons" do
|
scenario "Don't display flaggable buttons" do
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ feature 'Proposal Notifications' do
|
|||||||
expect(Notification.count).to eq(1)
|
expect(Notification.count).to eq(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Send a notification (Follower user)" do
|
scenario "Send a notification (Follower)" do
|
||||||
author = create(:user)
|
author = create(:user)
|
||||||
proposal = create(:proposal, author: author)
|
proposal = create(:proposal, author: author)
|
||||||
user_follower = create(:user)
|
user_follower = create(:user)
|
||||||
@@ -47,7 +47,7 @@ feature 'Proposal Notifications' do
|
|||||||
expect(Notification.count).to eq(1)
|
expect(Notification.count).to eq(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Send a notification (Follower user and Active voter)" do
|
scenario "Send a notification (Follower and Voter)" do
|
||||||
author = create(:user)
|
author = create(:user)
|
||||||
proposal = create(:proposal, author: author)
|
proposal = create(:proposal, author: author)
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ feature 'Users' do
|
|||||||
@user = create(:user)
|
@user = create(:user)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'show interests' do
|
scenario 'Display interests' do
|
||||||
proposal = create(:proposal, tag_list: "Sport")
|
proposal = create(:proposal, tag_list: "Sport")
|
||||||
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ feature 'Users' do
|
|||||||
expect(page).to have_content("Sport")
|
expect(page).to have_content("Sport")
|
||||||
end
|
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")
|
proposal = create(:proposal, tag_list: "Sport")
|
||||||
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
||||||
proposal.destroy
|
proposal.destroy
|
||||||
@@ -251,14 +251,14 @@ feature 'Users' do
|
|||||||
expect(page).not_to have_content("Sport")
|
expect(page).not_to have_content("Sport")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'no visible by default' do
|
scenario 'No visible by default' do
|
||||||
visit user_path(@user)
|
visit user_path(@user)
|
||||||
|
|
||||||
expect(page).to have_content(@user.username)
|
expect(page).to have_content(@user.username)
|
||||||
expect(page).not_to have_css('#public_interests')
|
expect(page).not_to have_css('#public_interests')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'user can show public page' do
|
scenario 'User can display public page' do
|
||||||
login_as(@user)
|
login_as(@user)
|
||||||
visit account_path
|
visit account_path
|
||||||
|
|
||||||
@@ -271,7 +271,7 @@ feature 'Users' do
|
|||||||
expect(page).to have_css('#public_interests')
|
expect(page).to have_css('#public_interests')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'is always visible for the owner' do
|
scenario 'Is always visible for the owner' do
|
||||||
login_as(@user)
|
login_as(@user)
|
||||||
visit account_path
|
visit account_path
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ feature 'Users' do
|
|||||||
expect(page).to have_css('#public_interests')
|
expect(page).to have_css('#public_interests')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'is always visible for admins' do
|
scenario 'Is always visible for admins' do
|
||||||
login_as(@user)
|
login_as(@user)
|
||||||
visit account_path
|
visit account_path
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ feature 'Users' do
|
|||||||
expect(page).to have_css('#public_interests')
|
expect(page).to have_css('#public_interests')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'is always visible for moderators' do
|
scenario 'Is always visible for moderators' do
|
||||||
login_as(@user)
|
login_as(@user)
|
||||||
visit account_path
|
visit account_path
|
||||||
|
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ describe Follow do
|
|||||||
expect(follow).to be_valid
|
expect(follow).to be_valid
|
||||||
end
|
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
|
follow.user_id = nil
|
||||||
expect(follow).to_not be_valid
|
expect(follow).to_not be_valid
|
||||||
end
|
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
|
follow.followable_id = nil
|
||||||
expect(follow).to_not be_valid
|
expect(follow).to_not be_valid
|
||||||
end
|
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
|
follow.followable_type = nil
|
||||||
expect(follow).to_not be_valid
|
expect(follow).to_not be_valid
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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
|
include ActionView::Helpers
|
||||||
|
|
||||||
let!(:arguments) { {} }
|
let!(:arguments) { {} }
|
||||||
@@ -11,73 +11,73 @@ RSpec.shared_examples "followable" do |followable_class_name, followable_path, f
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should not show follow button when there is no logged user" do
|
context "Show" do
|
||||||
visit send(followable_path, arguments)
|
|
||||||
|
|
||||||
within "##{dom_id(followable)}" do
|
scenario "Should not display follow button when there is no logged user" do
|
||||||
expect(page).not_to have_link("Follow")
|
visit send(followable_path, arguments)
|
||||||
|
|
||||||
|
within "##{dom_id(followable)}" do
|
||||||
|
expect(page).not_to have_link("Follow")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Should show follow button when user is logged in" do
|
scenario "Should display follow button when user is logged in" do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
login_as(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")
|
expect(page).to have_link("Follow")
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Following", :js do
|
scenario "Should display unfollow button when click on follow button", :js do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
login_as(user)
|
login_as(user)
|
||||||
|
|
||||||
visit send(followable_path, arguments)
|
visit send(followable_path, arguments)
|
||||||
within "##{dom_id(followable)}" do
|
within "##{dom_id(followable)}" do
|
||||||
click_link "Follow"
|
click_link "Follow"
|
||||||
page.find("#follow-#{followable_dom_name}-#{followable.id}").click
|
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
|
end
|
||||||
|
|
||||||
expect(Follow.followed?(user, followable)).to be
|
scenario "Display unfollow button when user already following" do
|
||||||
end
|
user = create(:user)
|
||||||
|
follow = create(:follow, user: user, followable: followable)
|
||||||
|
login_as(user)
|
||||||
|
|
||||||
scenario "Show unfollow button when user already follow this followable" do
|
visit send(followable_path, arguments)
|
||||||
user = create(:user)
|
|
||||||
follow = create(:follow, user: user, followable: followable)
|
|
||||||
login_as(user)
|
|
||||||
|
|
||||||
visit send(followable_path, arguments)
|
expect(page).to have_link("Unfollow")
|
||||||
|
|
||||||
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}")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(Follow.followed?(user, followable)).not_to be
|
scenario "Should display follow button when click on unfollow button", :js do
|
||||||
end
|
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
|
visit send(followable_path, arguments)
|
||||||
user = create(:user)
|
within "##{dom_id(followable)}" do
|
||||||
login_as(user)
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user