Sha256: 21d877169f09e32a654d144aecf8cc9e7bb62ee344b1584cc33986f4953448df

Contents?: true

Size: 1.92 KB

Versions: 30

Compression:

Stored size: 1.92 KB

Contents

require 'spec_helper'

describe RequestLogAnalyzer::Filter::Timespan, 'both before and after'  do

  before(:each) do
    @filter = RequestLogAnalyzer::Filter::Timespan.new(testing_format, :after => DateTime.parse('2009-01-01'), :before => DateTime.parse('2009-02-02'))
  end

  it "should reject a request before the after date" do
    @filter.filter(request(:timestamp => 20081212000000)).should be_nil
  end

  it "should reject a request after the before date" do
    @filter.filter(request(:timestamp => 20090303000000)).should be_nil
  end

  it "should accept a request between the after and before dates" do
    @filter.filter(request(:timestamp => 20090102000000)).should_not be_nil
  end
end

describe RequestLogAnalyzer::Filter::Timespan, 'only before'  do

  before(:each) do
    @filter = RequestLogAnalyzer::Filter::Timespan.new(testing_format, :before => DateTime.parse('2009-02-02'))
  end

  it "should accept a request before the after date" do
    @filter.filter(request(:timestamp => 20081212000000)).should_not be_nil
  end

  it "should reject a request after the before date" do
    @filter.filter(request(:timestamp => 20090303000000)).should be_nil
  end

  it "should accept a request between the after and before dates" do
    @filter.filter(request(:timestamp => 20090102000000)).should_not be_nil
  end
end

describe RequestLogAnalyzer::Filter::Timespan, 'only after'  do

  before(:each) do
    @filter = RequestLogAnalyzer::Filter::Timespan.new(testing_format, :after => DateTime.parse('2009-01-01'))
  end

  it "should reject a request before the after date" do
    @filter.filter(request(:timestamp => 20081212000000)).should be_nil
  end

  it "should accept a request after the before date" do
    @filter.filter(request(:timestamp => 20090303000000)).should_not be_nil
  end

  it "should accept a request between the after and before dates" do
    @filter.filter(request(:timestamp => 20090102000000)).should_not be_nil
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
request-log-analyzer-1.13.1 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.13.0 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.11 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.10 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.9 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.8 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.7 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.6 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.5 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.4 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.3 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.2 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.1 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.12.0 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.11.1 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.11.0 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.10.1 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.10.0 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.9.10 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.9.9 spec/unit/filter/timespan_filter_spec.rb