Add Segment for users without supports on Budget
Created not_supported_on_current_budget at UserSegment along with model spec scenario and translation strings.
This commit is contained in:
@@ -172,4 +172,22 @@ describe UserSegments do
|
||||
expect(current_budget_investments).not_to include investment2
|
||||
end
|
||||
end
|
||||
|
||||
describe "#not_supported_on_current_budget" do
|
||||
it "only returns users that haven't supported investments on current budget" do
|
||||
investment1 = create(:budget_investment)
|
||||
investment2 = create(:budget_investment)
|
||||
budget = create(:budget)
|
||||
investment1.vote_by(voter: user1, vote: 'yes')
|
||||
investment2.vote_by(voter: user2, vote: 'yes')
|
||||
investment1.update(budget: budget)
|
||||
investment2.update(budget: budget)
|
||||
|
||||
not_supported_on_current_budget = described_class.not_supported_on_current_budget
|
||||
expect(not_supported_on_current_budget).to include user3
|
||||
expect(not_supported_on_current_budget).not_to include user1
|
||||
expect(not_supported_on_current_budget).not_to include user2
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user