speeds 10s the test suite by avoiding the creation a few unneeded objects
This commit is contained in:
@@ -79,7 +79,7 @@ describe Proposal do
|
||||
|
||||
describe "#editable?" do
|
||||
let(:proposal) { create(:proposal) }
|
||||
before(:each) {Setting.find_by(key: "max_votes_for_proposal_edit").update(value: 100)}
|
||||
before(:each) {Setting.find_by(key: "max_votes_for_proposal_edit").update(value: 5)}
|
||||
|
||||
it "should be true if proposal has no votes yet" do
|
||||
expect(proposal.total_votes).to eq(0)
|
||||
@@ -87,14 +87,14 @@ describe Proposal do
|
||||
end
|
||||
|
||||
it "should be true if proposal has less than limit votes" do
|
||||
create_list(:vote, 91, votable: proposal)
|
||||
expect(proposal.total_votes).to eq(91)
|
||||
create_list(:vote, 4, votable: proposal)
|
||||
expect(proposal.total_votes).to eq(4)
|
||||
expect(proposal.editable?).to be true
|
||||
end
|
||||
|
||||
it "should be false if proposal has more than limit votes" do
|
||||
create_list(:vote, 102, votable: proposal)
|
||||
expect(proposal.total_votes).to eq(102)
|
||||
create_list(:vote, 6, votable: proposal)
|
||||
expect(proposal.total_votes).to eq(6)
|
||||
expect(proposal.editable?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user