Class: Funktional::ShouldCreateBlock

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

Instance Method Summary collapse

Methods inherited from ShouldBlock

build, #to_test

Constructor Details

#initialize(klass, context) ⇒ ShouldCreateBlock

Returns a new instance of ShouldCreateBlock.



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

def initialize(klass, context)
  @context = context
  @should_name = "create 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 created. #{where}"
  end
end