Sha256: 8a46633ff319374d2c1d741d8bd69a8d06b6c5cbf8e2274b05fff45b83ea90df
Contents?: true
Size: 1.94 KB
Versions: 1
Compression:
Stored size: 1.94 KB
Contents
require 'test_helper' module Acts::Sluggable::Test class TestActsAsSluggable < Test::Unit::TestCase include Config def methods_per_model_assert(expected, model) [:find_by_slug, :find].each do |method| assert_equal(expected, model.send(method, expected.to_param)) end end context "default parameters" do setup do @sluggable_project = SluggableProject.create(:name => 'Some name') end should "create a slug" do assert_equal('some-name', @sluggable_project.slug) end context :to_param do should "return the slug too" do assert_equal('some-name', @sluggable_project.to_param) end end context :using_finders do should "find the object" do methods_per_model_assert @sluggable_project, SluggableProject end end end context "custom parameters" do setup do @organization = Organization.create(:alternative_name => 'Some Other Name') end should "create a slug using the custom field and store it on the custom slug field" do assert_equal('some-other-name', @organization.alternative_slug) end context :to_param do should "return the slug too" do assert_equal('some-other-name', @organization.to_param) end end context :using_finders do should "find the object" do methods_per_model_assert @organization, Organization end end end context :acts_as_sluggable_options do should "respond to acts_as_sluggable_options" do assert_equal(true, SluggableProject.respond_to?(:acts_as_sluggable_options)) end should "return the options for acts_as_sluggable" do assert_equal(:name, SluggableProject.acts_as_sluggable_options[:generate_from]) assert_equal(:slug, SluggableProject.acts_as_sluggable_options[:store_as]) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acts_as_sluggable-0.0.3 | test/unit/test_as_sluggable.rb |