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
@@ -97,7 +97,6 @@ ActiveRecord::Schema.define(version: 20170704105112) do
|
||||
t.integer "budget_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "ballot_lines_count", default: 0
|
||||
end
|
||||
|
||||
create_table "budget_groups", force: :cascade do |t|
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,7 +11,9 @@ 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
|
||||
context "Show" do
|
||||
|
||||
scenario "Should not display follow button when there is no logged user" do
|
||||
visit send(followable_path, arguments)
|
||||
|
||||
within "##{dom_id(followable)}" do
|
||||
@@ -19,7 +21,7 @@ RSpec.shared_examples "followable" do |followable_class_name, followable_path, f
|
||||
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)
|
||||
login_as(user)
|
||||
|
||||
@@ -30,7 +32,16 @@ RSpec.shared_examples "followable" do |followable_class_name, followable_path, f
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Following", :js do
|
||||
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)
|
||||
|
||||
expect(page).to have_link("Follow")
|
||||
end
|
||||
|
||||
scenario "Should display unfollow button when click on follow button", :js do
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
@@ -41,11 +52,9 @@ RSpec.shared_examples "followable" do |followable_class_name, followable_path, f
|
||||
|
||||
expect(page).to have_css("#unfollow-expand-#{followable_dom_name}-#{followable.id}")
|
||||
end
|
||||
|
||||
expect(Follow.followed?(user, followable)).to be
|
||||
end
|
||||
|
||||
scenario "Show unfollow button when user already follow this followable" do
|
||||
scenario "Display unfollow button when user already following" do
|
||||
user = create(:user)
|
||||
follow = create(:follow, user: user, followable: followable)
|
||||
login_as(user)
|
||||
@@ -55,7 +64,7 @@ RSpec.shared_examples "followable" do |followable_class_name, followable_path, f
|
||||
expect(page).to have_link("Unfollow")
|
||||
end
|
||||
|
||||
scenario "Unfollowing", :js do
|
||||
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)
|
||||
@@ -67,17 +76,8 @@ RSpec.shared_examples "followable" do |followable_class_name, followable_path, f
|
||||
|
||||
expect(page).to have_css("#follow-expand-#{followable_dom_name}-#{followable.id}")
|
||||
end
|
||||
|
||||
expect(Follow.followed?(user, followable)).not_to be
|
||||
end
|
||||
|
||||
scenario "Show follow button when user is not following this followable" do
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit send(followable_path, arguments)
|
||||
|
||||
expect(page).to have_link("Follow")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user