Files
nairobi/spec/features/official_positions_spec.rb
Javi Martín 52c8691aae Don't create featured proposals if disabled
Before we disabled featured proposals by default, there were many tests
creating them because they were needed in order to create non-featured
proposals.

But now these tests don't need to create featured proposals anymore.
2019-09-24 20:04:39 +02:00

72 lines
1.7 KiB
Ruby

require "rails_helper"
describe "Official positions" do
context "Badge" do
before do
@user1 = create(:user, official_level: 1, official_position: "Employee", official_position_badge: true)
@user2 = create(:user, official_level: 0, official_position: "")
end
scenario "Comments" do
proposal = create(:proposal)
comment1 = create(:comment, commentable: proposal, user: @user1)
comment2 = create(:comment, commentable: proposal, user: @user2)
visit proposal_path(proposal)
expect_badge_for("comment", comment1)
expect_no_badge_for("comment", comment2)
end
context "Debates" do
before do
@debate1 = create(:debate, author: @user1)
@debate2 = create(:debate, author: @user2)
end
scenario "Index" do
visit debates_path
expect_badge_for("debate", @debate1)
expect_no_badge_for("debate", @debate2)
end
scenario "Show" do
visit debate_path(@debate1)
expect_badge_for("debate", @debate1)
visit debate_path(@debate2)
expect_no_badge_for("debate", @debate2)
end
end
context "Proposals" do
before do
@proposal1 = create(:proposal, author: @user1)
@proposal2 = create(:proposal, author: @user2)
end
scenario "Index" do
visit proposals_path
expect_badge_for("proposal", @proposal1)
expect_no_badge_for("proposal", @proposal2)
end
scenario "Show" do
visit proposal_path(@proposal1)
expect_badge_for("proposal", @proposal1)
visit proposal_path(@proposal2)
expect_no_badge_for("proposal", @proposal2)
end
end
end
end