diff options
author | tony <tony> | 2009-03-22 15:07:33 +0000 |
---|---|---|
committer | tony <tony> | 2009-03-22 15:07:33 +0000 |
commit | 7159467776e94e4a5e4818cd43bf85052d0da3a8 (patch) | |
tree | 888098dda3d914846918df5b42ba23b3557aa8f1 | |
parent | 10aa2a93c978974ddf32fe2032c12dc4a28ebbf5 (diff) |
Add some new TrackThing tests
-rw-r--r-- | spec/models/track_thing_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/models/track_thing_spec.rb b/spec/models/track_thing_spec.rb index c6aad08e1..46503972f 100644 --- a/spec/models/track_thing_spec.rb +++ b/spec/models/track_thing_spec.rb @@ -3,10 +3,30 @@ require File.dirname(__FILE__) + '/../spec_helper' describe TrackThing, "when tracking changes" do fixtures :track_things, :users + before do + @track_thing = track_things(:track_fancy_dog_search) + end + + it "requires a type" do + @track_thing.track_type = nil + @track_thing.should have(2).errors_on(:track_type) + end + + it "requires a valid type" do + @track_thing.track_type = 'gibberish' + @track_thing.should have(1).errors_on(:track_type) + end + + it "requires a valid medium" do + @track_thing.track_medium = 'pigeon' + @track_thing.should have(1).errors_on(:track_medium) + end + it "will find existing tracks which are the same" do track_thing = TrackThing.create_track_for_search_query('fancy dog') found_track = TrackThing.find_by_existing_track(users(:silly_name_user), track_thing) - found_track.should == track_things(:track_fancy_dog_search) + found_track.should == @track_thing end end + |