Sha256: bffd4cbc6e6f1542274824fa606cbc90ff648427c90ba6657f7c77f4b53db9f8
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
require 'pathname' require 'iconv' require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper' describe DataMapper::Types::Slug do before(:all) do class SlugTest include DataMapper::Resource property :id, Serial property :name, 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 find by a slug" do repository(:default) do SlugTest.create(:name => "This Should Be a Slug") end slug = "this-should-be-a-slug" slugged = SlugTest.first(:name => slug) slugged.should_not be_nil slugged.name.should == slug end [ ["Iñtërnâtiônàlizætiøn", "internationalizaetion" ], ["Hello World", "hello-world"], ["This is Dan's Blog", "this-is-dans-blog"], ["This is My Site, and Blog", "this-is-my-site-and-blog"] ].each do |name, slug| it "should sluggify #{name}" do repository(:default) do SlugTest.create(:name => name) end SlugTest.first(:name => slug).should_not be_nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dm-types-0.9.8 | spec/integration/slug_spec.rb |
dm-types-0.9.9 | spec/integration/slug_spec.rb |
dm-types-0.9.7 | spec/integration/slug_spec.rb |