Module: RelatedFile::Assertions

Includes:
Test::Unit::Assertions
Included in:
RelatedFile
Defined in:
app/models/related_file.rb

Overview

model_name?

Defined Under Namespace

Modules: ClassMethods, KernelMethods

Instance Method Summary collapse

Instance Method Details

#assert_default_test_class_id(expected_id, message = '') ⇒ Object

assert_tested_files


154
155
156
157
# File 'app/models/related_file.rb', line 154

def assert_default_test_class_id(expected_id, message='')
  message+="self=#{self.inspect}"
  assert_equal(expected_id, default_test_class_id?, message+caller_lines)
end

#assert_invariantObject

conditions that are always true (at least atomically)


133
134
135
# File 'app/models/related_file.rb', line 133

def assert_invariant
  fail "end of assert_invariant "
end

#assert_post_conditions(message = '') ⇒ Object

assertions true after class (and nested module Examples) is defined


144
145
146
147
# File 'app/models/related_file.rb', line 144

def assert_post_conditions(message='')
  message+="\ndefault FilePattern.project_root_dir?=#{FilePattern.project_root_dir?.inspect}"
  assert_not_empty(@project_root_dir, message)
end

#assert_pre_conditionsObject

conditions true while class is being defined assertions true after class (and nested module Examples) is defined


138
139
140
141
142
# File 'app/models/related_file.rb', line 138

def assert_pre_conditions
  assert_not_empty(@model_class_name, "test_class_name")
  assert_not_empty(@model_basename, "model_basename")
# fail "end ofassert_pre_conditions "
end

#assert_tested_files(executable, file_patterns) ⇒ Object

assert_post_conditions


148
149
150
151
152
153
# File 'app/models/related_file.rb', line 148

def assert_tested_files(executable, file_patterns)
  tested_file_patterns=tested_files(executable).map do |f|
    FilePatter.find_by_path(f)[:name]
  end #map
  assert_equal(file_patterns, tested_file_patterns)
end