Commit bab575a0fa4dc9f27843100915976262e386dcb6
1 parent
0ab40a69
Exists in
master
and in
1 other branch
Add project watchers
Showing
4 changed files
with
31 additions
and
0 deletions
Show diff stats
app/models/project.rb
spec/factories/project_factories.rb
| 1 | 1 | Factory.sequence(:project_name) {|n| "Project ##{n}"} |
| 2 | +Factory.sequence(:email) {|n| "email#{n}@example.com"} | |
| 2 | 3 | |
| 3 | 4 | Factory.define(:project) do |p| |
| 4 | 5 | p.name { Factory.next :project_name } |
| 6 | +end | |
| 7 | + | |
| 8 | +Factory.define(:watcher) do |w| | |
| 9 | + w.project {|p| p.association :project} | |
| 10 | + w.email { Factory.next :email } | |
| 5 | 11 | end |
| 6 | 12 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +require 'spec_helper' | |
| 2 | + | |
| 3 | +describe Watcher do | |
| 4 | + | |
| 5 | + context 'validations' do | |
| 6 | + it 'requires an email address' do | |
| 7 | + watcher = Factory.build(:watcher, :email => nil) | |
| 8 | + watcher.should_not be_valid | |
| 9 | + watcher.errors[:email].should include("can't be blank") | |
| 10 | + end | |
| 11 | + end | |
| 12 | + | |
| 13 | +end | ... | ... |