allscripts_unity_client 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,8 +4,8 @@ require "american_date"
4
4
 
5
5
  module AllscriptsUnityClient
6
6
  class Utilities
7
- DATETIME_REGEX = /^((\d{1,2}[-\/]\d{1,2}[-\/]\d{4})|(\d{4}[-\/]\d{1,2}[-\/]\d{1,2})|(\d{1,2}-[A-Za-z]{3,4}-\d{4})|([A-Za-z]{3,4} \d{1,2} \d{2,4}))(T| +)(\d{1,2}:\d{2}(:\d{2})?(\.\d+)? ?(PM|AM|pm|am)?((-|\+)\d{2}:?\d{2})?Z?)$/
8
- DATE_REGEX = /^((\d{1,2}[-\/]\d{1,2}[-\/]\d{4})|(\d{4}[-\/]\d{1,2}[-\/]\d{1,2})|(\d{1,2}-[A-Za-z]{3,4}-\d{4})|([A-Za-z]{3,4} \d{1,2} \d{2,4}))$/
7
+ DATETIME_REGEX = /^((\d{1,2}[-\/]\d{1,2}[-\/]\d{4})|(\d{4}[-\/]\d{1,2}[-\/]\d{1,2})|(\d{1,2}-[A-Za-z]{3,4}-\d{4})|([A-Za-z]{3,4} +\d{1,2} \d{2,4}))(T| +)(\d{1,2}:\d{2}(:\d{2})?(\.\d+)? ?(PM|AM|pm|am)?((-|\+)\d{2}:?\d{2})?Z?)$/
8
+ DATE_REGEX = /^((\d{1,2}[-\/]\d{1,2}[-\/]\d{4})|(\d{4}[-\/]\d{1,2}[-\/]\d{1,2})|(\d{1,2}-[A-Za-z]{3,4}-\d{4})|([A-Za-z]{3,4} +\d{1,2} \d{2,4}))$/
9
9
 
10
10
  def self.try_to_encode_as_date(possible_date)
11
11
  if possible_date.nil?
@@ -1,3 +1,3 @@
1
1
  module AllscriptsUnityClient
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
3
3
  end
@@ -18,13 +18,17 @@ describe 'Utilities' do
18
18
  let(:datetime_string_one) { 'Feb 27 2013 12:37PM' }
19
19
  let(:datetime_string_two) { 'Feb 28 2013 1:34PM' }
20
20
  let(:datetime_string_three) { '12/25/2013 12:37 PM' }
21
+ let(:datetime_string_four) { 'Nov 1 2011 11:31AM' }
21
22
  let(:datetime_one) { DateTime.parse(datetime_string_one) }
22
23
  let(:datetime_two) { DateTime.parse(datetime_string_two) }
23
24
  let(:datetime_three) { DateTime.parse(datetime_string_three) }
25
+ let(:datetime_four) { DateTime.parse(datetime_string_four) }
24
26
  let(:date_string_one) { '20-Jul-2014' }
25
27
  let(:date_string_two) { '12/25/2013' }
28
+ let(:date_string_three) { 'Nov 1 2011' }
26
29
  let(:date_one) { Date.parse(date_string_one) }
27
30
  let(:date_two) { Date.parse(date_string_two) }
31
+ let(:date_three) { Date.parse(date_string_three) }
28
32
 
29
33
  describe '.try_to_encode_as_date' do
30
34
  context 'when given nil' do
@@ -61,6 +65,12 @@ describe 'Utilities' do
61
65
  end
62
66
  end
63
67
 
68
+ context 'when given datetime_string_four' do
69
+ it 'returns the string as a DateTime' do
70
+ expect(subject.try_to_encode_as_date(datetime_string_four)).to eq(datetime_four)
71
+ end
72
+ end
73
+
64
74
  context 'when given date_string_one' do
65
75
  it 'returns the string as a Date' do
66
76
  expect(subject.try_to_encode_as_date(date_string_one)).to eq(date_one)
@@ -73,6 +83,12 @@ describe 'Utilities' do
73
83
  end
74
84
  end
75
85
 
86
+ context 'when given date_string_three' do
87
+ it 'returns the string as a Date' do
88
+ expect(subject.try_to_encode_as_date(date_string_three)).to eq(date_three)
89
+ end
90
+ end
91
+
76
92
  context 'when given a non-date string' do
77
93
  it 'returns that string' do
78
94
  expect(subject.try_to_encode_as_date(string)).to eq(string)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allscripts_unity_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-25 00:00:00.000000000 Z
13
+ date: 2013-12-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: savon