Sha256: fb6430a74d96bb2ec939809ed97d160b0f204bb5abc42f633f8e06cb0b2249bf

Contents?: true

Size: 833 Bytes

Versions: 2

Compression:

Stored size: 833 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper'

class TextSearchTest < Test::Unit::TestCase

  context "request_url" do
    
    should "have the correct url" do
      Copyscape::TextSearch.expects(:post).once.returns(url_search_response_duplicate).with do |path, options|
        params = options[:body]
        assert_equal '/', path
        assert_equal 'joe', params[:u]
        assert_equal '123abc', params[:k]
        assert_equal 'this is some text', params[:t]
        assert_equal 'csearch', params[:o]
        assert_equal 'UTF-8', params[:e]
      end
      @search = Copyscape::TextSearch.new('this is some text')
    end
  end
  
  private

  def url_search_response_duplicate
    o = Object.new
    o.stubs(:body).returns(File.read(File.expand_path('../url_search_response_duplicate.xml', __FILE__)))
    o
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
copyscape-0.0.5 test/text_search_test.rb
copyscape-0.0.4 test/text_search_test.rb