Sha256: 9895152dd8a418e8da6b7c457321fb7d60d3074aa5e02cc2a1b5aedd779e94af

Contents?: true

Size: 585 Bytes

Versions: 3

Compression:

Stored size: 585 Bytes

Contents

require 'spec_helper'
require 'ronin/web/middleware/filters/ip_filter'

describe Web::Middleware::Filters::IPFilter do
  subject { Web::Middleware::Filters::IPFilter }

  let(:ip)  { '192.168.1.42' }

  before(:each) do
    @request = mock('request')
    @request.should_receive(:ip).and_return(ip)
  end

  it "should match requests using an IPAddr" do
    filter = subject.new(ip)

    filter.match?(@request).should == true
  end

  it "should match requests using an IPAddr range" do
    filter = subject.new('192.168.1.1/24')

    filter.match?(@request).should == true
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ronin-web-0.3.0.rc1 spec/web/middleware/filters/ip_filter_spec.rb
ronin-web-0.3.0.pre2 spec/web/middleware/filters/ip_filter_spec.rb
ronin-web-0.3.0.pre1 spec/web/middleware/filters/ip_filter_spec.rb