Class: RhoSpecModule
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#before ⇒ Object
Returns the value of attribute before.
-
#spec_name ⇒ Object
Returns the value of attribute spec_name.
-
#tests ⇒ Object
Returns the value of attribute tests.
Instance Method Summary collapse
-
#initialize(spec_name, spec_body) ⇒ RhoSpecModule
constructor
A new instance of RhoSpecModule.
- #run_spec ⇒ Object
- #run_test(test_body) ⇒ Object
Constructor Details
#initialize(spec_name, spec_body) ⇒ RhoSpecModule
Returns a new instance of RhoSpecModule.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/extensions/rhospec/rhospec.rb', line 21 def initialize(spec_name, spec_body) @before = {} @after = {} @tests = {} @env = Object.new @spec_name = spec_name @spec_body = spec_body end |
Instance Attribute Details
#after ⇒ Object
Returns the value of attribute after.
19 20 21 |
# File 'lib/extensions/rhospec/rhospec.rb', line 19 def after @after end |
#before ⇒ Object
Returns the value of attribute before.
19 20 21 |
# File 'lib/extensions/rhospec/rhospec.rb', line 19 def before @before end |
#spec_name ⇒ Object
Returns the value of attribute spec_name.
19 20 21 |
# File 'lib/extensions/rhospec/rhospec.rb', line 19 def spec_name @spec_name end |
#tests ⇒ Object
Returns the value of attribute tests.
19 20 21 |
# File 'lib/extensions/rhospec/rhospec.rb', line 19 def tests @tests end |
Instance Method Details
#run_spec ⇒ Object
32 33 34 35 36 37 |
# File 'lib/extensions/rhospec/rhospec.rb', line 32 def run_spec setting_str = $spec_settings.length()>0 ? ";#{$spec_settings}" : "" puts "TEST: #{@spec_name}" + setting_str @env.instance_eval(&@spec_body) if @spec_body end |
#run_test(test_body) ⇒ Object
39 40 41 |
# File 'lib/extensions/rhospec/rhospec.rb', line 39 def run_test(test_body) @env.instance_eval(&test_body) if test_body end |