root/extensions/agile_pm/spec/models/story_progress_update_spec.rb

Download in other formats: Raw | Text
Revisions
Dimitrij Denissenko
Dimitrij Denissenko
Sep 12 2009 * 10:58
(12 months ago)

Revision c6ea8aef0cef1ec0ec0dc42a0c5d2972b6fbfaf1

Merge AgilePM into the main distribution Fixed AgilePM permission for Backlog viewing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe StoryProgressUpdate do
  fixtures :stories, :story_progress_updates
  
  it 'should belong to story' do
    story_progress_updates(:active_50).should belong_to(:story)
  end
  
  it 'should validate presence of story' do    
    story_progress_updates(:active_50).should validate_association_of(:story)
  end

  it 'should validate correctness of percent-completed' do    
    story_progress_updates(:active_50).percent_completed = 25
    story_progress_updates(:active_50).should have(1).error_on(:percent_completed)

    story_progress_updates(:active_50).percent_completed = 50
    story_progress_updates(:active_50).should have(:no).error_on(:percent_completed)
  end
  
  it 'should not allow multiple records for a story for the same day' do
    s = StoryProgressUpdate.new :story_id => story_progress_updates(:active_50).story_id,
      :created_on => story_progress_updates(:active_50).created_on,
      :percent_completed => 100
    s.should have(1).error_on(:created_on)
  end
  
end