te3270 0.1-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,98 @@
1
+ require 'spec_helper'
2
+
3
+ class TEScreenObject
4
+ include TE3270
5
+
6
+ attr_reader :initialize_screen
7
+
8
+ def initialize_screen
9
+ @initialize_screen = true
10
+ end
11
+ end
12
+
13
+ describe TE3270 do
14
+ let(:platform) { double('platform') }
15
+ let(:screen_object) { TEScreenObject.new platform }
16
+
17
+ before(:each) do
18
+ screen_object.stub(:platform).and_return platform
19
+ end
20
+
21
+ describe "interacting with the platform" do
22
+ it 'should use the platform to connect to an emulator' do
23
+ platform.should_receive(:connect)
24
+ screen_object.connect
25
+ end
26
+
27
+ it 'should use the platform to disconnect from an emulator' do
28
+ platform.should_receive(:disconnect)
29
+ screen_object.disconnect
30
+ end
31
+
32
+ it 'should use the platform to send keys to the screen' do
33
+ platform.should_receive(:send_keys).with('<Clear>')
34
+ screen_object.send_keys(TE3270.Clear)
35
+ end
36
+
37
+ it 'should use the platform to wait for a string to appear on the screen' do
38
+ platform.should_receive(:wait_for_string).with('The String', 2, 4)
39
+ screen_object.wait_for_string('The String', 2, 4)
40
+ end
41
+
42
+ it 'should use the platform to wait for the host to be quiet' do
43
+ platform.should_receive(:wait_for_host).with(4)
44
+ screen_object.wait_for_host(4)
45
+ end
46
+
47
+ it 'should default to five seconds when waiting for the host' do
48
+ platform.should_receive(:wait_for_host).with(5)
49
+ screen_object.wait_for_host
50
+ end
51
+
52
+ it 'should use the platform to wait until the cursor at a specific position' do
53
+ platform.should_receive(:wait_until_cursor_at).with(10, 10)
54
+ screen_object.wait_until_cursor_at(10, 10)
55
+ end
56
+
57
+ it 'should use the platform to take a screenshot of the screen' do
58
+ platform.should_receive(:screenshot).with('image.png')
59
+ screen_object.screenshot('image.png')
60
+ end
61
+
62
+ it 'should use the platform to get the text for the entire screen' do
63
+ platform.should_receive(:text).and_return('123abc')
64
+ screen_object.text.should == '123abc'
65
+ end
66
+ end
67
+
68
+ describe "module functionality" do
69
+ it 'should know the function keys' do
70
+ TE3270.Clear.should == '<Clear>'
71
+ TE3270.Pf24.should == '<Pf24>'
72
+ end
73
+
74
+ it 'should call initialize_screen if it exists' do
75
+ screen_object.initialize_screen.should be_true
76
+ end
77
+
78
+ it 'should create an emulator and connect to terminal' do
79
+ TE3270::Emulators::Extra.should_receive(:new).and_return(platform)
80
+ platform.should_receive(:connect)
81
+ TE3270.emulator_for :extra
82
+ end
83
+
84
+ it 'should accept a block when creating an emulator' do
85
+ WIN32OLE.stub(:new).and_return extra_system
86
+ extra_sessions.should_receive(:Open).with('blah.edp').and_return(extra_session)
87
+ TE3270.emulator_for :extra do |emulator|
88
+ emulator.session_file = 'blah.edp'
89
+ end
90
+ end
91
+
92
+ it 'should allow one to disconnect using the module' do
93
+ platform.should_receive(:disconnect)
94
+ TE3270.disconnect(platform)
95
+ end
96
+ end
97
+
98
+ end
@@ -0,0 +1,61 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'te3270'
4
+ require 'win32ole'
5
+ require 'win32/screenshot'
6
+
7
+ def extra_system
8
+ @extra_system ||= double('system')
9
+ @extra_system.stub(:Sessions).and_return extra_sessions
10
+ @extra_system.stub(:Version).and_return("0")
11
+ @extra_system
12
+ end
13
+
14
+ def extra_sessions
15
+ @extra_sessions ||= double('sessions')
16
+ @extra_sessions.stub(:Count).and_return 0
17
+ @extra_sessions.stub(:Open).and_return extra_session
18
+ @extra_sessions
19
+ end
20
+
21
+ def extra_session
22
+ @extra_session ||= double('session')
23
+ @extra_session.stub(:Screen).and_return extra_screen
24
+ @extra_session.stub(:WindowState=)
25
+ @extra_session.stub(:Visible=)
26
+ @extra_session
27
+ end
28
+
29
+ def extra_screen
30
+ @extra_screen ||= double('screen')
31
+ @extra_screen.stub(:SelectAll).and_return extra_area
32
+ @extra_screen
33
+ end
34
+
35
+ def extra_area
36
+ @extra_area ||= double('area')
37
+ @extra_area
38
+ end
39
+
40
+ def quick_system
41
+ @quick_system ||= double('quick_system')
42
+ @quick_system.stub(:ActiveSession).and_return quick_session
43
+ @quick_system.stub(:Visible=)
44
+ @quick_system
45
+ end
46
+
47
+ def quick_session
48
+ @quick_session ||= double('quick_session')
49
+ @quick_session.stub(:Screen).and_return quick_screen
50
+ @quick_session.stub(:Open)
51
+ @quick_session.stub(:Connect)
52
+ @quick_session.stub(:Server_Name=)
53
+ @quick_session.stub(:Connected).and_return true
54
+ @quick_session
55
+ end
56
+
57
+ def quick_screen
58
+ @quick_screen ||= double('screen')
59
+ @quick_screen
60
+ end
61
+
data/te3270.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'te3270/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "te3270"
8
+ spec.version = TE3270::VERSION
9
+ spec.platform = Gem::Platform::CURRENT
10
+ spec.authors = ["Jeffrey S. Morgan","Pradeep K. Macharla"]
11
+ spec.email = ["jeff.morgan@leandog.com","macharla.pradeep.kumar@gmail.com"]
12
+ spec.description = %q{Automates a 3270 Terminal Emulator}
13
+ spec.summary = %q{Automates a 3270 Terminal Emulator}
14
+ spec.homepage = "http://github.com/cheezy/te3270"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'page_navigation', '>= 0.9'
23
+ spec.add_dependency 'win32screenshot'
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "rspec"
28
+ end
29
+
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: te3270
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: x86-mingw32
6
+ authors:
7
+ - Jeffrey S. Morgan
8
+ - Pradeep K. Macharla
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: page_navigation
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0.9'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0.9'
28
+ - !ruby/object:Gem::Dependency
29
+ name: win32screenshot
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: '1.3'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '1.3'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ description: Automates a 3270 Terminal Emulator
85
+ email:
86
+ - jeff.morgan@leandog.com
87
+ - macharla.pradeep.kumar@gmail.com
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - .gitignore
93
+ - .rspec
94
+ - .travis.yml
95
+ - ChangeLog
96
+ - Gemfile
97
+ - Guardfile
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - lib/te3270.rb
102
+ - lib/te3270/accessors.rb
103
+ - lib/te3270/emulator_factory.rb
104
+ - lib/te3270/emulators/extra.rb
105
+ - lib/te3270/emulators/quick3270.rb
106
+ - lib/te3270/function_keys.rb
107
+ - lib/te3270/screen_factory.rb
108
+ - lib/te3270/version.rb
109
+ - spec/lib/te3270/accessors_spec.rb
110
+ - spec/lib/te3270/emulators/extra_spec.rb
111
+ - spec/lib/te3270/emulators/quick3270_spec.rb
112
+ - spec/lib/te3270/screen_factory_spec.rb
113
+ - spec/lib/te3270_spec.rb
114
+ - spec/spec_helper.rb
115
+ - te3270.gemspec
116
+ homepage: http://github.com/cheezy/te3270
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.0.0
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Automates a 3270 Terminal Emulator
140
+ test_files:
141
+ - spec/lib/te3270/accessors_spec.rb
142
+ - spec/lib/te3270/emulators/extra_spec.rb
143
+ - spec/lib/te3270/emulators/quick3270_spec.rb
144
+ - spec/lib/te3270/screen_factory_spec.rb
145
+ - spec/lib/te3270_spec.rb
146
+ - spec/spec_helper.rb
147
+ has_rdoc: