guillotine 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d986d69f6fe67b818ddff9840da0152fb162612
4
- data.tar.gz: 88999b8313a3bd1a28e501bebc63cf40d67e839f
3
+ metadata.gz: 71f791dc9ce8bba78a3987b80c7f0547de7083cb
4
+ data.tar.gz: 1df76ed34aecaaec28587ba9c7344e3bcdc94743
5
5
  SHA512:
6
- metadata.gz: 112f961035b5e0fcbcb1ba45ad5a91e062bbc9db84cee403426ad814758fa0313834e48612a92fabd0e16c6f858b1cdc164b83fb729874fdce5d78a1ea43e6a1
7
- data.tar.gz: f46526621c883b5f307fa1547994f31cea2ce274b70159a8901db0fc5d646935ddff93e4067f3fea120a7abc027ca182019db55fbfc5ef3c3e76017b225fe782
6
+ metadata.gz: 491e0384c4c3351a5581d5c43e494f3c4d4b3cfa6672282d6c88a7b98a9aaa06b8cada82f21eaa63641c85bbd769570fdf7e8de0ba25701acfc071df8ed27515
7
+ data.tar.gz: b85366ea7bd8f2bda6f655f71162e6abb98a4bf3128fdaca9e2dfc07a989c55329c69695e6022f9c90e54cc5ca03e2758e67bb90dbf6afcfa940653e885fa761
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'guillotine'
16
- s.version = '1.4.1'
17
- s.date = '2014-12-23'
16
+ s.version = '1.4.2'
17
+ s.date = '2015-01-22'
18
18
  s.rubyforge_project = 'guillotine'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -3,7 +3,7 @@ require 'digest/md5'
3
3
  require 'addressable/uri'
4
4
 
5
5
  module Guillotine
6
- VERSION = "1.4.1"
6
+ VERSION = "1.4.2"
7
7
 
8
8
  class Error < StandardError
9
9
  end
@@ -18,7 +18,7 @@ module Guillotine
18
18
  opt[key] = value
19
19
  end
20
20
  opt
21
- when self then value
21
+ when Options then value
22
22
  else
23
23
  raise ArgumentError, "Unable to convert to Options: #{value.inspect}"
24
24
  end
@@ -123,6 +123,115 @@ module Guillotine
123
123
  assert_equal 201, status
124
124
  end
125
125
 
126
+ def test_options_from_nil
127
+ options = Service::Options.from(nil)
128
+ assert_nil options.required_host
129
+ assert_nil options.strip_query
130
+ assert_nil options.strip_anchor
131
+ assert_nil options.length
132
+ assert_nil options.charset
133
+ assert_nil options.default_url
134
+ end
135
+
136
+ def test_options_from_empty_string
137
+ options = Service::Options.from("")
138
+ assert_nil options.required_host
139
+ assert_nil options.strip_query
140
+ assert_nil options.strip_anchor
141
+ assert_nil options.length
142
+ assert_nil options.charset
143
+ assert_nil options.default_url
144
+ end
145
+
146
+ def test_options_from_string
147
+ options = Service::Options.from("ok")
148
+ assert_equal "ok", options.required_host
149
+ assert_nil options.strip_query
150
+ assert_nil options.strip_anchor
151
+ assert_nil options.length
152
+ assert_nil options.charset
153
+ assert_nil options.default_url
154
+ end
155
+
156
+ def test_options_from_hash
157
+ options = Service::Options.from(
158
+ :required_host => "ok",
159
+ :strip_query => "a",
160
+ :strip_anchor => "b",
161
+ :length => "c",
162
+ :charset => "d",
163
+ :default_url => "e"
164
+ )
165
+ assert_equal "ok", options.required_host
166
+ assert_equal "a", options.strip_query
167
+ assert_equal "b", options.strip_anchor
168
+ assert_equal "c", options.length
169
+ assert_equal "d", options.charset
170
+ assert_equal "e", options.default_url
171
+ end
172
+
173
+ def test_options_from_options
174
+ options = Service::Options.from(
175
+ :required_host => "ok",
176
+ :strip_query => "a",
177
+ :strip_anchor => "b",
178
+ :length => "c",
179
+ :charset => "d",
180
+ :default_url => "e"
181
+ )
182
+
183
+ options = Service::Options.from(options)
184
+
185
+ assert_equal "ok", options.required_host
186
+ assert_equal "a", options.strip_query
187
+ assert_equal "b", options.strip_anchor
188
+ assert_equal "c", options.length
189
+ assert_equal "d", options.charset
190
+ assert_equal "e", options.default_url
191
+ end
192
+
193
+ def test_options_from_options_sub_class
194
+ klass = Class.new(Service::Options)
195
+ options = klass.from(
196
+ :required_host => "ok",
197
+ :strip_query => "a",
198
+ :strip_anchor => "b",
199
+ :length => "c",
200
+ :charset => "d",
201
+ :default_url => "e"
202
+ )
203
+
204
+ options = Service::Options.from(options)
205
+
206
+ assert_equal "ok", options.required_host
207
+ assert_equal "a", options.strip_query
208
+ assert_equal "b", options.strip_anchor
209
+ assert_equal "c", options.length
210
+ assert_equal "d", options.charset
211
+ assert_equal "e", options.default_url
212
+ end
213
+
214
+ def test_options_to_options_sub_class
215
+ klass = Class.new(Service::Options)
216
+ options = Service::Options.from(
217
+ :required_host => "ok",
218
+ :strip_query => "a",
219
+ :strip_anchor => "b",
220
+ :length => "c",
221
+ :charset => "d",
222
+ :default_url => "e"
223
+ )
224
+
225
+ options = klass.from(options)
226
+
227
+ assert_equal "ok", options.required_host
228
+ assert_equal "a", options.strip_query
229
+ assert_equal "b", options.strip_anchor
230
+ assert_equal "c", options.length
231
+ assert_equal "d", options.charset
232
+ assert_equal "e", options.default_url
233
+ end
234
+
126
235
  def test_fixed_charset_code
127
236
  @db = MemoryAdapter.new
128
237
  length = 4
@@ -141,4 +250,3 @@ module Guillotine
141
250
  end
142
251
  end
143
252
  end
144
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guillotine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Olson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-23 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra