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



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

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

#renderObject



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

def render
  if executed
    span_class = errors.empty? ? 'pass' : 'fail'
    %(<span class="#{span_class}">#{contents}</span>)
  else
    contents
  end
end