spec/project_spec.rb in Pratt-1.6.2 vs spec/project_spec.rb in Pratt-1.6.4
- old
+ new
@@ -8,10 +8,15 @@
end
describe Project do
it_should_behave_like "being a billable item"
+ it{ Project.should respond_to(:primary) }
+ it{ Project.should respond_to(:off) }
+ it{ Project.should respond_to(:rest) }
+ it{ Project.should respond_to(:longest_project_name) }
+
context "scopes" do
it "named primary" do
Project.expects(:first).with(:conditions => { :weight => 1 }).returns(mock('Refactor'))
Project.primary.name.should == 'Refactor'
end
@@ -94,11 +99,11 @@
@project.should respond_to(:customer)
end
context "amount calculation" do
before :each do
- Payment.create :rate => '315', :billable => @project
+ Payment.create :rate => '315.0', :billable => @project
@now = Time.parse("2009-10-04 17:53:58")
Time.stubs(:now).returns(@now.beginning_of_week)
whence = Time.now-1.day
@@ -130,11 +135,11 @@
before :each do
@project = Project.new
end
it "correctly calculates with no data" do
- Whence.expects(:find).with(:all, :conditions => ["end_at IS NOT NULL"]).returns []
+ @project.expects(:time_spent).returns 0
@project.time_spent.should == 0.0
end
it "correctly calculates with time argument" do
now = Time.now.beginning_of_day
@@ -158,6 +163,7 @@
whence = mock('whence', :start_at => Time.parse('2009-10-05 23:54:32'), :end_at => Time.parse('2009-10-06 00:12:32'))
Whence.expects(:find).returns [whence]
@project.time_spent('day', Chronic.parse('yesterday')).should == 18.0/60
end
end
+
end