Sha256: 54bfeeda433988660e74f4993f6f5645dac3a6e439e95c6dee3e0c609fcd1c82
Contents?: true
Size: 1.13 KB
Versions: 59
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true shared_examples "withdraw amendment" do context "when current user is the author of the amendment" do let(:current_user) { amendment.amender } context "and the amendment has no supports" do it "withdraws the amendment" do expect { command.call }.to broadcast(:ok) expect(amendment.state).to eq("withdrawn") expect(emendation.state).to eq("withdrawn") end end context "and the amendment has some supports" do before do emendation.votes.create!(author: other_user) end it "is not able to withdraw the amendment" do expect { command.call }.to broadcast(:invalid) expect(amendment.state).not_to eq("withdrawn") expect(emendation.state).not_to eq("withdrawn") end end end context "when current user is not the author of the amendment" do let!(:current_user) { other_user } it "is not able to withdraw the amendment" do expect { command.call }.to broadcast(:invalid) expect(amendment.state).not_to eq("withdrawn") expect(emendation.state).not_to eq("withdrawn") end end end
Version data entries
59 entries across 59 versions & 1 rubygems