Module: DhEasy::Test
- Defined in:
- lib/dh_easy/test.rb,
lib/dh_easy/test/rake.rb,
lib/dh_easy/test/helper.rb,
lib/dh_easy/test/version.rb
Defined Under Namespace
Modules: Helper Classes: RecordTask
Constant Summary collapse
- VERSION =
Gem version
"0.0.5"
Class Method Summary collapse
-
.disable_test_mode ⇒ Object
Disable test mode inside executors.
-
.enable_test_mode ⇒ Object
Enable test mode inside executors.
-
.test_mode? ⇒ Boolean
Check if test mode is enabled inside executors.
-
.verbose_log(message, data = nil, log_caller = nil) ⇒ Object
Verbose data log within caller backtrace.
-
.verbose_match_diff(type, diff, log_caller = nil) ⇒ Object
Verbose a match diff.
Class Method Details
.disable_test_mode ⇒ Object
Disable test mode inside executors.
16 17 18 |
# File 'lib/dh_easy/test.rb', line 16 def self.disable_test_mode @@test_mode = false end |
.enable_test_mode ⇒ Object
Enable test mode inside executors.
11 12 13 |
# File 'lib/dh_easy/test.rb', line 11 def self.enable_test_mode @@test_mode = true end |
.test_mode? ⇒ Boolean
Check if test mode is enabled inside executors.
23 24 25 |
# File 'lib/dh_easy/test.rb', line 23 def self.test_mode? @@test_mode ||= false end |
.verbose_log(message, data = nil, log_caller = nil) ⇒ Object
Verbose data log within caller backtrace.
32 33 34 35 36 37 |
# File 'lib/dh_easy/test.rb', line 32 def self.verbose_log , data = nil, log_caller = nil log_caller ||= caller caller_infos = log_caller.first.split ":" text = data.nil? ? 'nil' : JSON.pretty_generate(data) puts "\n#{caller_infos[0]}:#{caller_infos[1]} - #{}#{text}\n\n" end |
.verbose_match_diff(type, diff, log_caller = nil) ⇒ Object
Verbose a match diff.
43 44 45 46 47 48 49 50 |
# File 'lib/dh_easy/test.rb', line 43 def self.verbose_match_diff type, diff, log_caller = nil unless diff[:saved].nil? || diff[:saved].count < 1 verbose_log "Non matching saved #{type}: ", diff[:saved], log_caller end unless diff[:expected].nil? || diff[:expected].count < 1 verbose_log "Non matching expected #{type}: ", diff[:expected], log_caller end end |