Created
March 19, 2009 17:22
-
-
Save samflores/81949 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
## task_spec.rb | |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe Task do | |
include ValidTaskAttributes | |
# o módulo ValidTaskAttributes define o método valid_task que retorna | |
#{ | |
# :name => "Task name", | |
# :description => "Task description", | |
# :alias => "task_alias", | |
# :due_date => Date.today, | |
# :priority => 1, | |
# :percentage => 9.99, | |
#} | |
describe 'validations' do | |
before :each do | |
Task.create(valid_task) | |
end | |
subject { Task.new } | |
end | |
end | |
## task.rb | |
class Task < ActiveRecord::Base | |
validates_uniqueness_of :name | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment