Skip to content

Instantly share code, notes, and snippets.

@pdlug pdlug/gist:30901
Created Dec 1, 2008

Embed
What would you like to do?
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
You can’t perform that action at this time.