Created
March 22, 2010 18:46
-
-
Save norman/340373 to your computer and use it in GitHub Desktop.
This file contains 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
require "mocha" | |
Factory.define :post do |p| | |
p.title "first post" | |
p.after_build do |post| | |
slug = Slug.new(:name => "first-post", :sequence => 1, :sluggable => post) | |
post.stubs(:slug).returns(slug) | |
end | |
end | |
class PostTest < ActiveSupport::TestCase | |
# Replace this with your real tests. | |
test "should have a slug" do | |
post = Factory.build(:post) | |
assert post.slug | |
assert_equal post, post.slug.sluggable | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment