Class: Purobu::DSL
- Inherits:
-
Object
- Object
- Purobu::DSL
- Defined in:
- lib/purobu/dsl.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ DSL
constructor
A new instance of DSL.
- #load_tests ⇒ Object
- #run ⇒ Object
- #test(name = nil, &block) ⇒ Object
- #tests ⇒ Object
Constructor Details
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
3 4 5 |
# File 'lib/purobu/dsl.rb', line 3 def files @files end |
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
3 4 5 |
# File 'lib/purobu/dsl.rb', line 3 def runner @runner end |
Instance Method Details
#load_tests ⇒ Object
23 24 25 |
# File 'lib/purobu/dsl.rb', line 23 def load_tests files.each { |f| instance_eval(File.read(f)) } end |
#run ⇒ Object
18 19 20 21 |
# File 'lib/purobu/dsl.rb', line 18 def run load_tests runner.run end |
#test(name = nil, &block) ⇒ Object
10 11 12 |
# File 'lib/purobu/dsl.rb', line 10 def test(name = nil, &block) runner.tests.push( Test.new(name).tap { |t| t.instance_eval(&block) } ) end |
#tests ⇒ Object
14 15 16 |
# File 'lib/purobu/dsl.rb', line 14 def tests runner.tests end |