Updated

spec/helpers / moderation_helper_spec.rb

B
36 lines of codes
0 methods
N/A complexity/method
1 churn
62.99 complexity
17 duplications
require 'rails_helper' RSpec.describe ModerationHelper, type: :helper do describe "#moderation_delay?" do let(:scope) { double(Petition) } before do
  1. Similar code found in 2 nodes Locations: 0 1
allow(Petition).to receive(:in_moderation).and_return(scope) allow(scope).to receive(:count).and_return(moderation_queue) end context "when there are less than 500 petitions in the moderation queue" do let(:moderation_queue) { 499 } it "returns false" do expect(helper.moderation_delay?).to eq(false) end end context "when there are 500 petitions in the moderation queue" do let(:moderation_queue) { 500 } it "returns true" do expect(helper.moderation_delay?).to eq(true) end end context "when there are more than 500 petitions in the moderation queue" do let(:moderation_queue) { 501 } it "returns true" do expect(helper.moderation_delay?).to eq(true) end end end end