Skip to content

Commit

Permalink
Adjust tests from the Kanban layout refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
edavis10 committed Jan 13, 2011
1 parent 9eb04db commit c5b58b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
3 changes: 2 additions & 1 deletion app/helpers/kanbans_helper.rb
Expand Up @@ -101,7 +101,8 @@ def column_width(column)
:selected => 1,
:staffed => 4
}
return 0.0 if column == :unstaffed && !column_configured?(:unstaffed)
return 0.0 if column == :incoming && !column_configured?(:incoming)
return 0.0 if column == :backlog && !column_configured?(:backlog)
return 0.0 if column == :selected && !column_configured?(:selected)

visible = 0
Expand Down
37 changes: 22 additions & 15 deletions test/unit/helpers/kanbans_helper_test.rb
Expand Up @@ -32,24 +32,31 @@ def enable_pane(pane)
'canceled' => {}
}})
end
context "for unstaffed" do
should "be 0 if unstaffed is disabled" do
assert_equal 0, column_width(:unstaffed)

context "for incoming" do
should "be 0 if incoming is disabled" do
assert_equal 0, column_width(:incoming)
end

should "be 19.2 if unstaffed and staffed are enabled" do
should "be 13.7 if staffed, incoming, backlog, and selected are enabled" do
enable_pane(:incoming)
enable_pane(:backlog)
enable_pane(:selected)

assert KanbanPane::IncomingPane.configured?
assert KanbanPane::BacklogPane.configured?
assert !KanbanPane::SelectedPane.configured?
assert KanbanPane::SelectedPane.configured?

assert_equal 13.71, column_width(:incoming)
end
end

assert_equal 19.2, column_width(:unstaffed)
context "for backlog" do
should "be 0 if backlog is disabled" do
assert_equal 0, column_width(:backlog)
end

should "be 16.0 if unstaffed, selected, and staffed are enabled" do
should "be 13.7 if staffed, incoming, backlog, and selected are enabled" do
enable_pane(:incoming)
enable_pane(:backlog)
enable_pane(:selected)
Expand All @@ -58,7 +65,7 @@ def enable_pane(pane)
assert KanbanPane::BacklogPane.configured?
assert KanbanPane::SelectedPane.configured?

assert_equal 16.0, column_width(:unstaffed)
assert_equal 13.71, column_width(:backlog)
end
end

Expand All @@ -77,7 +84,7 @@ def enable_pane(pane)
assert_equal 19.2, column_width(:selected)
end

should "be 16.0 if unstaffed, selected, and staffed are enabled" do
should "be 13.71 if unstaffed, selected, and staffed are enabled" do
enable_pane(:incoming)
enable_pane(:backlog)
enable_pane(:selected)
Expand All @@ -86,7 +93,7 @@ def enable_pane(pane)
assert KanbanPane::BacklogPane.configured?
assert KanbanPane::SelectedPane.configured?

assert_equal 16.0, column_width(:selected)
assert_equal 13.71, column_width(:selected)
end
end

Expand All @@ -95,14 +102,14 @@ def enable_pane(pane)
assert_equal 96, column_width(:staffed)
end

should "be 76.8 if unstaffed and staffed are enabled" do
should "be 64.0 if unstaffed and staffed are enabled" do
enable_pane(:incoming)
enable_pane(:backlog)

assert KanbanPane::IncomingPane.configured?
assert KanbanPane::BacklogPane.configured?

assert_equal 76.8, column_width(:staffed)
assert_equal 64.0, column_width(:staffed)
end

should "be 76.8 if selected and staffed are enabled" do
Expand All @@ -113,7 +120,7 @@ def enable_pane(pane)
assert_equal 76.8, column_width(:staffed)
end

should "be 64.0 if unstaffed, selected, and staffed are enabled" do
should "be 54.86 if unstaffed, selected, and staffed are enabled" do
enable_pane(:incoming)
enable_pane(:backlog)
enable_pane(:selected)
Expand All @@ -122,7 +129,7 @@ def enable_pane(pane)
assert KanbanPane::BacklogPane.configured?
assert KanbanPane::SelectedPane.configured?

assert_equal 64.0, column_width(:staffed)
assert_equal 54.86, column_width(:staffed)
end

end
Expand Down

0 comments on commit c5b58b8

Please sign in to comment.