CloudSesame 1.0.0 → 1.0.1

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: eefe60548aa62b0ea8a414e06d77ad87ded85243
4
- data.tar.gz: aa5a2425289c6adea3ee4b5adbf85d54da86cd8f
3
+ metadata.gz: b88142e0dcaf87a0805d6eea261283bb05809a66
4
+ data.tar.gz: 10cc5793853cef5545c016bb1e26327fb897ee52
5
5
  SHA512:
6
- metadata.gz: 2b9bb21b499164f722bf166d6e99c322a91ff7867bd25667e907ec0148a223f2ce672248a17a509097ff9fcf1945bb05ba29c1f7493f894f42bf57e8eb92f06d
7
- data.tar.gz: 8418dae571d39b7a9ab5378e86df6a5456e069d6562d6ed2efcb64c2036a0075944884acc3ea95766d1e29b64a903551e120758080a7f9df5629c45588a635a1
6
+ metadata.gz: 377c4c1378dc71aaba47d21c9d1000cb08af0be4e64fc71d931c1e0779eb83656908eb8f9559d2649ee3b95ed65db5b113c0c59783465177f492f28a9aae36b3
7
+ data.tar.gz: 4c7e41ed5e8e85420da4fa0f7cb7259a1228e5a39d4caeb81a9236cbf01d519eea2a5c1ecc89f6b7006ff0d79889c3ffa9c11dca51199e63bf9a44cec65d4eeb
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- CloudSesame (1.0.0)
4
+ CloudSesame (1.0.1)
5
5
  aws-sdk (~> 2)
6
6
 
7
7
  GEM
@@ -99,4 +99,4 @@ DEPENDENCIES
99
99
  ruby-prof
100
100
 
101
101
  BUNDLED WITH
102
- 1.14.6
102
+ 1.15.3
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'CloudSesame'
3
- s.version = '1.0.0'
4
- s.date = '2017-03-29'
5
- s.summary = "AWS CloudSearch Query DSL"
6
- s.description = "AWS CloudSearch Query DSL"
3
+ s.version = '1.0.1'
4
+ s.date = '2017-08-17'
5
+ s.summary = 'AWS CloudSearch Query DSL'
6
+ s.description = 'AWS CloudSearch Query DSL'
7
7
  s.authors = [
8
8
  'Scott Chu',
9
9
  'Emily Fan',
@@ -3,8 +3,8 @@ module CloudSesame
3
3
  module AST
4
4
  class Literal
5
5
 
6
- SINGLE_QUATE = Regexp.new(/\'/).freeze
7
- ESCAPE_QUATE = "\\'".freeze
6
+ SINGLE_QUOTE = Regexp.new(/'/).freeze
7
+ ESCAPE_QUOTE = "\\'".freeze
8
8
 
9
9
  attr_reader :field, :value, :options
10
10
 
@@ -42,7 +42,7 @@ module CloudSesame
42
42
  end
43
43
 
44
44
  def escape(data)
45
- "'#{ data.gsub(SINGLE_QUATE) { ESCAPE_QUATE } }'"
45
+ "'#{ data.gsub(SINGLE_QUOTE) { ESCAPE_QUOTE } }'"
46
46
  end
47
47
 
48
48
  def parse_value(value)
@@ -3,8 +3,8 @@ module CloudSesame
3
3
  module AST
4
4
  class StringValue < Abstract::Value
5
5
 
6
- SINGLE_QUATE = Regexp.new(/\'/).freeze
7
- ESCAPE_QUATE = "\\'".freeze
6
+ SINGLE_QUOTE = Regexp.new(/'/).freeze
7
+ ESCAPE_QUOTE = "\\'".freeze
8
8
 
9
9
  def self.parse(value)
10
10
  new value.to_s if value
@@ -21,7 +21,7 @@ module CloudSesame
21
21
  end
22
22
 
23
23
  def escape(value)
24
- "'#{ value.gsub(SINGLE_QUATE) { ESCAPE_QUATE } }'"
24
+ "'#{ value.gsub('\\', '\\\\\\\\').gsub(SINGLE_QUOTE) { ESCAPE_QUOTE } }'"
25
25
  end
26
26
 
27
27
  end
@@ -4,12 +4,13 @@ module CloudSesame
4
4
  describe StringValue do
5
5
 
6
6
  describe '.parse' do
7
- let(:value) { "value" }
7
+ let(:value) { 'value' }
8
8
 
9
9
  it 'should instantiate a StringValue' do
10
10
  expect(StringValue).to receive(:new).with(value)
11
11
  StringValue.parse(value)
12
12
  end
13
+
13
14
  it 'should return the StringValue' do
14
15
  expect(StringValue.parse(value)).to be_kind_of(StringValue)
15
16
  end
@@ -20,16 +21,35 @@ module CloudSesame
20
21
 
21
22
  context 'when value is not present' do
22
23
  let(:value) { nil }
24
+
23
25
  it 'should return nothing' do
24
26
  expect(subject.compile).to eq nil
25
27
  end
26
28
  end
29
+
27
30
  context 'when value is present' do
28
- let(:value) { "value" }
29
- it 'should return the escaped the value' do
31
+ let(:value) { 'value' }
32
+
33
+ it 'should return the escaped value' do
30
34
  expect(subject.compile).to eq "'#{ value }'"
31
35
  end
32
36
  end
37
+
38
+ context 'when value contains a single quote character' do
39
+ let(:value) { "value'" }
40
+
41
+ it 'should return the escaped value' do
42
+ expect(subject.compile).to eq "'value\\''"
43
+ end
44
+ end
45
+
46
+ context 'when value contains a backslash character' do
47
+ let(:value) { 'value\\' }
48
+
49
+ it 'should return the escaped value' do
50
+ expect(subject.compile).to eq "'value\\\\'"
51
+ end
52
+ end
33
53
  end
34
54
 
35
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CloudSesame
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chu
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2017-03-29 00:00:00.000000000 Z
19
+ date: 2017-08-17 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: aws-sdk
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  version: '0'
275
275
  requirements: []
276
276
  rubyforge_project:
277
- rubygems_version: 2.5.1
277
+ rubygems_version: 2.6.7
278
278
  signing_key:
279
279
  specification_version: 4
280
280
  summary: AWS CloudSearch Query DSL