plagiarism 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/README.md +6 -0
- data/Rakefile +6 -0
- data/lib/plagiarism/request.rb +6 -4
- data/lib/plagiarism/search.rb +27 -7
- data/lib/plagiarism/text_search.rb +3 -2
- data/lib/plagiarism/url_search.rb +1 -1
- data/plagiarism.gemspec +3 -2
- data/spec/plagiarism/balance_spec.rb +2 -16
- data/spec/plagiarism/plagiarism_spec.rb +1 -1
- data/spec/plagiarism/request_spec.rb +100 -0
- data/spec/plagiarism/response_spec.rb +32 -0
- data/spec/plagiarism/text_search_spec.rb +151 -18
- data/spec/plagiarism/url_search_spec.rb +46 -26
- data/spec/vcr_cassettes/empty_get_request.yml +38 -0
- data/spec/vcr_cassettes/empty_get_request_in_test_mode.yml +38 -0
- data/spec/vcr_cassettes/empty_post_request.yml +38 -0
- data/spec/vcr_cassettes/successful_balance_request.yml +5 -5
- data/spec/vcr_cassettes/valid_csearch_with_results.yml +38 -0
- data/spec/vcr_cassettes/valid_full_comparision_text_csearch_with_results.yml +8341 -0
- data/spec/vcr_cassettes/valid_full_comparison_url_csearch_with_results.yml +8342 -0
- data/spec/vcr_cassettes/valid_latin_encoded_text_csearch_with_results.yml +7946 -0
- data/spec/vcr_cassettes/valid_text_cpsearch_with_results.yml +7946 -0
- data/spec/vcr_cassettes/valid_text_csearch_with_results.yml +7946 -0
- data/spec/vcr_cassettes/valid_text_csearch_without_results.yml +37 -0
- data/spec/vcr_cassettes/valid_text_psearch_with_results.yml +7946 -0
- data/spec/vcr_cassettes/valid_url_cpsearch_with_results.yml +7947 -0
- data/spec/vcr_cassettes/valid_url_csearch_with_results.yml +7947 -0
- data/spec/vcr_cassettes/valid_url_psearch_with_results.yml +7947 -0
- metadata +51 -7
- data/spec/vcr_cassettes/valid_text_search_with_results.yml +0 -7948
- data/spec/vcr_cassettes/valid_url_search_with_results.yml +0 -7950
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 229afb24431eaea58e146b9ca42b2215f2827462
|
4
|
+
data.tar.gz: af71e20ab04117d27ecb7cabe59b50846f3119f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cbe99e26c3f9a8a7669053eb2cc0bc842eb3fddb627d760eb0288edd51319828da54d3ba9284a50204ae51c4b6349be33980527a5f26cd8aa5d9e457f36193f
|
7
|
+
data.tar.gz: 2d636a86a296bd32deac03a2b0a494492846ffe7ad2a124b62138ff998c42986f1cff70e6cee5b405dbf750d00e1da9f183154aeb5e9e697dc76cf58395d891f
|
data/.travis.yml
ADDED
data/README.md
CHANGED
data/Rakefile
ADDED
data/lib/plagiarism/request.rb
CHANGED
@@ -6,16 +6,18 @@ module Plagiarism
|
|
6
6
|
|
7
7
|
base_uri "http://www.copyscape.com/api"
|
8
8
|
|
9
|
-
attr_accessor :response, :params
|
9
|
+
attr_accessor :response, :raw_response, :params
|
10
10
|
|
11
11
|
def initialize(method, options = {})
|
12
12
|
@params = build_params(options)
|
13
13
|
if method.eql? :get
|
14
|
-
@
|
14
|
+
@raw_response = self.class.get('/', query: @params)
|
15
|
+
@response = Response.new(@raw_response)
|
15
16
|
elsif method.eql? :post
|
16
|
-
@
|
17
|
+
@raw_response = self.class.post('/', body: @params)
|
18
|
+
@response = Response.new(@raw_response)
|
17
19
|
else
|
18
|
-
raise "Invalid HTTP request method"
|
20
|
+
raise "Invalid or missing HTTP request method"
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
data/lib/plagiarism/search.rb
CHANGED
@@ -10,6 +10,7 @@ module Plagiarism
|
|
10
10
|
@response.success? ? @response.doc.css("count").text.to_i : nil
|
11
11
|
end
|
12
12
|
|
13
|
+
|
13
14
|
# Return true if any results were found
|
14
15
|
#
|
15
16
|
def results?
|
@@ -24,6 +25,7 @@ module Plagiarism
|
|
24
25
|
|
25
26
|
|
26
27
|
# Return true if the search request was successful
|
28
|
+
#
|
27
29
|
def success?
|
28
30
|
@response && @response.success? ? true : false
|
29
31
|
end
|
@@ -36,17 +38,35 @@ module Plagiarism
|
|
36
38
|
end
|
37
39
|
|
38
40
|
|
39
|
-
# Return the
|
41
|
+
# Return the number of words matched from the source
|
40
42
|
#
|
41
|
-
def
|
42
|
-
if @response.success? &&
|
43
|
-
|
43
|
+
def words_matched
|
44
|
+
if @response.success? && words = @response.doc.css("allwordsmatched").text
|
45
|
+
words != "" ? words.to_i : nil
|
44
46
|
else
|
45
47
|
nil
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
49
51
|
|
52
|
+
# Return the percentage of words matched from the source
|
53
|
+
#
|
54
|
+
def percentage_matched
|
55
|
+
if @response.success? && percentage = @response.doc.css("allpercentmatched").text
|
56
|
+
percentage != "" ? percentage.to_i : nil
|
57
|
+
else
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
# Return the URL for viewing results
|
64
|
+
#
|
65
|
+
def results_url
|
66
|
+
@response.doc.css("allviewurl").text if results?
|
67
|
+
end
|
68
|
+
|
69
|
+
|
50
70
|
protected
|
51
71
|
|
52
72
|
|
@@ -55,7 +75,7 @@ module Plagiarism
|
|
55
75
|
o: operation_for_scope(options[:scope]),
|
56
76
|
c: options[:full_comparisons] || 0
|
57
77
|
}
|
58
|
-
params.merge(e: options[:encoding]) if self.class == TextSearch
|
78
|
+
params.merge!(e: options[:encoding]) if options[:encoding] && self.class == TextSearch
|
59
79
|
params
|
60
80
|
end
|
61
81
|
|
@@ -63,9 +83,9 @@ module Plagiarism
|
|
63
83
|
# Map search scope to an api operation
|
64
84
|
#
|
65
85
|
def operation_for_scope(scope)
|
66
|
-
if scope ==
|
86
|
+
if scope && scope.to_sym == :full
|
67
87
|
"cpsearch"
|
68
|
-
elsif scope ==
|
88
|
+
elsif scope && scope.to_sym == :private
|
69
89
|
"psearch"
|
70
90
|
else
|
71
91
|
"csearch"
|
@@ -3,7 +3,7 @@ module Plagiarism
|
|
3
3
|
|
4
4
|
def initialize(search_text, options = {})
|
5
5
|
validate_text(search_text)
|
6
|
-
params = {e: "UTF-8", t: search_text}.merge(search_params(options))
|
6
|
+
params = {e: "UTF-8", t: search_text}.merge!(search_params(options))
|
7
7
|
@request = Request.new(:post, params)
|
8
8
|
@response = @request.response
|
9
9
|
end
|
@@ -13,7 +13,8 @@ module Plagiarism
|
|
13
13
|
|
14
14
|
|
15
15
|
def validate_text(text)
|
16
|
-
raise "Invalid search text" if text.class != String || text.nil? || text == ""
|
16
|
+
raise "Invalid or missing search text." if text.class != String || text.nil? || text == ""
|
17
|
+
raise "Search text must be at least 15 words." if text.split(" ").size < 15
|
17
18
|
end
|
18
19
|
|
19
20
|
end
|
@@ -14,7 +14,7 @@ module Plagiarism
|
|
14
14
|
|
15
15
|
def validate_url(url)
|
16
16
|
uri = URI.parse URI.encode(url)
|
17
|
-
raise "Please provide a valid search URL" unless uri.scheme && uri.host && uri.path
|
17
|
+
raise "Please provide a valid search URL." unless uri.scheme && uri.host && uri.path
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
data/plagiarism.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'plagiarism'
|
3
|
-
gem.version = '0.1.
|
3
|
+
gem.version = '0.1.3'
|
4
4
|
gem.summary = "A Ruby wrapper for the Copyscape Premium API"
|
5
5
|
gem.description = "Search for plagiarism and check your content for originality with Copyscape"
|
6
6
|
gem.homepage = "https://github.com/zohlgren/plagiarism"
|
@@ -11,7 +11,8 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.add_dependency 'httparty'
|
12
12
|
gem.add_dependency 'nokogiri'
|
13
13
|
gem.add_dependency 'money'
|
14
|
-
gem.add_development_dependency '
|
14
|
+
gem.add_development_dependency 'rake'
|
15
|
+
gem.add_development_dependency 'rspec'
|
15
16
|
gem.add_development_dependency 'vcr'
|
16
17
|
gem.add_development_dependency 'excon', '>= 0.22.0'
|
17
18
|
gem.add_development_dependency 'webmock', '< 1.12.0'
|
@@ -3,22 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe Plagiarism::Balance do
|
4
4
|
|
5
5
|
before do
|
6
|
-
Plagiarism.
|
7
|
-
|
8
|
-
config.api_key = "COPYSCAPE_API_KEY"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
it "requires a Copyscape username" do
|
14
|
-
Plagiarism.username = nil
|
15
|
-
expect { Plagiarism::Balance.amount }.to raise_error
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
it "requires a Copyscape API key" do
|
20
|
-
Plagiarism.api_key = nil
|
21
|
-
expect { Plagiarism::Balance.amount }.to raise_error
|
6
|
+
Plagiarism.username = "USERNAME"
|
7
|
+
Plagiarism.api_key = "API_KEY"
|
22
8
|
end
|
23
9
|
|
24
10
|
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Plagiarism::Request do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Plagiarism.username = "USERNAME"
|
7
|
+
Plagiarism.api_key = "API_KEY"
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
it "requires a Copyscape username to be configured" do
|
12
|
+
Plagiarism.username = nil
|
13
|
+
expect {
|
14
|
+
Plagiarism::Request.new(:get)
|
15
|
+
}.to raise_error(RuntimeError, "You must provide your Copyscape username")
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
it "requires a Copyscape API key to be configured" do
|
20
|
+
Plagiarism.api_key = nil
|
21
|
+
expect {
|
22
|
+
Plagiarism::Request.new(:get)
|
23
|
+
}.to raise_error(RuntimeError, "You must provide your Copyscape API key")
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
it "cannot be created without an HTTP request method" do
|
28
|
+
expect {
|
29
|
+
Plagiarism::Request.new
|
30
|
+
}.to raise_error(ArgumentError)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
it "cannot be created with an invalid request method" do
|
35
|
+
expect {
|
36
|
+
Plagiarism::Request.new(:foobar)
|
37
|
+
}.to raise_error(RuntimeError, "Invalid or missing HTTP request method")
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
it "accepts a :get request method" do
|
42
|
+
VCR.use_cassette "empty_get_request" do
|
43
|
+
expect {
|
44
|
+
Plagiarism::Request.new(:get)
|
45
|
+
}.to_not raise_error
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
it "accepts a :post request method" do
|
51
|
+
VCR.use_cassette "empty_post_request" do
|
52
|
+
expect {
|
53
|
+
Plagiarism::Request.new(:post)
|
54
|
+
}.to_not raise_error
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
it "has a params hash after instantiation" do
|
60
|
+
VCR.use_cassette "empty_get_request" do
|
61
|
+
request = Plagiarism::Request.new(:get)
|
62
|
+
request.params.should_not be_nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
it "has a raw response object after instantiation" do
|
68
|
+
VCR.use_cassette "empty_get_request" do
|
69
|
+
request = Plagiarism::Request.new(:get)
|
70
|
+
request.raw_response.should_not be_nil
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
it "has a response object after instantiation" do
|
76
|
+
VCR.use_cassette "empty_get_request" do
|
77
|
+
request = Plagiarism::Request.new(:get)
|
78
|
+
request.response.should_not be_nil
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
it "includes the test parameter if test mode is enabled" do
|
84
|
+
VCR.use_cassette "empty_get_request_in_test_mode" do
|
85
|
+
Plagiarism.test_mode = true
|
86
|
+
request = Plagiarism::Request.new(:get)
|
87
|
+
Plagiarism.test_mode = false
|
88
|
+
request.params.keys.index(:x).should_not be_nil
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
it "excludes the test parameter if test mode is disabled" do
|
94
|
+
VCR.use_cassette "empty_get_request" do
|
95
|
+
request = Plagiarism::Request.new(:get)
|
96
|
+
request.params.keys.index(:x).should be_nil
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Plagiarism::Response do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Plagiarism.username = "USERNAME"
|
7
|
+
Plagiarism.api_key = "API_KEY"
|
8
|
+
VCR.use_cassette "empty_get_request" do
|
9
|
+
@raw_response = Plagiarism::Request.new(:get).raw_response
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it "cannot be created without a response object" do
|
14
|
+
expect {
|
15
|
+
Plagiarism::Response.new
|
16
|
+
}.to raise_error(ArgumentError)
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
it "has a response object after instantiation" do
|
21
|
+
response = Plagiarism::Response.new(@raw_response)
|
22
|
+
response.response.should_not be_nil
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
it "has a Nokogiri document object after instantiation" do
|
27
|
+
response = Plagiarism::Response.new(@raw_response)
|
28
|
+
response.doc.should_not be_nil
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
end
|
@@ -3,50 +3,183 @@ require 'spec_helper'
|
|
3
3
|
describe Plagiarism::TextSearch do
|
4
4
|
|
5
5
|
before do
|
6
|
-
Plagiarism.
|
7
|
-
|
8
|
-
config.api_key = "COPYSCAPE_API_KEY"
|
9
|
-
end
|
6
|
+
Plagiarism.username = "USERNAME"
|
7
|
+
Plagiarism.api_key = "API_KEY"
|
10
8
|
@search_text = "When in the Course of human events, it becomes necessary for one people to dissolve"
|
9
|
+
@unique_text = "Nonclosely decani unspaced guardlike unporcelainized prewire russki achaian
|
10
|
+
mecisteus nontemporariness tumuli creepfed subsimian hoopoe muddler wels contraste"
|
11
11
|
end
|
12
12
|
|
13
13
|
|
14
|
-
it "
|
15
|
-
Plagiarism.username = nil
|
14
|
+
it "cannot be created without a search query" do
|
16
15
|
expect {
|
17
|
-
Plagiarism::TextSearch.new
|
18
|
-
}.to raise_error
|
16
|
+
Plagiarism::TextSearch.new
|
17
|
+
}.to raise_error(ArgumentError)
|
19
18
|
end
|
20
19
|
|
21
20
|
|
22
|
-
it "
|
23
|
-
Plagiarism.api_key = nil
|
21
|
+
it "cannot be created with an invalid search query" do
|
24
22
|
expect {
|
25
|
-
Plagiarism::TextSearch.new(
|
26
|
-
}.to raise_error
|
23
|
+
Plagiarism::TextSearch.new(12345)
|
24
|
+
}.to raise_error(RuntimeError, "Invalid or missing search text.")
|
27
25
|
end
|
28
26
|
|
29
27
|
|
30
|
-
it "must have a
|
31
|
-
expect {
|
28
|
+
it "must have a search query of at least 15 words" do
|
29
|
+
expect {
|
30
|
+
invalid_query = "one two three four five six seven eight nine ten eleven twelve thirteen fourteen"
|
31
|
+
Plagiarism::TextSearch.new(invalid_query)
|
32
|
+
}.to raise_error(RuntimeError, "Search text must be at least 15 words.")
|
32
33
|
end
|
33
34
|
|
34
35
|
|
35
36
|
it "will execute with a valid search query" do
|
36
|
-
VCR.use_cassette "
|
37
|
+
VCR.use_cassette "valid_text_csearch_with_results" do
|
37
38
|
search = Plagiarism::TextSearch.new(@search_text)
|
38
39
|
search.success?.should be_true
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
it "uses UTF-8 encoding by default" do
|
45
|
+
VCR.use_cassette "valid_text_csearch_with_results" do
|
46
|
+
search = Plagiarism::TextSearch.new(@search_text)
|
47
|
+
search.request.params[:e].should eq("UTF-8")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
it "allows a different encoding to be specified" do
|
53
|
+
VCR.use_cassette "valid_latin_encoded_text_csearch_with_results" do
|
54
|
+
search = Plagiarism::TextSearch.new(@search_text, encoding: "ISO-8859-1")
|
55
|
+
search.request.params[:e].should eq("ISO-8859-1")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
it "doesn't use full comparisons by default" do
|
61
|
+
VCR.use_cassette "valid_text_csearch_with_results" do
|
62
|
+
search = Plagiarism::TextSearch.new(@search_text)
|
63
|
+
search.request.params[:c].should eq(0)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
it "allows a number of full comparisons to be specified" do
|
69
|
+
VCR.use_cassette "valid_full_comparision_text_csearch_with_results" do
|
70
|
+
search = Plagiarism::TextSearch.new(@search_text, full_comparisons: 3)
|
71
|
+
search.request.params[:c].should eq(3)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
it "uses public search scope (csearch) by default" do
|
77
|
+
VCR.use_cassette "valid_text_csearch_with_results" do
|
78
|
+
search = Plagiarism::TextSearch.new(@search_text)
|
79
|
+
search.request.params[:o].should eq("csearch")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
it "allows a private index search to be used" do
|
85
|
+
VCR.use_cassette "valid_text_psearch_with_results" do
|
86
|
+
search = Plagiarism::TextSearch.new(@search_text, scope: :private)
|
87
|
+
search.request.params[:o].should eq("psearch")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
it "allows both public and private index search to be used" do
|
93
|
+
VCR.use_cassette "valid_text_cpsearch_with_results" do
|
94
|
+
search = Plagiarism::TextSearch.new(@search_text, scope: :full)
|
95
|
+
search.request.params[:o].should eq("cpsearch")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
it "returns the number source words checked" do
|
101
|
+
VCR.use_cassette "valid_text_csearch_with_results" do
|
102
|
+
search = Plagiarism::TextSearch.new(@search_text)
|
103
|
+
search.words.should eq(1340)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
context "with 1 or more results found" do
|
109
|
+
|
110
|
+
it "returns the a url to review results" do
|
111
|
+
VCR.use_cassette "valid_text_csearch_with_results" do
|
112
|
+
search = Plagiarism::TextSearch.new(@search_text)
|
113
|
+
search.results_url.should eq("http://view.copyscape.com/search/0tkw0spask")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
it "returns a result count greater than zero" do
|
118
|
+
VCR.use_cassette "valid_text_csearch_with_results" do
|
46
119
|
search = Plagiarism::TextSearch.new(@search_text)
|
47
120
|
search.count.should satisfy{|count| count > 0}
|
48
121
|
end
|
49
122
|
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
context "with no results found" do
|
128
|
+
|
129
|
+
it "returns nil for results_url" do
|
130
|
+
VCR.use_cassette "valid_text_csearch_without_results" do
|
131
|
+
search = Plagiarism::TextSearch.new(@unique_text)
|
132
|
+
search.results_url.should be_nil
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
it "returns a results count of zero" do
|
137
|
+
VCR.use_cassette "valid_text_csearch_without_results" do
|
138
|
+
search = Plagiarism::TextSearch.new(@search_text)
|
139
|
+
search.count.should eq(0)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
50
143
|
end
|
51
144
|
|
145
|
+
|
146
|
+
context "with full text comparisons enabled" do
|
147
|
+
|
148
|
+
it "returns the percentage of source text matched" do
|
149
|
+
VCR.use_cassette "valid_full_comparision_text_csearch_with_results" do
|
150
|
+
search = Plagiarism::TextSearch.new(@search_text, full_comparisons: 3)
|
151
|
+
search.percentage_matched.should eq(98)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
it "returns the number of source words matched" do
|
157
|
+
VCR.use_cassette "valid_full_comparision_text_csearch_with_results" do
|
158
|
+
search = Plagiarism::TextSearch.new(@search_text, full_comparisons: 3)
|
159
|
+
search.words_matched.should eq(1324)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
context "with full text comparisons disabled" do
|
166
|
+
|
167
|
+
it "should return nil for percentage_matched" do
|
168
|
+
VCR.use_cassette "valid_csearch_with_results" do
|
169
|
+
search = Plagiarism::TextSearch.new(@search_text)
|
170
|
+
search.percentage_matched.should be_nil
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
it "should return nil for words_matched" do
|
176
|
+
VCR.use_cassette "valid_csearch_with_results" do
|
177
|
+
search = Plagiarism::TextSearch.new(@search_text)
|
178
|
+
search.words_matched.should be_nil
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
|
52
185
|
end
|