seojs 0.0.7 → 0.0.8

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: db1d2bc5a6f425688e975276a74290e9b7555532
4
- data.tar.gz: e556f95c06025db18757aef6e912456b3180d65b
3
+ metadata.gz: 1ad9b187fe3b62bee1d5100414497a191a87208b
4
+ data.tar.gz: 85ee43ec276a28e5f45565ac327de2aff1003c27
5
5
  SHA512:
6
- metadata.gz: 8a2c254ec97c5404b66657212a533809a766c3d0b51590becb2cc69b624f5157b2f2099b173371893606f4036ba165bb27be25413161e648efb167c4f8590c1e
7
- data.tar.gz: b442cb4eef3ae8ed973b8292e75801a38a2f0a40b2a1569757bb20560a015ff6590160d21a284fd97483ba9a2c0a7a46bd8ea0daf19b543dd56a3a51c7e1e830
6
+ metadata.gz: cd35276ad55de901d5c39bbdc8e5f282bc3f835edde09b9e995da82f3d6d6679cccb67014065a490123ce154f2b9eca2ac4d8558929f74d1a2df2c063dcf47f0
7
+ data.tar.gz: 7cd786888c498b7f1abd96e6288177aa95cab8b2872d55292cf96841748490363166b691edd569cc65a68568506aad5a5a88539d2ac85e4da2cf160b1aa174d5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -37,7 +37,12 @@ module Seojs
37
37
  if [200, 301, 302, 304].include? snapshot_response.code.to_i
38
38
  body = snapshot_response.body || ""
39
39
  body = [body] unless body.respond_to?(:each)
40
- [snapshot_response.code, snapshot_response.to_hash, body]
40
+ headers = snapshot_response.to_hash
41
+ headers.each_key do |k|
42
+ v = headers[k]
43
+ headers[k] = v.join(', ') if v.kind_of? Array
44
+ end
45
+ [snapshot_response.code, headers, body]
41
46
  else
42
47
  nil
43
48
  end
data/seojs.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "seojs"
8
- s.version = "0.0.7"
8
+ s.version = "0.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["getseojs.com"]
@@ -40,12 +40,21 @@ class TestMiddleware < Test::Unit::TestCase
40
40
  assert last_response.ok?
41
41
  end
42
42
 
43
+ def build_response(body, code, headers)
44
+ r = Net::HTTPResponse.new(1.0, code, "body")
45
+ headers.each_pair do |k,v|
46
+ r.add_field(k,v)
47
+ end
48
+ r.stubs(:body => body)
49
+ r
50
+ end
51
+
43
52
  def test_forward_with_token
44
53
  Seojs.token = 'token'
45
54
  Net::HTTP::Get.expects(:new)
46
55
  .with(equals("http://cdn.getseojs.com/snapshots/token/v3/http://example.org:80/hi?_escaped_fragment_="))
47
56
  Net::HTTP.expects(:start)
48
- .returns(stub(:body => 'Snapshot!', :code => 200, :to_hash => {}))
57
+ .returns(build_response('Snapshot!', 200, {}))
49
58
  get '/hi', :_escaped_fragment_ => ''
50
59
  assert last_response.ok?
51
60
  assert_equal 'Snapshot!', last_response.body
@@ -65,9 +74,9 @@ class TestMiddleware < Test::Unit::TestCase
65
74
  .with(equals("http://cdn.getseojs.com/snapshots/token/v3/http://example.org:80/hi?_escaped_fragment_="))
66
75
  .returns({})
67
76
  Net::HTTP.expects(:start)
68
- .returns(stub(:body => 'Snapshot!', :code => 200, :to_hash => {'ETAG'=>'abc'}))
77
+ .returns(build_response('Snapshot!', 200, {'ETAG'=>'abc'}))
69
78
  get '/hi', {:_escaped_fragment_ => ''}, {'HTTP_IF_NONE_MATCH' => '123'}
70
- assert_include last_response.headers, 'ETAG'
79
+ assert_equal 'abc', last_response.headers['ETAG']
71
80
  assert last_response.ok?
72
81
  assert_equal 'Snapshot!', last_response.body
73
82
  end
@@ -77,7 +86,7 @@ class TestMiddleware < Test::Unit::TestCase
77
86
  Net::HTTP::Get.expects(:new)
78
87
  .with(equals("http://cdn.getseojs.com/snapshots/token/v3/http://example.org:80/hi?_escaped_fragment_="))
79
88
  Net::HTTP.expects(:start)
80
- .returns(stub(:body => 'not found...', :code => 404, :to_hash => {}))
89
+ .returns(build_response('not found...', 404, {}))
81
90
  get '/hi', :_escaped_fragment_ => ''
82
91
  assert last_response.ok?
83
92
  assert_equal 'Hello!', last_response.body
@@ -88,7 +97,7 @@ class TestMiddleware < Test::Unit::TestCase
88
97
  Net::HTTP::Get.expects(:new)
89
98
  .with(equals("http://cdn.getseojs.com/snapshots/token/v3/http://example.org:80/hi?_escaped_fragment_="))
90
99
  Net::HTTP.expects(:start)
91
- .returns(stub(:body => 'somewhere else', :code => 302, :to_hash => {'Location' => 'http://google.com/'}))
100
+ .returns(build_response('somewhere else', 302, {'Location' => 'http://google.com/'}))
92
101
  get '/hi', :_escaped_fragment_ => ''
93
102
  assert last_response.redirect?
94
103
  follow_redirect!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seojs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - getseojs.com