streamly_ffi 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- streamly_ffi (0.2.0)
4
+ streamly_ffi (0.2.2)
5
5
  curl_ffi
6
6
 
7
7
  GEM
@@ -4,7 +4,7 @@ module StreamlyFFI
4
4
  attr_accessor :connection
5
5
 
6
6
  def initialize
7
- self.connection = StreamlyFFI::PersistentRequest.new
7
+ self.connection ||= StreamlyFFI::PersistentRequest.new
8
8
  end
9
9
 
10
10
  # A helper method to make HEAD requests a dead-simple one-liner
@@ -11,5 +11,8 @@ module StreamlyFFI
11
11
  send _sym
12
12
  end
13
13
 
14
+ def escape(_string)
15
+ connection.escape(_string)
16
+ end
14
17
  end
15
- end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module StreamlyFFI
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -0,0 +1,26 @@
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
+
3
+ describe StreamlyFFI::PersistentRequest do
4
+ context 'escape method' do
5
+ before(:all) do
6
+ @connection = StreamlyFFI.connect
7
+ end
8
+
9
+ it 'should escape properly' do
10
+ @connection.escape('+').should == '%2B'
11
+ @connection.escape('This is a test').should == 'This%20is%20a%20test'
12
+ @connection.escape('<>/\\').should == '%3C%3E%2F%5C'
13
+ @connection.escape('"').should == '%22'
14
+ @connection.escape(':').should == '%3A'
15
+ end
16
+
17
+ it 'should escape brackets' do
18
+ @connection.escape('{').should == '%7B'
19
+ @connection.escape('}').should == '%7D'
20
+ end
21
+
22
+ it 'should escape exclamation marks!' do
23
+ @connection.escape('!').should == '%21'
24
+ end
25
+ end
26
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 2
9
- version: 0.2.2
8
+ - 3
9
+ version: 0.2.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Lopez
@@ -85,6 +85,7 @@ files:
85
85
  - lib/streamly_ffi/version.rb
86
86
  - spec/server.rb
87
87
  - spec/spec_helper.rb
88
+ - spec/streamly_ffi/persistent_request_spec.rb
88
89
  - spec/streamly_ffi/request_spec.rb
89
90
  - streamly_ffi.gemspec
90
91
  has_rdoc: true
@@ -122,4 +123,5 @@ summary: A streaming Curl/HTTP/REST client for Ruby, in cross-Ruby FFI.
122
123
  test_files:
123
124
  - spec/server.rb
124
125
  - spec/spec_helper.rb
126
+ - spec/streamly_ffi/persistent_request_spec.rb
125
127
  - spec/streamly_ffi/request_spec.rb