rack-pjax 1.0.0 → 1.1.0

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
- SHA1:
3
- metadata.gz: c872051862d74e38a6228125fa67c4e72a5bac3d
4
- data.tar.gz: fd5d03912374b74c80167035b4b4a52c7246d508
2
+ SHA256:
3
+ metadata.gz: 7afc6b61d7b2cc2a2351b2c8336f288823e3e90bd04310d6e2d8cb60b5c9a402
4
+ data.tar.gz: a74afe97e7d52b755efadf5bd5b717788c8f9bd585acbd044d2524e7f71d0917
5
5
  SHA512:
6
- metadata.gz: 0f543b2e1829d303f8f5a3b2878197ab3a65e8c42132861cfd5e929cce2bc367249e8e59cf609b6c7bf4bf3dd951b56ee11a011d7b18c995693f303fa8729c25
7
- data.tar.gz: 0c1713cfd121c058557b34c3448dfd9ad98d3f45b5ab589a1432ef32c78b1be1a3c92ad2a60268b3bef0844de6c25c1f5defedc70e47976538f234bd8d7b2c33
6
+ metadata.gz: 5f7fcd43cf4affe6bcb3dce1872e968ac5a145159d36646bbb99b834876b1d399dd7b1a63fdbbd1913f2c946c4f784c94f5e8f7abb29e5fce0eeb0fd137cdfdd
7
+ data.tar.gz: 0bfd6b4346e0390ddd1dee8ae6564bff8d2b4fcb156ae24f898da31d7c82807501162498ab104a74bf038347c6eda85dd96ee2ece778dabbc7c08e056bc00c0d
data/.gitignore CHANGED
@@ -4,4 +4,5 @@ Gemfile.lock
4
4
  pkg/*
5
5
  .rvmrc
6
6
  .rbenv-version
7
+ gemfiles/*.lock
7
8
 
@@ -1,11 +1,20 @@
1
1
  rvm:
2
2
  - 1.9.3
3
- - 2.1.0
4
- - 2.2.5
5
- - 2.3.1
3
+ - 2.1.10
4
+ - 2.2.7
5
+ - 2.3.4
6
+ - 2.4.1
6
7
  - jruby
7
- branches:
8
- only:
9
- - master
8
+ gemfile:
9
+ - gemfiles/rack_1.gemfile
10
+ - gemfiles/rack_2.gemfile
11
+ matrix:
12
+ exclude:
13
+ - rvm: 1.9.3
14
+ gemfile: gemfiles/rack_2.gemfile
15
+ - rvm: 2.1.10
16
+ gemfile: gemfiles/rack_2.gemfile
17
+ - rvm: jruby
18
+ gemfile: gemfiles/rack_2.gemfile
10
19
  cache: bundler
11
20
  sudo: false
@@ -0,0 +1,8 @@
1
+ appraise "rack-1" do
2
+ gem 'rack', '~> 1.0'
3
+ gem 'nokogiri', '~> 1.6.8'
4
+ end
5
+
6
+ appraise "rack-2" do
7
+ gem 'rack', '~> 2.0'
8
+ end
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
+ gem 'appraisal'
4
+
3
5
  gemspec
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "rack", "~> 1.0"
7
+ gem "nokogiri", "~> 1.6.8"
8
+
9
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "rack", "~> 2.0"
7
+
8
+ gemspec :path => "../"
@@ -16,7 +16,7 @@ module Rack
16
16
 
17
17
  new_body = ""
18
18
  body.each do |b|
19
- b.force_encoding('UTF-8') if RUBY_VERSION > '1.9.0'
19
+ b = b.dup.force_encoding('UTF-8') if RUBY_VERSION > '1.9.0'
20
20
 
21
21
  parsed_body = Nokogiri::HTML(b)
22
22
  container = parsed_body.at(container_selector(env))
@@ -34,7 +34,7 @@ module Rack
34
34
 
35
35
  body.close if body.respond_to?(:close)
36
36
 
37
- headers['Content-Length'] &&= bytesize(new_body).to_s
37
+ headers['Content-Length'] &&= new_body.bytesize.to_s
38
38
  headers['X-PJAX-URL'] ||= Rack::Request.new(env).fullpath
39
39
 
40
40
  [status, headers, [new_body]]
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Pjax
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -8,6 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Gert Goet"]
9
9
  s.email = ["gert@thinkcreate.nl"]
10
10
  s.homepage = "https://github.com/eval/rack-pjax"
11
+ s.license = "MIT"
11
12
  s.summary = %q{Serve pjax responses through rack middleware}
12
13
  s.description = %q{Serve pjax responses through rack middleware}
13
14
 
@@ -11,7 +11,7 @@ describe Rack::Pjax do
11
11
  lambda do |env|
12
12
  [
13
13
  200,
14
- {'Content-Type' => 'text/plain', 'Content-Length' => Rack::Utils.bytesize(body).to_s},
14
+ {'Content-Type' => 'text/plain', 'Content-Length' => body.bytesize.to_s},
15
15
  [body]
16
16
  ]
17
17
  end
@@ -67,9 +67,17 @@ describe Rack::Pjax do
67
67
  expect(body).to eq('<p>foo<br>bar</p>')
68
68
  end
69
69
 
70
+ it "should handle frozen body string correctly" do
71
+ self.class.app = generate_app(:body => '<html><body><div data-pjax-container><p>foo<br>bar</p></div></body></html>'.freeze)
72
+
73
+ get "/", {}, {"HTTP_X_PJAX" => "true"}
74
+
75
+ expect(body).to eq('<p>foo<br>bar</p>')
76
+ end
77
+
70
78
  it "should return the correct Content Length" do
71
79
  get "/", {}, {"HTTP_X_PJAX" => "true"}
72
- expect(headers['Content-Length']).to eq(Rack::Utils.bytesize(body).to_s)
80
+ expect(headers['Content-Length']).to eq(body.bytesize.to_s)
73
81
  end
74
82
 
75
83
  it "should return the original body when there's no pjax-container" do
@@ -104,7 +112,7 @@ BODY
104
112
 
105
113
  it "should return the correct Content Length" do
106
114
  get "/"
107
- expect(headers['Content-Length']).to eq(Rack::Utils.bytesize(body).to_s)
115
+ expect(headers['Content-Length']).to eq(body.bytesize.to_s)
108
116
  end
109
117
  end
110
118
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-pjax
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gert Goet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-25 00:00:00.000000000 Z
11
+ date: 2019-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -89,10 +89,13 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".travis.yml"
92
+ - Appraisals
92
93
  - Gemfile
93
94
  - LICENSE
94
95
  - README.md
95
96
  - Rakefile
97
+ - gemfiles/rack_1.gemfile
98
+ - gemfiles/rack_2.gemfile
96
99
  - lib/rack-pjax.rb
97
100
  - lib/rack/pjax.rb
98
101
  - lib/rack/pjax/version.rb
@@ -101,7 +104,8 @@ files:
101
104
  - spec/spec.opts
102
105
  - spec/spec_helper.rb
103
106
  homepage: https://github.com/eval/rack-pjax
104
- licenses: []
107
+ licenses:
108
+ - MIT
105
109
  metadata: {}
106
110
  post_install_message:
107
111
  rdoc_options: []
@@ -118,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
122
  - !ruby/object:Gem::Version
119
123
  version: '0'
120
124
  requirements: []
121
- rubyforge_project: rack-pjax
122
- rubygems_version: 2.2.2
125
+ rubygems_version: 3.0.3
123
126
  signing_key:
124
127
  specification_version: 4
125
128
  summary: Serve pjax responses through rack middleware