Class: Jbr::Mock::Jobs

Inherits:
Jobs show all
Defined in:
lib/jbr/mock/jobs.rb

Overview

The jobs an app under test asked Jbr.mock to answer with.

Constant Summary

Constants inherited from Jobs

Jobs::FIELDS

Instance Attribute Summary

Attributes inherited from Resource

#id

Instance Method Summary collapse

Methods included from Includable

#includes

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Jbr::Resource

Instance Method Details

#eachEnumerator<Mock::Job>

Returns every job the app named.

Returns:

  • (Enumerator<Mock::Job>)

    every job the app named.



10
# File 'lib/jbr/mock/jobs.rb', line 10

def each(&) = mocked(Jbr.mock.jobs).each(&)

#find(id) ⇒ Mock::Job

The job filed under that ID where the app listed one, and otherwise the single job it named — which is every app that mocks a lookup without mocking a list.

Returns:



7
# File 'lib/jbr/mock/jobs.rb', line 7

def find(id) = Mock::Job.new node: listed(id) || Jbr.mock.job

#pastEnumerator<Mock::Job>

Returns those it dated before now.

Returns:

  • (Enumerator<Mock::Job>)

    those it dated before now.



16
# File 'lib/jbr/mock/jobs.rb', line 16

def past = mocked Jbr.mock.jobs.select { |job| started? job }

#upcomingEnumerator<Mock::Job>

Returns those it dated from now on, and any it left undated.

Returns:

  • (Enumerator<Mock::Job>)

    those it dated from now on, and any it left undated.



13
# File 'lib/jbr/mock/jobs.rb', line 13

def upcoming = mocked Jbr.mock.jobs.reject { |job| started? job }