Sha256: bced1aa3d7fb9fa094f9ef62112924263e51155dda704cb504c01cfd580b8bc3

Contents?: true

Size: 1.95 KB

Versions: 17

Compression:

Stored size: 1.95 KB

Contents

require File.dirname(__FILE__) + '/../../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

17 entries across 17 versions & 2 rubygems

Version Path
request-log-analyzer-1.8.0 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.7.0 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.6.4 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.6.3 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.6.2 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.6.1 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.6.0 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.5.4 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.5.3 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.5.2 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.5.1 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.5.0 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.4.2 spec/unit/filter/timespan_filter_spec.rb
ngmoco-request-log-analyzer-1.4.2 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.4.1 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.4.0.1 spec/unit/filter/timespan_filter_spec.rb
request-log-analyzer-1.4.0 spec/unit/filter/timespan_filter_spec.rb