Class: NullDB::RSpec::NullifiedDatabase::HaveExecuted

Inherits:
Object
  • Object
show all
Defined in:
lib/nulldb_rspec.rb

Instance Method Summary collapse

Constructor Details

#initialize(entry_point) ⇒ HaveExecuted

Returns a new instance of HaveExecuted.



13
14
15
# File 'lib/nulldb_rspec.rb', line 13

def initialize(entry_point)
  @entry_point = entry_point
end

Instance Method Details

#descriptionObject



26
27
28
# File 'lib/nulldb_rspec.rb', line 26

def description
  "connection should execute #{@entry_point} statement"
end

#failure_messageObject



30
31
32
# File 'lib/nulldb_rspec.rb', line 30

def failure_message
  " did not execute #{@entry_point} statement when it should have"
end

#matches?(connection) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
# File 'lib/nulldb_rspec.rb', line 17

def matches?(connection)
  log = connection.execution_log_since_checkpoint
  if @entry_point == :anything
    not log.empty?
  else
    log.include?(NullDBAdapter::Statement.new(@entry_point))
  end
end

#negative_failure_messageObject



34
35
36
# File 'lib/nulldb_rspec.rb', line 34

def negative_failure_message
  " executed #{@entry_point} statement when it should not have"
end