# This will complain
class SubjectTest < ActiveSupport::TestCase
should_validate_uniqueness_of :name
end
# Error
1) Failure:
test: Subject should require case sensitive unique value for name. (SubjectTest)
[/usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/assertions.rb:55:in `assert_accepts'
/usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/active_record/macros.rb:74:in `__bind_1254386647_780301'
/usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:351:in `call'
/usr/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:351:in `test: Subject should require case sensitive unique value for name. ']:
Can't find first Subject
# Setup object first
class SubjectTest < ActiveSupport::TestCase
setup { Factory(:subject) }
should_validate_uniqueness_of :name
end
Thursday, October 1, 2009
Setup object first before testing validates_uniqueness_of in Shoulda
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2009
(143)
-
▼
October
(26)
- Update rubygems using gem
- String value not displayed in input text field in ...
- Format string for titles
- Specify form method when generating url route for ...
- Error using validation hooks with before_save call...
- Deleting a word backwards in Bash and Vim
- Swap CAPS LOCK with CONTROL key
- Reloading ALSA
- Uncompressing 7zip (.7z) files in Ubuntu
- Select commits from another branch using git cherr...
- Share simple internet web browsing via SSH X forwa...
- Fix static noise problem in Skype on Ubuntu
- Record & playback a Vim macro
- Stash changes away in Git to work on urgent matter...
- Insert Pivotal Tracker story id into Git commit me...
- Check git log for a particular branch
- View changes made by upstream in Git
- Restart Gnome session from command line
- Be careful with button_to in RESTful routes
- Rename current branch in Git
- Reload vimrc in Vim
- Insert contents from clipboard into Vim
- Yank all lines in Vim
- Git branching and merging workflow for agile team
- Resize Gnu Screen window
- Setup object first before testing validates_unique...
-
▼
October
(26)
No comments:
Post a Comment