dhl-get_quote 0.5.2 → 0.5.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.
@@ -164,8 +164,8 @@ class Dhl::GetQuote::Request
164
164
  # ready dates are only mon-fri
165
165
  def ready_date(t=Time.now)
166
166
  date = Date.parse(t.to_s)
167
- if date.wday >= 5 && t.hour >= 17
168
- date.send(:next_day, (8-date.wday))
167
+ if (date.cwday >= 6) || (date.wday >= 5 && t.hour >= 17)
168
+ date.send(:next_day, 8-date.cwday)
169
169
  else
170
170
  date
171
171
  end.strftime("%Y-%m-%d")
@@ -1,6 +1,6 @@
1
1
  class Dhl
2
2
  class GetQuote
3
- VERSION = "0.5.2"
3
+ VERSION = "0.5.3"
4
4
 
5
5
  PostInstallMessage = <<EOS
6
6
 
@@ -591,7 +591,6 @@ eos
591
591
  end
592
592
  end
593
593
 
594
-
595
594
  describe "#ready_date" do
596
595
  after(:each) do
597
596
  Timecop.return
@@ -605,20 +604,36 @@ eos
605
604
 
606
605
  context 'the date is friday' do
607
606
  context 'the time is before 5pm' do
608
- it 'should return todays date' do
607
+ it 'must return todays date' do
609
608
  Timecop.freeze(Time.local(2013, 5, 31, 10, 4, 0))
610
609
 
611
610
  subject.ready_date.must == '2013-05-31'
612
611
  end
613
612
  end
614
613
  context 'the time is after 5pm' do
615
- it 'should return todays date' do
614
+ it 'must return next monday' do
616
615
  Timecop.freeze(Time.local(2013, 5, 31, 19, 4, 0))
617
616
 
618
617
  subject.ready_date.must == '2013-06-03'
619
618
  end
620
619
  end
621
620
  end
621
+
622
+ context 'the date is saturday' do
623
+ it "must return the next monday" do
624
+ Timecop.freeze(Time.local(2013, 7, 6, 10, 4, 0))
625
+
626
+ subject.ready_date.must == '2013-07-08'
627
+ end
628
+ end
629
+
630
+ context 'the date is sunday' do
631
+ it "must return the next monday" do
632
+ Timecop.freeze(Time.local(2013, 7, 7, 10, 4, 0))
633
+
634
+ subject.ready_date.must == '2013-07-08'
635
+ end
636
+ end
622
637
  end
623
638
 
624
639
  describe "#payment_account_number" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhl-get_quote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
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-06-18 00:00:00.000000000 Z
13
+ date: 2013-07-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty