file_transfer 0.0.7 → 0.0.9

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,137 @@
1
+ require 'spec_helper'
2
+
3
+ module FileTransfer
4
+ describe FileTransfer do
5
+ let(:transfer_handler) { double('file_transfer_handler').as_null_object }
6
+
7
+ before do
8
+ allow(FileTransferHandler).to receive(:new) { transfer_handler }
9
+ end
10
+
11
+ describe '.upload' do
12
+ it 'initializes new FileTransferHandler object' do
13
+ expect(FileTransferHandler).to receive(:new).with(:test, { :test => :test }) { transfer_handler }
14
+ FileTransfer.upload(:test, { :test => :test }, '/test')
15
+ end
16
+
17
+ it 'executes upload call' do
18
+ expect(transfer_handler).to receive(:upload).with('/test')
19
+ FileTransfer.upload(:test, { :test => :test }, '/test')
20
+ end
21
+ it 'closes handle' do
22
+ expect(transfer_handler).to receive(:close)
23
+ FileTransfer.upload(:test, { :test => :test }, '/test')
24
+ end
25
+
26
+ it 'gets result' do
27
+ allow(transfer_handler).to receive(:upload) { 'result' }
28
+ expect(FileTransfer.upload(:test, { :test => :test }, '/test')).to eq('result')
29
+ end
30
+ end
31
+
32
+ describe '.download' do
33
+ it 'initializes new FileTransferHandler object' do
34
+ expect(FileTransferHandler).to receive(:new).with(:test, { :test => :test }) { transfer_handler }
35
+ FileTransfer.download(:test, { :test => :test }, '/test')
36
+ end
37
+
38
+ it 'executes download call' do
39
+ expect(transfer_handler).to receive(:download).with('/test')
40
+ FileTransfer.download(:test, { :test => :test }, '/test')
41
+ end
42
+ it 'closes handle' do
43
+ expect(transfer_handler).to receive(:close)
44
+ FileTransfer.download(:test, { :test => :test }, '/test')
45
+ end
46
+
47
+ it 'gets result' do
48
+ allow(transfer_handler).to receive(:download) { 'result' }
49
+ expect(FileTransfer.download(:test, { :test => :test }, '/test')).to eq('result')
50
+ end
51
+ end
52
+
53
+ describe '.remove' do
54
+ it 'initializes new FileTransferHandler object' do
55
+ expect(FileTransferHandler).to receive(:new).with(:test, { :test => :test }) { transfer_handler }
56
+ FileTransfer.remove(:test, { :test => :test }, '/test')
57
+ end
58
+
59
+ it 'executes remove call' do
60
+ expect(transfer_handler).to receive(:remove).with('/test')
61
+ FileTransfer.remove(:test, { :test => :test }, '/test')
62
+ end
63
+ it 'closes handle' do
64
+ expect(transfer_handler).to receive(:close)
65
+ FileTransfer.remove(:test, { :test => :test }, '/test')
66
+ end
67
+
68
+ it 'gets result' do
69
+ allow(transfer_handler).to receive(:remove) { 'result' }
70
+ expect(FileTransfer.remove(:test, { :test => :test }, '/test')).to eq('result')
71
+ end
72
+ end
73
+
74
+ describe '.rename' do
75
+ it 'initializes new FileTransferHandler object' do
76
+ expect(FileTransferHandler).to receive(:new).with(:test, { :test => :test }) { transfer_handler }
77
+ FileTransfer.remove(:test, { :test => :test }, '/test')
78
+ end
79
+
80
+ it 'executes remove call' do
81
+ expect(transfer_handler).to receive(:remove).with('/test')
82
+ FileTransfer.remove(:test, { :test => :test }, '/test')
83
+ end
84
+ it 'closes handle' do
85
+ expect(transfer_handler).to receive(:close)
86
+ FileTransfer.remove(:test, { :test => :test }, '/test')
87
+ end
88
+
89
+ it 'gets result' do
90
+ allow(transfer_handler).to receive(:remove) { 'result' }
91
+ expect(FileTransfer.remove(:test, { :test => :test }, '/test')).to eq('result')
92
+ end
93
+ end
94
+
95
+ describe '.list' do
96
+ it 'initializes new FileTransferHandler object' do
97
+ expect(FileTransferHandler).to receive(:new).with(:test, { :test => :test }) { transfer_handler }
98
+ FileTransfer.remove(:test, { :test => :test }, '/test')
99
+ end
100
+
101
+ it 'executes list call' do
102
+ expect(transfer_handler).to receive(:list).with('/test')
103
+ FileTransfer.list(:test, { :test => :test }, '/test')
104
+ end
105
+ it 'closes handle' do
106
+ expect(transfer_handler).to receive(:close)
107
+ FileTransfer.list(:test, { :test => :test }, '/test')
108
+ end
109
+
110
+ it 'gets result' do
111
+ allow(transfer_handler).to receive(:list) { 'result' }
112
+ expect(FileTransfer.list(:test, { :test => :test }, '/test')).to eq('result')
113
+ end
114
+ end
115
+
116
+ describe '.exists?' do
117
+ it 'initializes new FileTransferHandler object' do
118
+ expect(FileTransferHandler).to receive(:new).with(:test, { :test => :test }) { transfer_handler }
119
+ FileTransfer.exists?(:test, { :test => :test }, '/test')
120
+ end
121
+
122
+ it 'executes exists? call' do
123
+ expect(transfer_handler).to receive(:exists?).with('/test')
124
+ FileTransfer.exists?(:test, { :test => :test }, '/test')
125
+ end
126
+ it 'closes handle' do
127
+ expect(transfer_handler).to receive(:close)
128
+ FileTransfer.exists?(:test, { :test => :test }, '/test')
129
+ end
130
+
131
+ it 'gets result' do
132
+ allow(transfer_handler).to receive(:exists?) { 'result' }
133
+ expect(FileTransfer.exists?(:test, { :test => :test }, '/test')).to eq('result')
134
+ end
135
+ end
136
+ end
137
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,19 +1,98 @@
1
- require "file_transfer"
2
-
3
- # This file was generated by the `rspec --init` command. Conventionally, all
4
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
- # Require this file using `require "spec_helper"` to ensure that it is only
6
- # loaded once.
7
- #
8
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
9
- RSpec.configure do |config|
10
- config.treat_symbols_as_metadata_keys_with_true_values = true
11
- config.run_all_when_everything_filtered = true
12
- config.filter_run :focus
13
-
14
- # Run specs in random order to surface order dependencies. If you find an
15
- # order dependency and want to debug it, you can fix the order by providing
16
- # the seed, which is printed after each run.
17
- # --seed 1234
18
- config.order = 'random'
19
- end
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ require 'file_transfer'
20
+
21
+ RSpec.configure do |config|
22
+ # rspec-expectations config goes here. You can use an alternate
23
+ # assertion/expectation library such as wrong or the stdlib/minitest
24
+ # assertions if you prefer.
25
+ config.expect_with :rspec do |expectations|
26
+ # This option will default to `true` in RSpec 4. It makes the `description`
27
+ # and `failure_message` of custom matchers include text for helper methods
28
+ # defined using `chain`, e.g.:
29
+ # be_bigger_than(2).and_smaller_than(4).description
30
+ # # => "be bigger than 2 and smaller than 4"
31
+ # ...rather than:
32
+ # # => "be bigger than 2"
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ # rspec-mocks config goes here. You can use an alternate test double
37
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
38
+ config.mock_with :rspec do |mocks|
39
+ # Prevents you from mocking or stubbing a method that does not exist on
40
+ # a real object. This is generally recommended, and will default to
41
+ # `true` in RSpec 4.
42
+ mocks.verify_partial_doubles = true
43
+ end
44
+
45
+ # The settings below are suggested to provide a good initial experience
46
+ # with RSpec, but feel free to customize to your heart's content.
47
+ =begin
48
+ # These two settings work together to allow you to limit a spec run
49
+ # to individual examples or groups you care about by tagging them with
50
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
+ # get run.
52
+ config.filter_run :focus
53
+ config.run_all_when_everything_filtered = true
54
+
55
+ # Allows RSpec to persist some state between runs in order to support
56
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
57
+ # you configure your source control system to ignore this file.
58
+ config.example_status_persistence_file_path = "spec/examples.txt"
59
+
60
+ # Limits the available syntax to the non-monkey patched syntax that is
61
+ # recommended. For more details, see:
62
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
63
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
64
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
65
+ config.disable_monkey_patching!
66
+
67
+ # This setting enables warnings. It's recommended, but in some cases may
68
+ # be too noisy due to issues in dependencies.
69
+ config.warnings = true
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = 'doc'
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+ =end
98
+ end
metadata CHANGED
@@ -1,152 +1,139 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: file_transfer
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.7
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.0.9
6
6
  platform: ruby
7
- authors:
8
- - impac GmbH
7
+ authors:
8
+ - impac GmbH
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-13 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rspec
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: rake
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: jruby-pageant
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: net-sftp
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :runtime
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
12
+
13
+ date: 2016-03-24 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rspec
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :development
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: 0.9.2.2
36
+ type: :development
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: jruby-pageant
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: jruby-openssl
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - "="
56
+ - !ruby/object:Gem::Version
57
+ version: 0.7.6.1
58
+ type: :development
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: net-sftp
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.5
69
+ type: :runtime
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: net-ssh
73
+ prerelease: false
74
+ requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: 2.5.2
80
+ type: :runtime
81
+ version_requirements: *id006
78
82
  description: File Transfer Handler for multiple Protocols
79
- email:
80
- - info@impac.ch
83
+ email:
84
+ - info@impac.ch
81
85
  executables: []
86
+
82
87
  extensions: []
88
+
83
89
  extra_rdoc_files: []
84
- files:
85
- - lib/file_transfer/file_transfer_handler.rb
86
- - lib/file_transfer/ftp.rb
87
- - lib/file_transfer/ftps.rb
88
- - lib/file_transfer/generic.rb
89
- - lib/file_transfer/sftp.rb
90
- - lib/file_transfer/version.rb
91
- - lib/file_transfer.rb
92
- - spec/file_transfer/file_transfer_handler_spec.rb
93
- - spec/spec_helper.rb
94
- - spec/test_files/Chrysanthemum.jpg
95
- - spec/test_files/Desert.jpg
96
- - spec/test_files/empty_file.csv
97
- - spec/test_files/empty_file_from_sftp.csv
98
- - spec/test_files/folder1/Koala.jpg
99
- - spec/test_files/folder1/Lighthouse.jpg
100
- - spec/test_files/folder1/text_3.txt
101
- - spec/test_files/folder1/text_4.txt
102
- - spec/test_files/folder2/Jellyfish.jpg
103
- - spec/test_files/folder2/Penguins.jpg
104
- - spec/test_files/folder2/text_1.txt
105
- - spec/test_files/folder2/text_6.txt
106
- - spec/test_files/folder2/Tulips.jpg
107
- - spec/test_files/Hydrangeas.jpg
108
- - spec/test_files/text_1.txt
109
- - spec/test_files/text_2.txt
90
+
91
+ files:
92
+ - lib/file_transfer.rb
93
+ - lib/file_transfer/file_transfer_handler.rb
94
+ - lib/file_transfer/ftp.rb
95
+ - lib/file_transfer/ftps.rb
96
+ - lib/file_transfer/generic.rb
97
+ - lib/file_transfer/sftp.rb
98
+ - lib/file_transfer/version.rb
99
+ - spec/file_transfer_spec.rb
100
+ - spec/spec_helper.rb
101
+ - spec/file_transfer/file_transfer_handler_spec.rb
102
+ - spec/file_transfer/generic_spec.rb
103
+ - spec/file_transfer/sftp_spec.rb
104
+ - spec/test_files/empty_file.csv
105
+ has_rdoc: true
110
106
  homepage: http://www.impac.ch
111
107
  licenses: []
108
+
112
109
  post_install_message:
113
110
  rdoc_options: []
114
- require_paths:
115
- - lib
116
- required_ruby_version: !ruby/object:Gem::Requirement
111
+
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
117
115
  none: false
118
- requirements:
119
- - - ! '>='
120
- - !ruby/object:Gem::Version
121
- version: '0'
122
- required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: "0"
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
121
  none: false
124
- requirements:
125
- - - ! '>='
126
- - !ruby/object:Gem::Version
127
- version: '0'
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: "0"
128
126
  requirements: []
127
+
129
128
  rubyforge_project:
130
- rubygems_version: 1.8.24
129
+ rubygems_version: 1.5.1
131
130
  signing_key:
132
131
  specification_version: 3
133
132
  summary: Transfer Files from and to FTP/SFTP/FTPS
134
- test_files:
135
- - spec/file_transfer/file_transfer_handler_spec.rb
136
- - spec/spec_helper.rb
137
- - spec/test_files/Chrysanthemum.jpg
138
- - spec/test_files/Desert.jpg
139
- - spec/test_files/empty_file.csv
140
- - spec/test_files/empty_file_from_sftp.csv
141
- - spec/test_files/folder1/Koala.jpg
142
- - spec/test_files/folder1/Lighthouse.jpg
143
- - spec/test_files/folder1/text_3.txt
144
- - spec/test_files/folder1/text_4.txt
145
- - spec/test_files/folder2/Jellyfish.jpg
146
- - spec/test_files/folder2/Penguins.jpg
147
- - spec/test_files/folder2/text_1.txt
148
- - spec/test_files/folder2/text_6.txt
149
- - spec/test_files/folder2/Tulips.jpg
150
- - spec/test_files/Hydrangeas.jpg
151
- - spec/test_files/text_1.txt
152
- - spec/test_files/text_2.txt
133
+ test_files:
134
+ - spec/file_transfer_spec.rb
135
+ - spec/spec_helper.rb
136
+ - spec/file_transfer/file_transfer_handler_spec.rb
137
+ - spec/file_transfer/generic_spec.rb
138
+ - spec/file_transfer/sftp_spec.rb
139
+ - spec/test_files/empty_file.csv
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- COL1,COL2,COL3
Binary file
Binary file
@@ -1 +0,0 @@
1
- abc
@@ -1 +0,0 @@
1
- abc
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- abc
@@ -1 +0,0 @@
1
- abc
@@ -1 +0,0 @@
1
- abc
@@ -1 +0,0 @@
1
- abc