seofy 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ module Seofy
|
|
15
15
|
slug_exist = true
|
16
16
|
while slug_exist
|
17
17
|
random = ::Seofy::Encoders::Base36.random(self.length)
|
18
|
-
if inst.class.exists?(["#{column} = ?", random])
|
18
|
+
if inst.class.unscoped.exists?(["#{column} = ?", random])
|
19
19
|
slug_exist = true
|
20
20
|
else
|
21
21
|
inst.send("#{column}=", random)
|
data/lib/seofy/version.rb
CHANGED
@@ -7,16 +7,6 @@ describe Seofy::Adapters::Base36 do
|
|
7
7
|
it { adapter.length.should == 3 }
|
8
8
|
it { adapter.column.should == :slug }
|
9
9
|
|
10
|
-
describe "#set_seofy_slug" do
|
11
|
-
it "should generate random 3 characters" do
|
12
|
-
stub = Object.new
|
13
|
-
::Seofy::Encoders::Base36.should_receive(:random).with(3).and_return("abc")
|
14
|
-
stub.should_receive("slug=").with("abc")
|
15
|
-
stub.class.should_receive(:exists?).with(['slug = ?', "abc"]).and_return(false)
|
16
|
-
adapter.set_seofy_slug(stub)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
10
|
describe "#seofy_slug" do
|
21
11
|
it "should equal to slug column" do
|
22
12
|
stub = Object.new
|
@@ -17,14 +17,11 @@ describe Seofy::TaskRunner do
|
|
17
17
|
s1.reload.should_not == slug1
|
18
18
|
end
|
19
19
|
it "should ignore default_scope" do
|
20
|
-
puts "*" * 100
|
21
20
|
s1 = Store.create!(:title => "store 1", :deleted => 1)
|
22
21
|
slug1 = s1.slug
|
23
22
|
ENV["MODELS"] = "Store"
|
24
23
|
Seofy::TaskRunner.new.update_all
|
25
24
|
Store.unscoped.find(s1.id).slug.should_not == slug1
|
26
|
-
|
27
|
-
puts "*" * 100
|
28
25
|
end
|
29
26
|
end
|
30
27
|
|
metadata
CHANGED