diff --git a/app/views/contracts/index.html.erb b/app/views/contracts/index.html.erb
index 5418338..17b5126 100644
--- a/app/views/contracts/index.html.erb
+++ b/app/views/contracts/index.html.erb
@@ -1 +1,25 @@
-Yay!
+<% if collection.empty? %>
+
<%= l(:label_no_data) %>
+<% else %>
+
+
+ | <%= l(:field_id) %> |
+ <%= l(:field_name) %> |
+ <%# TODO: Status %>
+ <%# TODO: Type %>
+ <%= l(:field_account_executive_short) %> |
+ <%# TODO: Total Budget %>
+ <%= l(:field_end_date) %> |
+
+
+ <% collection.each do |contract| %>
+ <% content_tag_for(:tr, contract) do %>
+ <%= h contract.id %> |
+ <%= h contract.name %> |
+ <%= h contract.account_executive.name %> |
+ <%= h format_date(contract.end_date) %> |
+ <% end %>
+ <% end %>
+
+
+<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8c9c313..fe309b9 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2,4 +2,8 @@ en:
field_end_date: End Date
field_executed: Executed
text_contracts: Contracts
+ field_id: ID
+ field_account_executive: Account Executive
+ field_account_executive_short: "Acct. Mgr."
+ field_end_date: "End Date"
diff --git a/test/integration/contracts_list_test.rb b/test/integration/contracts_list_test.rb
index abff216..9f2863e 100644
--- a/test/integration/contracts_list_test.rb
+++ b/test/integration/contracts_list_test.rb
@@ -1,17 +1,32 @@
require 'test_helper'
class ContractsListTest < ActionController::IntegrationTest
+ include Redmine::I18n
+
def setup
@project = Project.generate!
@contract = Contract.generate!(:project => @project)
+ @contract2 = Contract.generate!(:project => @project)
end
should "allow any user to list the contracts on a project" do
- visit_project(@project)
- click_link "Contracts"
-
- assert_response :success
- assert_template 'contracts/index'
+ visit_contracts_for_project(@project)
end
+ should "list all contracts for the project" do
+ visit_contracts_for_project(@project)
+
+ assert_select "table#contracts" do
+ [@contract, @contract2].each do |contract|
+ assert_select "td", :text => /#{contract.id}/
+ assert_select "td", :text => /#{contract.name}/
+ assert_select "td", :text => /#{contract.account_executive.name}/
+ assert_select "td", :text => /#{format_date(contract.end_date)}/
+ end
+ end
+
+ end
+
+ should "not list contracts from other projects"
+
end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 5d68d8e..9673290 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -31,6 +31,14 @@ module IntegrationTestHelper
assert_response :success
end
+ def visit_contracts_for_project(project)
+ visit_project(project)
+ click_link "Contracts"
+
+ assert_response :success
+ assert_template 'contracts/index'
+ end
+
def assert_forbidden
assert_response :forbidden
assert_template 'common/403'