Class: TestUnit::Generators::ButlerMainframeTestGenerator

Inherits:
Base
  • Object
show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/generators/test_unit/butler_mainframe_test/butler_mainframe_test_generator.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#create_test_fileObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/generators/test_unit/butler_mainframe_test/butler_mainframe_test_generator.rb', line 11

def create_test_file
  create_file "test/#{/^4\./ === Rails.version ? 'models' : 'unit'}/butler_mainframe_#{file_name}_test.rb",
              "    require 'test_helper'\n\n    class \#{class_name}Test < ActiveSupport::TestCase\n      test \"Basic navigation\" do\n        params  = {:debug => true, :wait_debug => 0.5}\n        host    = ButlerMainframe::Host.new(params)\n        host.navigate :session_login\n        assert host.session_login?, 'navigate :session_login => this is not the session login'\n\n        host.navigate :next\n        assert !host.session_login?, 'navigate :next => does not pass login screen'\n\n        host.close_session\n        assert host.action[:object] == nil, \"Close session failed!\"\n      end\n\n      test \"\#{class_name} navigation\" do\n        params  = {:debug => true, :wait_debug => 0.5}\n        host    = ButlerMainframe::Host.new(params)\n\n        #host.navigate :your_starting_screen\n        # WRITE YOUR TEST\n\n        host.close_session\n        assert host.action[:object] == nil, \"Close session failed!\"\n      end\n    end\n  FILE\nend\n".gsub(/^      /, '')