ralf 0.1.3 → 0.1.4
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/spec/ralf_spec.rb +27 -8
- metadata +1 -1
data/spec/ralf_spec.rb
CHANGED
@@ -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(
|
83
|
+
}.should raise_error(Ralf::InvalidDate, "someday is an invalid value.")
|
84
84
|
end
|
85
85
|
|
86
|
-
|
87
|
-
ralf = Ralf.new(@default_params.merge(:date => '
|
88
|
-
ralf.
|
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
|
-
|
92
|
-
|
93
|
-
ralf.date
|
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.
|
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
|