Sha256: 934533c702a93f0a2860309734ef5d1694ca2fd90ef00eecd9f1f9d352e50ff7

Contents?: true

Size: 690 Bytes

Versions: 18

Compression:

Stored size: 690 Bytes

Contents

module WithStatus
  extend ActiveSupport::Concern

  included do
    serialize :status, Mumuki::Laboratory::Status
    validates_presence_of :status
  end

  def passed?
    status.passed?
  end

  def aborted?
    status == :aborted
  end

  def run_update!
    running!
    begin
      update! yield
    rescue => e
      errored! e.message
      raise e
    end
  end

  def passed!
    update! status: :passed
  end

  def running!
    update! status: :running,
            result: nil,
            test_results: nil,
            expectation_results: [],
            manual_evaluation_comment: nil
  end

  def errored!(message)
    update! result: message, status: :errored
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mumuki-laboratory-5.3.0 app/models/concerns/with_status.rb
mumuki-laboratory-5.2.1 app/models/concerns/with_status.rb
mumuki-laboratory-5.2.0 app/models/concerns/with_status.rb
mumuki-laboratory-5.1.1 app/models/concerns/with_status.rb
mumuki-laboratory-5.1.0 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.12 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.11 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.10 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.9 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.8 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.7 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.6 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.5 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.4 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.3 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.2 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.1 app/models/concerns/with_status.rb
mumuki-laboratory-5.0.0 app/models/concerns/with_status.rb