Sha256: 4dc50f1cd77361bfcbc6ee82083a0ee13fe821c5380260ae04dc79b4deb89a8c

Contents?: true

Size: 621 Bytes

Versions: 6

Compression:

Stored size: 621 Bytes

Contents

require 'spec_helper'

# class User < ActiveRecord::Base
#   has_slug [:first_name, :last_name]
# end

describe User do
  it "should set slug on create when given an array" do
    u = User.create(:first_name => "Tyler", :last_name => "Durden")
    u.slug.should == "tyler-durden"
  end
  it "should append the database id if duplicates exist" do
    first_user = User.create(:first_name => "Jordan", :last_name => "Byron")
    first_user.slug.should == "jordan-byron"

    second_user = User.create(:first_name => "Jordan", :last_name => "Byron")
    second_user.slug.should == "jordan-byron-#{second_user.id}"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slugger-0.5.0 spec/lib/user_spec.rb
slugger-0.4.1 spec/lib/user_spec.rb
slugger-0.4.0 spec/lib/user_spec.rb
slugger-0.3.2 spec/lib/user_spec.rb
slugger-0.3.1 spec/lib/user_spec.rb
slugger-0.3.0 spec/lib/user_spec.rb