seofy 0.0.2 → 0.0.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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- seofy (0.0.1)
4
+ seofy (0.0.2)
5
5
  activerecord (~> 3.0.0)
6
6
  activesupport (~> 3.0.0)
7
7
  babosa (~> 0.3.0)
data/README.md CHANGED
@@ -32,6 +32,11 @@ Usage
32
32
 
33
33
  User.for_seofy("SLUG")
34
34
 
35
+ and we won't override `to_param` method, we create new one `seofy_param`
36
+
37
+ user = User.create(:name => "I am allen", :slug => "abc")
38
+ user.seofy_param #=> "i-am-allen-abc"
39
+
35
40
 
36
41
  Rake task
37
42
  --------
data/Rakefile CHANGED
@@ -1,2 +1,7 @@
1
1
  require 'bundler'
2
+ require 'rspec/core/rake_task'
2
3
  Bundler::GemHelper.install_tasks
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ task :default => :spec
7
+
@@ -23,7 +23,7 @@ module Seofy
23
23
  end
24
24
 
25
25
  module InstanceMethods
26
- def to_param
26
+ def seofy_param
27
27
  [seofy_source.to_s, seofy_slug].join("-").to_slug.normalize.to_s
28
28
  end
29
29
 
@@ -1,3 +1,3 @@
1
1
  module Seofy
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -6,12 +6,12 @@ describe "slug use base36", :integration => true do
6
6
  end
7
7
  it "should generate slug automaticly use base36" do
8
8
  @store.slug.length.should == 3
9
- @store.to_param.should == "a-store-#{@store.slug}"
9
+ @store.seofy_param.should == "a-store-#{@store.slug}"
10
10
  end
11
11
 
12
12
  describe "for_slug" do
13
13
  it "should find the record" do
14
- Store.for_seofy(@store.to_param).should == @store
14
+ Store.for_seofy(@store.seofy_param).should == @store
15
15
  end
16
16
  end
17
17
 
@@ -7,13 +7,13 @@ describe "slug for existing_column", :integration => true do
7
7
 
8
8
  describe "to_param" do
9
9
  it "should equal to combined slugs" do
10
- @user.to_param.should == "a-user-name-slug"
10
+ @user.seofy_param.should == "a-user-name-slug"
11
11
  end
12
12
  end
13
13
 
14
14
  describe "for_slug" do
15
15
  it "should find the record" do
16
- User.for_seofy(@user.to_param).should == @user
16
+ User.for_seofy(@user.seofy_param).should == @user
17
17
  end
18
18
  end
19
19
  end
@@ -38,7 +38,7 @@ describe Seofy::ActiveRecord do
38
38
 
39
39
  context "instance methods" do
40
40
  subject {@klass.new }
41
- it { should be_respond_to(:to_param)}
41
+ it { should be_respond_to(:seofy_param)}
42
42
  it { should be_respond_to(:seofy_slug)}
43
43
  it { should be_respond_to(:seofy_source)}
44
44
  end
@@ -60,12 +60,12 @@ describe Seofy::ActiveRecord do
60
60
  end
61
61
  end
62
62
 
63
- describe "#to_param" do
63
+ describe "#seofy_param" do
64
64
  it "should normalize source and join with slug" do
65
65
  inst = @klass.new
66
66
  inst.should_receive(:seofy_slug).and_return("abc")
67
67
  inst.should_receive(:seofy_source).and_return("a normalize name")
68
- inst.to_param.should == "a-normalize-name-abc"
68
+ inst.seofy_param.should == "a-normalize-name-abc"
69
69
  end
70
70
  end
71
71
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seofy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Allen Wei