Class: Fakettp::Expectation

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/fakettp/expectation.rb

Defined Under Namespace

Classes: Error

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_received?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/fakettp/expectation.rb', line 32

def self.all_received?
  !exists? :executed => false
end

.nextObject



36
37
38
# File 'lib/fakettp/expectation.rb', line 36

def self.next
  find_by_executed(false)
end

Instance Method Details

#execute(binding) ⇒ Object



17
18
19
20
21
22
# File 'lib/fakettp/expectation.rb', line 17

def execute binding
  self.executed = true
  save
  eval contents, binding
  # TODO: Include context of expectation file
end

#statusObject



24
25
26
27
28
29
30
# File 'lib/fakettp/expectation.rb', line 24

def status
  if executed
    errors.empty? ? 'pass' : 'fail'
  else
    'pending'
  end
end