Skip to content

Commit

Permalink
first attempt at specs: for record_time
Browse files Browse the repository at this point in the history
  • Loading branch information
trptcolin committed Jan 26, 2009
1 parent a0ea886 commit 3385262
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
3 changes: 3 additions & 0 deletions app/models/record_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class RecordTime

before :save, :set_speed

validates_present :duration
validates_present :speed

def set_speed
self.speed = self.text.attachment_file_size / self.duration
end
Expand Down
7 changes: 0 additions & 7 deletions spec/models/attachment_spec.rb

This file was deleted.

16 changes: 14 additions & 2 deletions spec/models/record_time_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

describe RecordTime do

it "should have specs"
def new_record(attrs = {})
# TODO: populate default hash with valid data
RecordTime.new({}.merge(attrs))
end

end
it "should have a duration" do
record_time = new_record(:duration => nil)
record_time.should_not be_valid
end

it "should have a speed" do
record_time = new_record(:speed => nil)
record_time.should_not be_valid
end
end

0 comments on commit 3385262

Please sign in to comment.