module Given
The before blocks defined in Minitest
are inadequate for our use. This before_extension file allows us to use real before blocks.
Constants
- InvalidThenError
- NATURAL_ASSERTIONS_SUPPORTED
- VERSION
- VERSION_NUMBERS
Public Class Methods
count_assertion(*args)
click to toggle source
Increment the number of assertions made in the framework.
# File lib/given/module_methods.rb 61 def self.count_assertion(*args) 62 Given.framework.count_assertion(*args) 63 end
explicit_assertions?(*args)
click to toggle source
Were there any explicit framework assertions made during the execution of the Then block?
# File lib/given/module_methods.rb 56 def self.explicit_assertions?(*args) 57 Given.framework.explicit_assertions?(*args) 58 end
fail_with(*args)
click to toggle source
Fail an example with the given messages.
# File lib/given/module_methods.rb 45 def self.fail_with(*args) 46 Given.framework.fail_with(*args) 47 end
framework()
click to toggle source
# File lib/given/module_methods.rb 4 def self.framework 5 @_gvn_framework 6 end
framework=(framework)
click to toggle source
# File lib/given/module_methods.rb 8 def self.framework=(framework) 9 @_gvn_framework = framework 10 end
location_of(block)
click to toggle source
Return file and line number where the block is defined.
# File lib/given/module_methods.rb 34 def self.location_of(block) 35 if block.binding.respond_to?(:source_location) 36 block.binding.source_location 37 else 38 eval "[__FILE__, __LINE__]", block.binding 39 end 40 end
natural_assertions_enabled?()
click to toggle source
TRUE if natural assertions are globally enabled?
# File lib/given/module_methods.rb 29 def self.natural_assertions_enabled? 30 @natural_assertions_enabled 31 end
pending_error()
click to toggle source
Error object used by the current framework to indicate a pending example.
# File lib/given/module_methods.rb 67 def self.pending_error 68 Given.framework.pending_error 69 end
source_caching_disabled()
click to toggle source
# File lib/given/module_methods.rb 12 def self.source_caching_disabled 13 @_gvn_source_caching_disabled 14 end
source_caching_disabled=(value)
click to toggle source
# File lib/given/module_methods.rb 16 def self.source_caching_disabled=(value) 17 @_gvn_source_caching_disabled = value 18 end
start_evaluation(*args)
click to toggle source
Mark the start of a Then assertion evaluation.
# File lib/given/module_methods.rb 50 def self.start_evaluation(*args) 51 Given.framework.start_evaluation(*args) 52 end
use_natural_assertions(enabled=true)
click to toggle source
Globally enable/disable natural assertions.
There is a similar function in Extensions that works at a describe or context scope.
# File lib/given/module_methods.rb 24 def self.use_natural_assertions(enabled=true) 25 @natural_assertions_enabled = enabled 26 end
using_old_rspec?()
click to toggle source
# File lib/given/rspec/all.rb 19 def self.using_old_rspec? 20 defined?(Spec) && 21 defined?(Spec::VERSION) && 22 defined?(Spec::VERSION::SUMMARY) && 23 Spec::VERSION::SUMMARY =~ /^rspec +1\./ 24 end