netprint 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -5
- data/lib/netprint/version.rb +1 -1
- data/netprint.gemspec +2 -2
- data/spec/netprint/agent_spec.rb +11 -11
- data/spec/netprint/options_spec.rb +44 -44
- data/spec/spec_helper.rb +2 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 487b5d326fe955b64cfe6791607ddb6239a3f3cbe1bdcf524f8f4d89f8617402
|
4
|
+
data.tar.gz: 9e34746991a1a3561bfe21843583131604b7ac44971f276cc6fbc81c36fa6d0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 455d591c31fef5e60766977e6e07741fe30b1a9627728172199e75afe2cf11ccbd8dd33820b8693f06ba3ecf8a2dd8a03443ee3ba96b8dc6a70562fd579ac490
|
7
|
+
data.tar.gz: faa0da4ee4cbbd0879209b7c982c1f74308b309a57f3dbbf8d2999764919073318d6b9a172ffc3561fc6def0dd3c1c1ee9d05fe621d3fd8199507f67a03a9d39
|
data/.travis.yml
CHANGED
data/lib/netprint/version.rb
CHANGED
data/netprint.gemspec
CHANGED
@@ -15,8 +15,8 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Netprint::VERSION
|
17
17
|
|
18
|
-
gem.add_development_dependency('rspec', ['~>
|
19
|
-
gem.add_development_dependency('rake', '
|
18
|
+
gem.add_development_dependency('rspec', ['~> 3.9.0'])
|
19
|
+
gem.add_development_dependency('rake', '>= 12.3.3')
|
20
20
|
gem.add_development_dependency('webmock')
|
21
21
|
gem.add_dependency('mechanize', '2.7.0')
|
22
22
|
gem.add_dependency('docopt')
|
data/spec/netprint/agent_spec.rb
CHANGED
@@ -23,16 +23,16 @@ describe Agent do
|
|
23
23
|
to_return(read_fixture_file('list_empty.html'))
|
24
24
|
end
|
25
25
|
|
26
|
-
it '
|
27
|
-
@agent.
|
26
|
+
it 'logins' do
|
27
|
+
expect(@agent).not_to be_login
|
28
28
|
|
29
29
|
@agent.login
|
30
30
|
|
31
|
-
@agent.
|
31
|
+
expect(@agent).to be_login
|
32
32
|
end
|
33
33
|
|
34
34
|
shared_examples_for '#upload' do
|
35
|
-
it '
|
35
|
+
it 'uploads' do
|
36
36
|
stub_request(:post, 'https://www.printing.ne.jp/usr/web/auth/NPFL0010.seam').
|
37
37
|
with(body: {
|
38
38
|
'NPFL0010' => 'NPFL0010',
|
@@ -62,10 +62,10 @@ describe Agent do
|
|
62
62
|
@agent.login
|
63
63
|
|
64
64
|
code = @agent.upload(filename)
|
65
|
-
code.
|
65
|
+
expect(code).to match(/^[0-9A-Z]{8}$/)
|
66
66
|
end
|
67
67
|
|
68
|
-
it '
|
68
|
+
it 'handles registration error' do
|
69
69
|
stub_request(:post, 'https://www.printing.ne.jp/usr/web/auth/NPFL0010.seam').
|
70
70
|
with(body: {
|
71
71
|
'NPFL0010' => 'NPFL0010',
|
@@ -94,12 +94,12 @@ describe Agent do
|
|
94
94
|
filename = File.expand_path(pdf_filename)
|
95
95
|
@agent.login
|
96
96
|
|
97
|
-
|
97
|
+
expect {
|
98
98
|
@agent.upload(filename)
|
99
|
-
}.
|
99
|
+
}.to raise_error(RegistrationError)
|
100
100
|
end
|
101
101
|
|
102
|
-
it '
|
102
|
+
it 'handles upload error' do
|
103
103
|
stub_request(:post, 'https://www.printing.ne.jp/usr/web/auth/NPFL0010.seam').
|
104
104
|
with(body: {
|
105
105
|
'NPFL0010' => 'NPFL0010',
|
@@ -117,9 +117,9 @@ describe Agent do
|
|
117
117
|
filename = File.expand_path(pdf_filename)
|
118
118
|
@agent.login
|
119
119
|
|
120
|
-
|
120
|
+
expect {
|
121
121
|
@agent.upload(filename)
|
122
|
-
}.
|
122
|
+
}.to raise_error(UploadError, 'error message')
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -13,13 +13,13 @@ describe Options do
|
|
13
13
|
context 'default' do
|
14
14
|
it do
|
15
15
|
form = Object.new
|
16
|
-
form.
|
17
|
-
form.
|
18
|
-
form.
|
19
|
-
form.
|
20
|
-
form.
|
16
|
+
expect(form).to be_checked('yus-size', PAPERSIZE::A4)
|
17
|
+
expect(form).to be_checked('iro-cl', COLOR::BW)
|
18
|
+
expect(form).to be_checked('yyk-type-cl', CODE_TYPE::ALNUM)
|
19
|
+
expect(form).to be_checked('pin-num-set-fl', '0')
|
20
|
+
expect(form).to be_checked('notice-onoff', '0')
|
21
21
|
|
22
|
-
form.
|
22
|
+
expect(form).not_to receive(:[]=)
|
23
23
|
|
24
24
|
subject.apply(form)
|
25
25
|
end
|
@@ -30,13 +30,13 @@ describe Options do
|
|
30
30
|
|
31
31
|
it do
|
32
32
|
form = Object.new
|
33
|
-
form.
|
34
|
-
form.
|
35
|
-
form.
|
36
|
-
form.
|
37
|
-
form.
|
33
|
+
expect(form).to be_checked('yus-size', PAPERSIZE::A4)
|
34
|
+
expect(form).to be_checked('iro-cl', COLOR::BW)
|
35
|
+
expect(form).to be_checked('yyk-type-cl', CODE_TYPE::ALNUM)
|
36
|
+
expect(form).to be_checked('pin-num-set-fl', '1')
|
37
|
+
expect(form).to be_checked('notice-onoff', '0')
|
38
38
|
|
39
|
-
form.
|
39
|
+
expect(form).to receive(:[]=).with('pin-no', '0123')
|
40
40
|
|
41
41
|
subject.apply(form)
|
42
42
|
end
|
@@ -47,13 +47,13 @@ describe Options do
|
|
47
47
|
|
48
48
|
it do
|
49
49
|
form = Object.new
|
50
|
-
form.
|
51
|
-
form.
|
52
|
-
form.
|
53
|
-
form.
|
54
|
-
form.
|
50
|
+
expect(form).to be_checked('yus-size', PAPERSIZE::A4)
|
51
|
+
expect(form).to be_checked('iro-cl', COLOR::BW)
|
52
|
+
expect(form).to be_checked('yyk-type-cl', CODE_TYPE::ALNUM)
|
53
|
+
expect(form).to be_checked('pin-num-set-fl', '0')
|
54
|
+
expect(form).to be_checked('notice-onoff', '1')
|
55
55
|
|
56
|
-
form.
|
56
|
+
expect(form).to receive(:[]=).with('mail-adr-to-tx', 'test@example.com')
|
57
57
|
|
58
58
|
subject.apply(form)
|
59
59
|
end
|
@@ -64,13 +64,13 @@ describe Options do
|
|
64
64
|
|
65
65
|
it do
|
66
66
|
form = Object.new
|
67
|
-
form.
|
68
|
-
form.
|
69
|
-
form.
|
70
|
-
form.
|
71
|
-
form.
|
67
|
+
expect(form).to be_checked('yus-size', PAPERSIZE::B4)
|
68
|
+
expect(form).to be_checked('iro-cl', COLOR::BW)
|
69
|
+
expect(form).to be_checked('yyk-type-cl', CODE_TYPE::ALNUM)
|
70
|
+
expect(form).to be_checked('pin-num-set-fl', '0')
|
71
|
+
expect(form).to be_checked('notice-onoff', '0')
|
72
72
|
|
73
|
-
form.
|
73
|
+
expect(form).not_to receive(:[]=)
|
74
74
|
|
75
75
|
subject.apply(form)
|
76
76
|
end
|
@@ -81,13 +81,13 @@ describe Options do
|
|
81
81
|
|
82
82
|
it do
|
83
83
|
form = Object.new
|
84
|
-
form.
|
85
|
-
form.
|
86
|
-
form.
|
87
|
-
form.
|
88
|
-
form.
|
84
|
+
expect(form).to be_checked('yus-size', PAPERSIZE::A4)
|
85
|
+
expect(form).to be_checked('iro-cl', COLOR::COLOR)
|
86
|
+
expect(form).to be_checked('yyk-type-cl', CODE_TYPE::ALNUM)
|
87
|
+
expect(form).to be_checked('pin-num-set-fl', '0')
|
88
|
+
expect(form).to be_checked('notice-onoff', '0')
|
89
89
|
|
90
|
-
form.
|
90
|
+
expect(form).not_to receive(:[]=)
|
91
91
|
|
92
92
|
subject.apply(form)
|
93
93
|
end
|
@@ -98,13 +98,13 @@ describe Options do
|
|
98
98
|
|
99
99
|
it do
|
100
100
|
form = Object.new
|
101
|
-
form.
|
102
|
-
form.
|
103
|
-
form.
|
104
|
-
form.
|
105
|
-
form.
|
101
|
+
expect(form).to be_checked('yus-size', PAPERSIZE::A4)
|
102
|
+
expect(form).to be_checked('iro-cl', COLOR::BW)
|
103
|
+
expect(form).to be_checked('yyk-type-cl', CODE_TYPE::NUM)
|
104
|
+
expect(form).to be_checked('pin-num-set-fl', '0')
|
105
|
+
expect(form).to be_checked('notice-onoff', '0')
|
106
106
|
|
107
|
-
form.
|
107
|
+
expect(form).not_to receive(:[]=)
|
108
108
|
|
109
109
|
subject.apply(form)
|
110
110
|
end
|
@@ -123,14 +123,14 @@ describe Options do
|
|
123
123
|
|
124
124
|
it do
|
125
125
|
form = Object.new
|
126
|
-
form.
|
127
|
-
form.
|
128
|
-
form.
|
129
|
-
form.
|
130
|
-
form.
|
131
|
-
|
132
|
-
form.
|
133
|
-
form.
|
126
|
+
expect(form).to be_checked('yus-size', PAPERSIZE::B5)
|
127
|
+
expect(form).to be_checked('iro-cl', COLOR::SELECT_WHEN_PRINT)
|
128
|
+
expect(form).to be_checked('yyk-type-cl', CODE_TYPE::NUM)
|
129
|
+
expect(form).to be_checked('pin-num-set-fl', '1')
|
130
|
+
expect(form).to be_checked('notice-onoff', '1')
|
131
|
+
|
132
|
+
expect(form).to receive(:[]=).with('pin-no', '0987')
|
133
|
+
expect(form).to receive(:[]=).with('mail-adr-to-tx', 'foo@example.com')
|
134
134
|
|
135
135
|
subject.apply(form)
|
136
136
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,7 +9,6 @@ require 'webmock/rspec'
|
|
9
9
|
#
|
10
10
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
11
11
|
RSpec.configure do |config|
|
12
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
12
|
config.run_all_when_everything_filtered = true
|
14
13
|
config.filter_run :focus
|
15
14
|
|
@@ -31,8 +30,8 @@ end
|
|
31
30
|
RSpec::Matchers.define :be_checked do |name, value|
|
32
31
|
match do |form|
|
33
32
|
radiobutton = Object.new
|
34
|
-
radiobutton.
|
33
|
+
expect(radiobutton).to receive(:check)
|
35
34
|
|
36
|
-
form.
|
35
|
+
expect(form).to receive(:radiobutton_with).with(:name => name, :value => value).and_return(radiobutton)
|
37
36
|
end
|
38
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netprint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youpy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.9.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.9.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|