[#2279] Added the Billing Status label and fixed the specs to work with a

render_to_string.
This commit is contained in:
Eric Davis
2009-04-22 11:35:56 -07:00
parent ebd06b893b
commit b4fbbde01a
3 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<p>
<label for="timesheet[billable][]" class="select_all">
<%= l(:overhead_field_billing_status) %>
</label>
<br />
<%= select_tag('timesheet[billable][]','', {:multiple => true, :size => list_size}) %>
</p>

View File

@@ -19,4 +19,9 @@ class OverheadTimesheetHook < Redmine::Hook::ViewListener
content_tag(:td,'')
end
end
# Added a new field for filtering based on "billable?"
def plugin_timesheet_views_timesheet_form(context={})
context[:controller].send(:render_to_string, :partial => 'timesheet/overhead_form', :layout => false)
end
end

View File

@@ -1,5 +1,10 @@
require File.dirname(__FILE__) + '/../spec_helper'
# Hack to make RSpec play nicely with call_hook's default contexts
def stub_view_to_use_controller_instance
self.stub!(:controller).and_return(@controller)
end
describe OverheadTimesheetHook, "#plugin_timesheet_views_timesheet_group_header" do
it 'should add a Billable column to the table' do
OverheadTimesheetHook.instance.plugin_timesheet_views_timesheet_group_header.should eql('<th>Billable</th>')
@@ -40,3 +45,19 @@ describe OverheadTimesheetHook, "#plugin_timesheet_views_timesheet_time_entry" d
end
end
end
describe OverheadTimesheetHook, "#plugin_timesheet_views_timesheet_form", :type => :view do
include Redmine::Hook::Helper
before(:each) do
stub_view_to_use_controller_instance
end
it 'should add a "Billable" label' do
response = call_hook(:plugin_timesheet_views_timesheet_form, {})
response.should have_tag('label[class=?][for=?]', 'select_all', 'timesheet[billable][]')
end
it 'should add a multple select field called "billable"'
it 'should pre-select the values from the submission'
end