Class: SqlTestRunner::Runner
- Inherits:
-
Object
- Object
- SqlTestRunner::Runner
- Defined in:
- lib/sql_test_runner.rb
Instance Method Summary collapse
- #add_stand(stand) ⇒ Object
- #before(description = "", &block) ⇒ Object
-
#initialize(sql_connection, step_logger) ⇒ Runner
constructor
A new instance of Runner.
- #load_tests(test_description) ⇒ Object
- #run(test_description) ⇒ Object
- #run_file(test_script) ⇒ Object
- #test_case(name, &block) ⇒ Object
Constructor Details
#initialize(sql_connection, step_logger) ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 9 10 |
# File 'lib/sql_test_runner.rb', line 5 def initialize(sql_connection, step_logger) @stands = {} @before_blocks = [] @sql_connection = sql_connection @step_logger = step_logger end |
Instance Method Details
#add_stand(stand) ⇒ Object
30 31 32 33 34 |
# File 'lib/sql_test_runner.rb', line 30 def add_stand(stand) name = stand.name stands[name] = [] unless stands[name] stands[name] << stand end |
#before(description = "", &block) ⇒ Object
36 37 38 |
# File 'lib/sql_test_runner.rb', line 36 def before(description = "", &block) @before_blocks << BeforeAction.new(self, description, block) end |
#load_tests(test_description) ⇒ Object
26 27 28 |
# File 'lib/sql_test_runner.rb', line 26 def load_tests(test_description) instance_eval test_description end |
#run(test_description) ⇒ Object
20 21 22 23 24 |
# File 'lib/sql_test_runner.rb', line 20 def run(test_description) load_tests(test_description) run_stands step_logger.log_results end |
#run_file(test_script) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/sql_test_runner.rb', line 12 def run_file(test_script) begin run File.read(test_script) rescue Errno::ENOENT => e raise ScriptNotFound.new(e.) end end |
#test_case(name, &block) ⇒ Object
40 41 42 |
# File 'lib/sql_test_runner.rb', line 40 def test_case(name, &block) TestCase.new(self, name).instance_eval(&block) end |