Sha256: 3234c4b1699d8715981be6dc4e6e095cbcb0f70c09d5ac1219f51885481b4eae
Contents?: true
Size: 1.17 KB
Versions: 20
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require "spec_helper" describe Decidim::Budgets::CancelOrder do let(:user) { create(:user) } let(:feature) do create( :budget_feature, :with_total_budget_and_vote_threshold_percent, organization: user.organization ) end let(:project) { create(:project, feature: feature, budget: 90_000_000) } let(:order) do order = create(:order, user: user, feature: feature) order.projects << project order.checked_out_at = Time.zone.now order.save! order end subject { described_class.new(order) } context "when everything is ok" do it "broadcasts ok" do expect { subject.call }.to broadcast(:ok) end it "destroys the order" do subject.call expect(Decidim::Budgets::Order.count).to eq(0) end end context "when the order is not present" do let(:order) { nil } it "broadcasts invalid" do expect { subject.call }.to broadcast(:invalid) end end context "when the order is not checked out" do let(:order) { create(:order, user: user, feature: feature) } it "broadcasts invalid" do expect { subject.call }.to broadcast(:invalid) end end end
Version data entries
20 entries across 20 versions & 1 rubygems