Class: Funktional::ShouldDeleteBlock

Inherits:
ShouldBlock show all
Defined in:
lib/funktional/context/should_delete_block.rb

Instance Method Summary collapse

Methods inherited from ShouldBlock

build, #to_test

Constructor Details

#initialize(klass, context) ⇒ ShouldDeleteBlock

Returns a new instance of ShouldDeleteBlock.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/funktional/context/should_delete_block.rb', line 4

def initialize(klass, context)
  @context = context
  @should_name = "delete a #{klass}"
  
  @before = lambda { @before_setup_count = klass.count }
  where = test_and_line_no
  
  @blk = lambda do
    expected_count = @before_setup_count - 1 
    assert_equal expected_count, klass.count, "New [#{klass}] was not deleted. #{where}"
  end
end