Sha256: 99e0b59475026841fb4c2f75e0d0d9faa0c26465e75d8a7e7da4f92da2c6245d

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"

describe ActionDispatch::Request do
  before :all do
    @request_without_referer = FactoryGirl.build(:request_without_referer)
    @request_with_referer = FactoryGirl.build(:request_with_referer)
  end

  it "should be requests" do
    @request_without_referer.should be
    @request_with_referer.should be
  end

  context 'all requests should respond to' do
    it 'search_term' do
      @request_without_referer.should respond_to(:search_term)
      @request_with_referer.should respond_to(:search_term)
    end
    
    it 'search_engine' do
      @request_without_referer.should respond_to(:search_engine)
      @request_with_referer.should respond_to(:search_engine)
    end
  end

  context 'request without referer' do
    it 'search_term and search_engine methods should not be' do
      @request_without_referer.search_term.should_not be
      @request_without_referer.search_engine.should_not be
    end
  end

  context 'request with referer' do
    it 'search_term and search_engine methods should be' do
      @request_with_referer.search_term.should be
      @request_with_referer.search_term.should be
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
referer-parser-rails-1.0.2 spec/cases/request_spec.rb
referer-parser-rails-1.0.1 spec/cases/request_spec.rb