Sha256: 0609a1fa5670651b8d7a85e730eb34bea4235c54f6283e856a6d8f617f47f2ae

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe Hyrax::Operation do
  describe "rollup_status" do
    let(:parent) { create(:operation, :pending) }
    describe "with a pending process" do
      let!(:child1) { create(:operation, :failing, parent: parent) }
      let!(:child2) { create(:operation, :pending, parent: parent) }
      it "sets status to pending" do
        parent.rollup_status
        expect(parent.status).to eq Hyrax::Operation::PENDING
      end
    end

    describe "with a failure" do
      let!(:child1) { create(:operation, :failing, parent: parent) }
      let!(:child2) { create(:operation, :successful, parent: parent) }
      it "sets status to failure" do
        parent.rollup_status
        expect(parent.status).to eq Hyrax::Operation::FAILURE
      end
    end

    describe "with a successes" do
      let!(:child1) { create(:operation, :successful, parent: parent) }
      let!(:child2) { create(:operation, :successful, parent: parent) }
      it "sets status to success" do
        parent.rollup_status
        expect(parent.status).to eq Hyrax::Operation::SUCCESS
      end
    end
  end

  describe "performing!" do
    it "changes the status to performing" do
      subject.performing!
      expect(subject.status).to eq Hyrax::Operation::PERFORMING
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
test_hyrax-0.0.1.alpha spec/models/hyrax/operation_spec.rb