Class: Rast
- Inherits:
-
Object
- Object
- Rast
- Defined in:
- lib/rast.rb
Overview
Main DSL. This is the entry point of the test when running a spec.
Class Method Summary collapse
Instance Method Summary collapse
-
#global_spec ⇒ Object
language: (String).
-
#initialize(rasted_subject, &block) ⇒ Rast
constructor
A new instance of Rast.
- #spec(id, &block) ⇒ Object
- #xspec(id) ⇒ Object
Constructor Details
#initialize(rasted_subject, &block) ⇒ Rast
Returns a new instance of Rast.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rast.rb', line 16 def initialize(rasted_subject, &block) @subject = if rasted_subject.class == Module Class.new { extend rasted_subject } else rasted_subject.new end @subject_name = rasted_subject spec_path = caller[2][/spec.*?\.rb/] yaml_path = spec_path.gsub(/(\w+).rb/, 'rast/\\1.yml') @generator = ParameterGenerator.new(yaml_path: yaml_path) instance_eval(&block) end |
Class Method Details
.assert(message) ⇒ Object
33 34 35 |
# File 'lib/rast.rb', line 33 def self.assert() raise unless yield end |
Instance Method Details
#spec(id, &block) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/rast.rb', line 41 def spec(id, &block) global_spec( subject: @subject, name: @subject_name, fixtures: @generator.generate_fixtures(spec_id: id), spec_id: id, &block ) end |
#xspec(id) ⇒ Object
37 38 39 |
# File 'lib/rast.rb', line 37 def xspec(id) p "xspec skipped #{id}" end |