moo_moo 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -1
- data/README.md +29 -14
- data/lib/moo_moo/exceptions.rb +4 -0
- data/lib/moo_moo/opensrs/args.rb +86 -86
- data/lib/moo_moo/opensrs/base.rb +9 -11
- data/lib/moo_moo/opensrs.rb +9 -4
- data/lib/moo_moo/version.rb +1 -1
- data/lib/moo_moo.rb +2 -0
- data/moo_moo.gemspec +3 -7
- data/spec/moo_moo/config_spec.rb +12 -0
- data/spec/moo_moo/opensrs/args_spec.rb +176 -0
- data/spec/moo_moo/opensrs/base_spec.rb +22 -0
- data/spec/moo_moo/opensrs/cookie_spec.rb +76 -0
- data/spec/moo_moo/opensrs/lookup_spec.rb +208 -0
- data/spec/moo_moo/opensrs/nameserver_spec.rb +136 -0
- data/spec/moo_moo/opensrs/provisioning_spec.rb +198 -0
- data/spec/moo_moo/opensrs/transfer_spec.rb +124 -0
- data/spec/moo_moo_spec.rb +16 -0
- data/spec/spec_helper.rb +36 -5
- metadata +79 -105
- data/lib/moo_moo/opensrs/opensrsexception.rb +0 -6
- data/lib/moo_moo/opensrs/utils.rb +0 -13
- data/spec/opensrs/args_spec.rb +0 -179
- data/spec/opensrs/cookie_spec.rb +0 -78
- data/spec/opensrs/lookup_spec.rb +0 -212
- data/spec/opensrs/nameserver_spec.rb +0 -124
- data/spec/opensrs/opensrs_spec.rb +0 -35
- data/spec/opensrs/provisioning_spec.rb +0 -271
- data/spec/opensrs/transfer_spec.rb +0 -197
- data/spec/opensrs/utils_spec.rb +0 -12
data/spec/spec_helper.rb
CHANGED
@@ -10,10 +10,6 @@ MooMoo.configure do |config|
|
|
10
10
|
config.pass = ENV['OPENSRS_TEST_PASS']
|
11
11
|
end
|
12
12
|
|
13
|
-
def requires_attr(attr, &block)
|
14
|
-
expect { block.call }.to raise_error(MooMoo::MooMooArgumentError, /Missing required parameter: #{attr}/i)
|
15
|
-
end
|
16
|
-
|
17
13
|
VCR.config do |c|
|
18
14
|
c.cassette_library_dir = 'spec/vcr_cassettes'
|
19
15
|
c.stub_with :fakeweb
|
@@ -21,10 +17,45 @@ VCR.config do |c|
|
|
21
17
|
c.default_cassette_options = {:record => :new_episodes, :match_requests_on => [:uri]}
|
22
18
|
end
|
23
19
|
|
20
|
+
def requires_attr(attr, &block)
|
21
|
+
expect { block.call }.to raise_error(MooMoo::MooMooArgumentError, /Missing required parameter: #{attr}/i)
|
22
|
+
end
|
23
|
+
|
24
24
|
def live_test?
|
25
25
|
!ENV['OPENSRS_REAL'].nil?
|
26
26
|
end
|
27
27
|
|
28
|
+
def random_domain
|
29
|
+
"domainthatsnottaken#{Time.now.to_i}.com"
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_contacts
|
33
|
+
contact = {
|
34
|
+
:first_name => "Owen",
|
35
|
+
:last_name => "Ottway",
|
36
|
+
:phone => "+1.4165550123x1902",
|
37
|
+
:fax => "+1.4165550124",
|
38
|
+
:email => "ottway@example.com",
|
39
|
+
:org_name => "Example Inc.",
|
40
|
+
:address1 => "32 Oak Street",
|
41
|
+
:address2 => "Suite 500",
|
42
|
+
:address3 => "Owner",
|
43
|
+
:city => "SomeCity",
|
44
|
+
:state => "CA",
|
45
|
+
:country => "US",
|
46
|
+
:postal_code => "90210",
|
47
|
+
:url => "http://www.example.com"
|
48
|
+
}
|
49
|
+
|
50
|
+
out = {
|
51
|
+
:title => "blahblah",
|
52
|
+
:owner => contact,
|
53
|
+
:admin => contact,
|
54
|
+
:billing => contact,
|
55
|
+
:tech => contact
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
28
59
|
RSpec.configure do |c|
|
29
60
|
c.extend VCR::RSpec::Macros
|
30
61
|
c.before(:each) do
|
@@ -52,6 +83,6 @@ RSpec::Matchers.define :have_attr_accessor do |attribute|
|
|
52
83
|
end
|
53
84
|
|
54
85
|
description do
|
55
|
-
"have
|
86
|
+
"have attr_accessor :#{attribute}"
|
56
87
|
end
|
57
88
|
end
|
metadata
CHANGED
@@ -1,105 +1,78 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: moo_moo
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Tim Parkin
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: rake
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &13915560 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
18
|
+
requirements:
|
22
19
|
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 0.
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.9.2.2
|
25
22
|
type: :development
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *13915560
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &13915060 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
29
|
+
requirements:
|
33
30
|
- - ~>
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: 2.
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.8.0
|
36
33
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: fakeweb
|
40
34
|
prerelease: false
|
41
|
-
|
35
|
+
version_requirements: *13915060
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: fakeweb
|
38
|
+
requirement: &13914600 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
|
-
requirements:
|
40
|
+
requirements:
|
44
41
|
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
46
43
|
version: 1.3.0
|
47
44
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: vcr
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *13914600
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: vcr
|
49
|
+
requirement: &13914140 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
51
|
+
requirements:
|
55
52
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 1.
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.11.3
|
58
55
|
type: :development
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: rcov
|
62
56
|
prerelease: false
|
63
|
-
|
64
|
-
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.9.9
|
69
|
-
type: :development
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: metric_fu
|
73
|
-
prerelease: false
|
74
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
|
-
requirements:
|
77
|
-
- - ">="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 2.1.1
|
80
|
-
type: :development
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *13914140
|
58
|
+
- !ruby/object:Gem::Dependency
|
83
59
|
name: extlib
|
84
|
-
|
85
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
60
|
+
requirement: &13913760 !ruby/object:Gem::Requirement
|
86
61
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version:
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
91
66
|
type: :runtime
|
92
|
-
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *13913760
|
93
69
|
description: Implements OpenSRS XML API
|
94
|
-
email:
|
70
|
+
email:
|
95
71
|
- tparkin@site5.com
|
96
72
|
executables: []
|
97
|
-
|
98
73
|
extensions: []
|
99
|
-
|
100
74
|
extra_rdoc_files: []
|
101
|
-
|
102
|
-
files:
|
75
|
+
files:
|
103
76
|
- .gitignore
|
104
77
|
- .rspec
|
105
78
|
- .rvmrc
|
@@ -111,6 +84,7 @@ files:
|
|
111
84
|
- lib/cacert.pem
|
112
85
|
- lib/moo_moo.rb
|
113
86
|
- lib/moo_moo/config.rb
|
87
|
+
- lib/moo_moo/exceptions.rb
|
114
88
|
- lib/moo_moo/opensrs.rb
|
115
89
|
- lib/moo_moo/opensrs/args.rb
|
116
90
|
- lib/moo_moo/opensrs/base.rb
|
@@ -118,22 +92,20 @@ files:
|
|
118
92
|
- lib/moo_moo/opensrs/cookie_commands.rb
|
119
93
|
- lib/moo_moo/opensrs/lookup_commands.rb
|
120
94
|
- lib/moo_moo/opensrs/nameserver_commands.rb
|
121
|
-
- lib/moo_moo/opensrs/opensrsexception.rb
|
122
95
|
- lib/moo_moo/opensrs/provisioning_commands.rb
|
123
96
|
- lib/moo_moo/opensrs/response.rb
|
124
97
|
- lib/moo_moo/opensrs/transfer_commands.rb
|
125
|
-
- lib/moo_moo/opensrs/utils.rb
|
126
98
|
- lib/moo_moo/version.rb
|
127
99
|
- moo_moo.gemspec
|
100
|
+
- spec/moo_moo/config_spec.rb
|
101
|
+
- spec/moo_moo/opensrs/args_spec.rb
|
102
|
+
- spec/moo_moo/opensrs/base_spec.rb
|
103
|
+
- spec/moo_moo/opensrs/cookie_spec.rb
|
104
|
+
- spec/moo_moo/opensrs/lookup_spec.rb
|
105
|
+
- spec/moo_moo/opensrs/nameserver_spec.rb
|
106
|
+
- spec/moo_moo/opensrs/provisioning_spec.rb
|
107
|
+
- spec/moo_moo/opensrs/transfer_spec.rb
|
128
108
|
- spec/moo_moo_spec.rb
|
129
|
-
- spec/opensrs/args_spec.rb
|
130
|
-
- spec/opensrs/cookie_spec.rb
|
131
|
-
- spec/opensrs/lookup_spec.rb
|
132
|
-
- spec/opensrs/nameserver_spec.rb
|
133
|
-
- spec/opensrs/opensrs_spec.rb
|
134
|
-
- spec/opensrs/provisioning_spec.rb
|
135
|
-
- spec/opensrs/transfer_spec.rb
|
136
|
-
- spec/opensrs/utils_spec.rb
|
137
109
|
- spec/spec_helper.rb
|
138
110
|
- spec/vcr_cassettes/cookie/delete_cookie.yml
|
139
111
|
- spec/vcr_cassettes/cookie/quit_session.yml
|
@@ -187,44 +159,46 @@ files:
|
|
187
159
|
- spec/vcr_cassettes/transfer/rsp2rsp_push_transfer.yml
|
188
160
|
- spec/vcr_cassettes/transfer/send_password.yml
|
189
161
|
- spec/vcr_cassettes/transfer/transfer.yml
|
190
|
-
|
191
|
-
homepage: ""
|
162
|
+
homepage: ''
|
192
163
|
licenses: []
|
193
|
-
|
194
164
|
post_install_message:
|
195
165
|
rdoc_options: []
|
196
|
-
|
197
|
-
require_paths:
|
166
|
+
require_paths:
|
198
167
|
- lib
|
199
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
200
169
|
none: false
|
201
|
-
requirements:
|
202
|
-
- -
|
203
|
-
- !ruby/object:Gem::Version
|
204
|
-
version:
|
205
|
-
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
segments:
|
175
|
+
- 0
|
176
|
+
hash: -4054309782593500337
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
178
|
none: false
|
207
|
-
requirements:
|
208
|
-
- -
|
209
|
-
- !ruby/object:Gem::Version
|
210
|
-
version:
|
179
|
+
requirements:
|
180
|
+
- - ! '>='
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
segments:
|
184
|
+
- 0
|
185
|
+
hash: -4054309782593500337
|
211
186
|
requirements: []
|
212
|
-
|
213
187
|
rubyforge_project: opensrs
|
214
|
-
rubygems_version: 1.
|
188
|
+
rubygems_version: 1.8.11
|
215
189
|
signing_key:
|
216
190
|
specification_version: 3
|
217
191
|
summary: Implements OpenSRS XML API
|
218
|
-
test_files:
|
192
|
+
test_files:
|
193
|
+
- spec/moo_moo/config_spec.rb
|
194
|
+
- spec/moo_moo/opensrs/args_spec.rb
|
195
|
+
- spec/moo_moo/opensrs/base_spec.rb
|
196
|
+
- spec/moo_moo/opensrs/cookie_spec.rb
|
197
|
+
- spec/moo_moo/opensrs/lookup_spec.rb
|
198
|
+
- spec/moo_moo/opensrs/nameserver_spec.rb
|
199
|
+
- spec/moo_moo/opensrs/provisioning_spec.rb
|
200
|
+
- spec/moo_moo/opensrs/transfer_spec.rb
|
219
201
|
- spec/moo_moo_spec.rb
|
220
|
-
- spec/opensrs/args_spec.rb
|
221
|
-
- spec/opensrs/cookie_spec.rb
|
222
|
-
- spec/opensrs/lookup_spec.rb
|
223
|
-
- spec/opensrs/nameserver_spec.rb
|
224
|
-
- spec/opensrs/opensrs_spec.rb
|
225
|
-
- spec/opensrs/provisioning_spec.rb
|
226
|
-
- spec/opensrs/transfer_spec.rb
|
227
|
-
- spec/opensrs/utils_spec.rb
|
228
202
|
- spec/spec_helper.rb
|
229
203
|
- spec/vcr_cassettes/cookie/delete_cookie.yml
|
230
204
|
- spec/vcr_cassettes/cookie/quit_session.yml
|
data/spec/opensrs/args_spec.rb
DELETED
@@ -1,179 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'moo_moo/opensrs/args'
|
3
|
-
|
4
|
-
module MooMoo
|
5
|
-
describe MooMoo::Args do
|
6
|
-
context "required_parms" do
|
7
|
-
it "raises an error when missing" do
|
8
|
-
options = {:arg1 => true}
|
9
|
-
args = lambda {
|
10
|
-
MooMoo::Args.new(options) do |c|
|
11
|
-
c.requires :arg2
|
12
|
-
end
|
13
|
-
}
|
14
|
-
expect { args.call }.to raise_error(MooMooArgumentError, /Missing required parameter: arg2/)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "does not raise an error with valid params" do
|
18
|
-
options = {:arg1 => true}
|
19
|
-
args = MooMoo::Args.new(options) { |c|
|
20
|
-
c.requires :arg1
|
21
|
-
}
|
22
|
-
|
23
|
-
args.required_params.should have(1).value
|
24
|
-
args.required_params.should include(:arg1)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "sets optional_params" do
|
28
|
-
options = {:arg1 => true, :arg2 => 2}
|
29
|
-
args = MooMoo::Args.new(options) { |c|
|
30
|
-
c.requires :arg1, :arg2
|
31
|
-
}
|
32
|
-
|
33
|
-
args.optional_params.should have(2).values
|
34
|
-
args.required_params.should have(2).values
|
35
|
-
|
36
|
-
args.optional_params.should include(*args.required_params)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "does not set boolean_params" do
|
40
|
-
options = {:arg1 => true, :arg2 => 2}
|
41
|
-
args = MooMoo::Args.new(options) { |c|
|
42
|
-
c.requires :arg1, :arg2
|
43
|
-
}
|
44
|
-
|
45
|
-
args.boolean_params.should be_empty
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "boolean_params" do
|
50
|
-
it "raises an error when the param is not boolean" do
|
51
|
-
options = {:arg1 => 'string'}
|
52
|
-
args = lambda {
|
53
|
-
MooMoo::Args.new(options) do |c|
|
54
|
-
c.booleans :arg1
|
55
|
-
end
|
56
|
-
}
|
57
|
-
expect { args.call }.to raise_error(MooMooArgumentError, /Boolean parameter must be.*: arg1/)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "raises an error with boolean params" do
|
61
|
-
options = {:arg1 => true}
|
62
|
-
args = MooMoo::Args.new(options) { |c|
|
63
|
-
c.booleans :arg1
|
64
|
-
}
|
65
|
-
|
66
|
-
args.boolean_params.should have(1).value
|
67
|
-
args.boolean_params.should include(:arg1)
|
68
|
-
end
|
69
|
-
|
70
|
-
it "sets optional_params" do
|
71
|
-
options = {:arg1 => true, :arg2 => false}
|
72
|
-
args = MooMoo::Args.new(options) { |c|
|
73
|
-
c.booleans :arg1, :arg2
|
74
|
-
}
|
75
|
-
|
76
|
-
args.optional_params.should have(2).values
|
77
|
-
args.boolean_params.should have(2).values
|
78
|
-
|
79
|
-
args.optional_params.should include(:arg1, :arg2)
|
80
|
-
end
|
81
|
-
|
82
|
-
it "sets required_params" do
|
83
|
-
options = {:arg1 => true, :arg2 => false}
|
84
|
-
args = MooMoo::Args.new(options) { |c|
|
85
|
-
c.booleans :arg1, :arg2
|
86
|
-
}
|
87
|
-
|
88
|
-
args.required_params.should be_empty
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context "optional_params" do
|
93
|
-
it "raises an error with unknown params" do
|
94
|
-
options = {:arg1 => true}
|
95
|
-
args = lambda {
|
96
|
-
MooMoo::Args.new(options) do |c|
|
97
|
-
c.optionals :arg2
|
98
|
-
end
|
99
|
-
}
|
100
|
-
|
101
|
-
expect { args.call }.to raise_error(MooMooArgumentError, /Not a valid parameter: arg1/)
|
102
|
-
end
|
103
|
-
|
104
|
-
it "does not raise an error with known params" do
|
105
|
-
options = {:arg1 => true, :arg2 => 2}
|
106
|
-
args = MooMoo::Args.new(options) { |c|
|
107
|
-
c.optionals :arg1, :arg2
|
108
|
-
}
|
109
|
-
|
110
|
-
args.optional_params.should have(2).values
|
111
|
-
args.optional_params.should include(:arg1, :arg2)
|
112
|
-
end
|
113
|
-
|
114
|
-
it "does not set required_params" do
|
115
|
-
options = {:arg1 => true, :arg2 => 2}
|
116
|
-
args = MooMoo::Args.new(options) { |c|
|
117
|
-
c.optionals :arg1, :arg2
|
118
|
-
}
|
119
|
-
|
120
|
-
args.required_params.should be_empty
|
121
|
-
end
|
122
|
-
|
123
|
-
it "does not set boolean_params" do
|
124
|
-
options = {:arg1 => true, :arg2 => 2}
|
125
|
-
args = MooMoo::Args.new(options) { |c|
|
126
|
-
c.optionals :arg1, :arg2
|
127
|
-
}
|
128
|
-
|
129
|
-
args.boolean_params.should be_empty
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
context "one_of" do
|
134
|
-
it "allows one arg" do
|
135
|
-
options = {:arg1 => true}
|
136
|
-
args = lambda {
|
137
|
-
MooMoo::Args.new(options) do |c|
|
138
|
-
c.one_of :arg1
|
139
|
-
end
|
140
|
-
}
|
141
|
-
|
142
|
-
expect { args.call }.to raise_error(MooMooArgumentError, /One of requires two or more items/)
|
143
|
-
end
|
144
|
-
|
145
|
-
it "allows two or more args" do
|
146
|
-
options = {:arg1 => true}
|
147
|
-
|
148
|
-
args = MooMoo::Args.new(options) do |c|
|
149
|
-
c.one_of :arg1, :arg2
|
150
|
-
end
|
151
|
-
|
152
|
-
args.one_of_params.should have(2).values
|
153
|
-
args.one_of_params.should include(:arg1, :arg2)
|
154
|
-
end
|
155
|
-
|
156
|
-
it "does not allow 0 params" do
|
157
|
-
options = {}
|
158
|
-
args = lambda {
|
159
|
-
MooMoo::Args.new(options) do |c|
|
160
|
-
c.one_of :arg1, :arg2
|
161
|
-
end
|
162
|
-
}
|
163
|
-
|
164
|
-
expect { args.call }.to raise_error(MooMooArgumentError, /The parameters may include only one of 'arg1, arg2'/)
|
165
|
-
end
|
166
|
-
|
167
|
-
it "does not allow both args" do
|
168
|
-
options = {:arg1 => true, :arg2 => 2}
|
169
|
-
args = lambda {
|
170
|
-
MooMoo::Args.new(options) do |c|
|
171
|
-
c.one_of :arg1, :arg2
|
172
|
-
end
|
173
|
-
}
|
174
|
-
|
175
|
-
expect { args.call }.to raise_error(MooMooArgumentError, /The parameters may include only one of 'arg1, arg2'/)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
data/spec/opensrs/cookie_spec.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'moo_moo/opensrs'
|
3
|
-
|
4
|
-
module MooMoo
|
5
|
-
|
6
|
-
describe OpenSRS do
|
7
|
-
before(:each) do
|
8
|
-
def random_domain
|
9
|
-
"domainthatsnottaken#{Time.now.to_i}.com"
|
10
|
-
end
|
11
|
-
|
12
|
-
@opensrs = OpenSRS::Base.new
|
13
|
-
@registered_domain = "domainthatsnottaken1302209138.com"
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "CookieCommands" do
|
17
|
-
describe "#set_cookie" do
|
18
|
-
it "sets the cookie" do
|
19
|
-
VCR.use_cassette("cookie/set_cookie") do
|
20
|
-
res = @opensrs.set_cookie(:username => MooMoo.config.user,
|
21
|
-
:password => MooMoo.config.pass,
|
22
|
-
:domain => @registered_domain)
|
23
|
-
res.success?.should be_true
|
24
|
-
res.result['cookie'].should == "0000000000000000:000000:00000"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it "fails to set the cookie" do
|
29
|
-
VCR.use_cassette("cookie/set_cookie_fail") do
|
30
|
-
res = @opensrs.set_cookie(:username => MooMoo.config.user,
|
31
|
-
:password => 'password',
|
32
|
-
:domain => 'example.com')
|
33
|
-
res.success?.should be_false
|
34
|
-
res.error_code.should == 415
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#delete_cookie" do
|
40
|
-
use_vcr_cassette "cookie/delete_cookie"
|
41
|
-
|
42
|
-
it "destroys the cookie" do
|
43
|
-
res = @opensrs.set_cookie(:username => MooMoo.config.user,
|
44
|
-
:password => MooMoo.config.pass,
|
45
|
-
:domain => @registered_domain)
|
46
|
-
res = @opensrs.delete_cookie(res.result['cookie'])
|
47
|
-
res.success?.should be_true
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "#update_cookie" do
|
52
|
-
use_vcr_cassette "cookie/update_cookie"
|
53
|
-
|
54
|
-
it "updates the cookie's domain" do
|
55
|
-
res = @opensrs.set_cookie(:username => MooMoo.config.user,
|
56
|
-
:password => MooMoo.config.pass,
|
57
|
-
:domain => @registered_domain)
|
58
|
-
res = @opensrs.update_cookie(
|
59
|
-
:old_domain => @registered_domain,
|
60
|
-
:new_domain => @registered_domain,
|
61
|
-
:cookie => res.result['cookie'])
|
62
|
-
res.success?.should be_true
|
63
|
-
res.result['domain_count'].to_i.should == 1
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe "#quit_session" do
|
68
|
-
use_vcr_cassette "cookie/quit_session"
|
69
|
-
|
70
|
-
it "quits the session" do
|
71
|
-
res = @opensrs.quit_session
|
72
|
-
res.success?.should be_true
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|