copyscape 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +28 -0
- data/README.md +47 -0
- data/Rakefile +13 -0
- data/copyscape.gemspec +31 -0
- data/lib/copyscape.rb +22 -0
- data/lib/copyscape/request_base.rb +38 -0
- data/lib/copyscape/response.rb +70 -0
- data/lib/copyscape/text_search.rb +14 -0
- data/lib/copyscape/url_search.rb +14 -0
- data/lib/copyscape/version.rb +4 -0
- data/test/error_response.xml +5 -0
- data/test/response_test.rb +103 -0
- data/test/test_helper.rb +11 -0
- data/test/text_search_test.rb +29 -0
- data/test/url_search_response_duplicate.xml +654 -0
- data/test/url_search_response_not_duplicate.xml +6 -0
- data/test/url_search_test.rb +28 -0
- metadata +138 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class UrlSearchTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "request_url" do
|
6
|
+
|
7
|
+
should "have the correct url" do
|
8
|
+
Copyscape::UrlSearch.expects(:get).once.returns(url_search_response_duplicate).with do |path, options|
|
9
|
+
params = options[:query]
|
10
|
+
assert_equal '/', path
|
11
|
+
assert_equal 'joe', params[:u]
|
12
|
+
assert_equal '123abc', params[:k]
|
13
|
+
assert_equal 'http://www.someurl.com/blah.html', params[:q]
|
14
|
+
assert_equal 'csearch', params[:o]
|
15
|
+
end
|
16
|
+
@search = Copyscape::UrlSearch.new('http://www.someurl.com/blah.html')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def url_search_response_duplicate
|
23
|
+
o = Object.new
|
24
|
+
o.stubs(:body).returns(File.read(File.expand_path('../url_search_response_duplicate.xml', __FILE__)))
|
25
|
+
o
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: copyscape
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.4
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ben VandenBos
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-07-19 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.0
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: nokogiri
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - "="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.4.1
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: httparty
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - "="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.7.7
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rake
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - "="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.8.7
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: shoulda-context
|
61
|
+
prerelease: false
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
type: :development
|
69
|
+
version_requirements: *id005
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: mocha
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
type: :development
|
80
|
+
version_requirements: *id006
|
81
|
+
description: Ruby wrapper for Copyscape API
|
82
|
+
email:
|
83
|
+
- bvandenbos@gmail.com
|
84
|
+
executables: []
|
85
|
+
|
86
|
+
extensions: []
|
87
|
+
|
88
|
+
extra_rdoc_files: []
|
89
|
+
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- copyscape.gemspec
|
97
|
+
- lib/copyscape.rb
|
98
|
+
- lib/copyscape/request_base.rb
|
99
|
+
- lib/copyscape/response.rb
|
100
|
+
- lib/copyscape/text_search.rb
|
101
|
+
- lib/copyscape/url_search.rb
|
102
|
+
- lib/copyscape/version.rb
|
103
|
+
- test/error_response.xml
|
104
|
+
- test/response_test.rb
|
105
|
+
- test/test_helper.rb
|
106
|
+
- test/text_search_test.rb
|
107
|
+
- test/url_search_response_duplicate.xml
|
108
|
+
- test/url_search_response_not_duplicate.xml
|
109
|
+
- test/url_search_test.rb
|
110
|
+
homepage: http://github.com/bvandenbos/copyscape-rb
|
111
|
+
licenses: []
|
112
|
+
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: "0"
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 1.3.6
|
130
|
+
requirements: []
|
131
|
+
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 1.8.5
|
134
|
+
signing_key:
|
135
|
+
specification_version: 3
|
136
|
+
summary: Ruby wrapper for Copyscape API
|
137
|
+
test_files: []
|
138
|
+
|