Created
December 1, 2008 23:34
-
-
Save pdlug/30901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe DataMapper::Types::Slug do | |
before(:all) do | |
class SlugTest | |
include DataMapper::Resource | |
property :id, Serial | |
property :name, Slug | |
property :title, String | |
property :title_slug, Slug | |
end | |
SlugTest.auto_migrate! | |
end | |
it "should create the permalink" do | |
repository(:default) do | |
SlugTest.create(:name => 'New DataMapper Type') | |
end | |
SlugTest.first.name.should == "new-datamapper-type" | |
end | |
it "should create the slug from the title" do | |
repository(:default) do | |
st = SlugTest.new(:title => 'New Title') | |
st.title_slug = st.title | |
st.save | |
end | |
SlugTest.first.title_slug.should == "new-title" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment