ralf 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/spec/ralf_spec.rb +27 -8
  2. metadata +1 -1
@@ -80,17 +80,36 @@ describe Ralf do
80
80
  lambda {
81
81
  ralf = Ralf.new(@default_params.merge(:date => 'someday'))
82
82
  ralf.date.should be_nil
83
- }.should raise_error(ArgumentError, "invalid date")
83
+ }.should raise_error(Ralf::InvalidDate, "someday is an invalid value.")
84
84
  end
85
85
 
86
- xit "should accept a range of dates" do
87
- ralf = Ralf.new(@default_params.merge(:date => 'now'))
88
- ralf.date.should be_nil
86
+ it "should accept a range of 2 dates" do
87
+ ralf = Ralf.new(@default_params.merge(:date => nil, :range => ['2010-02-10', '2010-02-12']))
88
+ ralf.range.should eql('2010-02-10 - 2010-02-12')
89
89
  end
90
90
 
91
- xit "should accept a month and convert it to a date" do
92
- ralf = Ralf.new(@default_params.merge(:date => 'januari'))
93
- ralf.date.should be_nil
91
+ it "should accept a range starting with 1 date" do
92
+ Date.should_receive(:today).any_number_of_times.and_return(Date.strptime('2010-02-17'))
93
+ ralf = Ralf.new(@default_params.merge(:date => nil, :range => '2010-02-10'))
94
+ ralf.range.should eql('2010-02-10 - 2010-02-17')
95
+
96
+ ralf = Ralf.new(@default_params.merge(:date => nil, :range => ['2010-02-10']))
97
+ ralf.range.should eql('2010-02-10 - 2010-02-17')
98
+ end
99
+
100
+ it "should accept a range defined by words" do
101
+ Date.should_receive(:today).any_number_of_times.and_return(Date.strptime('2010-02-17'))
102
+ Chronic.should_receive(:parse).once.with('2 days ago', {:guess=>false, :context=>:past}).and_return(
103
+ Chronic::Span.new(Time.parse('Mon Feb 15 00:00:00 +0100 2010'),Time.parse('Tue Feb 16 00:00:00 +0100 2010'))
104
+ )
105
+
106
+ ralf = Ralf.new(@default_params.merge(:date => nil, :range => '2 days ago'))
107
+ ralf.range.should eql('2010-02-15 - 2010-02-17')
108
+ end
109
+
110
+ it "should accept a month and convert it to a range" do
111
+ ralf = Ralf.new(@default_params.merge(:date => nil, :range => 'january'))
112
+ ralf.range.should eql('2010-01-01 - 2010-01-31')
94
113
  end
95
114
 
96
115
  end
@@ -127,7 +146,7 @@ describe Ralf do
127
146
  File.should_receive(:exists?).once.with( '/Users/berl/S3/media.kerdienstgemist.nl/log/2010/02/10/access_log-2010-02-10-00-05-32-ZDRFGTCKUYVJCT').and_return(false)
128
147
  File.should_receive(:open).once.with( '/Users/berl/S3/media.kerdienstgemist.nl/log/2010/02/10/access_log-2010-02-10-00-05-32-ZDRFGTCKUYVJCT', "w").and_return(true)
129
148
 
130
- @ralf.save_logging_to_disk(@bucket1).should eql([@key1, @key2])
149
+ @ralf.save_logging_to_local_disk(@bucket1).should eql([@key1, @key2])
131
150
  end
132
151
 
133
152
  it "should merge all logs" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ralf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Klaas Jan Wierenga