[Rails] #create tests fail when I add FriendlyId to my model
I am doing controller testing, and I can't seem to get the create
method test to pass when friendly_id is added to the mix. If I comment
it out of the model, the tests all pass perfectly. The moment I add it
back in, the error looks like this:
1) Error:
test_create_valid(BrandsControllerTest):
FriendlyId::BlankError: FriendlyId::BlankError
app/controllers/brands_controller.rb:16:in `create'
test/functional/brands_controller_test.rb:27:in `test_create_valid'
Here's the relevant line in brand.rb:
has_friendly_id :name, :use_slug => true, :approximate_ascii => true
Here's the test (using mocha):
def test_create_valid
Brand.any_instance.stubs(:valid?).returns(true)
post :create
assert_redirected_to brand_url(assigns(:brand))
end
Here's the fixture:
one:
name: MyString
image_file_name: MyString
image_content_type: MyString
image_file_size: 1
image_updated_at: 2011-08-03 10:49:03
tease: MyText
description: MyText
All other tests pass, and if I comment out has_friendly_id, the create
tests pass as well. Does this ring any bells for anyone?
Thanks in advance,
Walter
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home