Sha256: adf1ede747ec41706801c6b73e97d4d9ee39473e2066c3ab7bc709aeec97dd6f

Contents?: true

Size: 870 Bytes

Versions: 27

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe Decidim::Budgets::LineItem do
  let(:line_item) { build :line_item }
  subject { line_item }

  describe "validations" do
    it "is valid" do
      expect(subject).to be_valid
    end

    it "is invalid when order is not present" do
      subject.order = nil
      expect(subject).to be_invalid
    end

    it "is invalid when project is not present" do
      subject.project = nil
      expect(subject).to be_invalid
    end

    it "is invalid when the same litem item exists" do
      subject.save
      new_line_item = build :line_item, order: subject.order, project: subject.project
      expect(new_line_item).to be_invalid
    end

    it "is invalid when order and project are from a different feature" do
      subject.order = build(:order)
      expect(subject).to be_invalid
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.6.7 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.6.6 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.6.5 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.6.4 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.6.3 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.6.2 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.6.1 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.6.0 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.5.1 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.5.0 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.4.4 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.4.3 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.4.2 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.4.1 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.4.0 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.3.2 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.3.1 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.3.0 decidim-budgets/spec/models/line_item_spec.rb
decidim-0.2.0 decidim-budgets/spec/models/line_item_spec.rb