Permalink
Browse files

Updates

  • Loading branch information...
1 parent f3f8cbe commit d3a076dfa4a6afddea002cb6e20529a824b9dde1 @r00k committed Jun 28, 2012
Showing with 7 additions and 8 deletions.
  1. 0 Rakefile
  2. +1 −1 lib/data_clump.rb
  3. +4 −5 notes.txt
  4. +2 −2 spec/data_clump_spec.rb
View
No changes.
View
@@ -8,7 +8,7 @@ def initialize(orders, start_date, end_date)
@end_date = end_date
end
- def total_sales_within_range
+ def total_sales_within_date_range
orders_in_range =
@orders.select { |order| order.placed_at >= @start_date &&
order.placed_at <= @end_date }
View
@@ -28,17 +28,16 @@ refactor it
try to stick to pure ruby; create rails app in separate dir if desired
-Intro
+Intro - 2 mins
* me
* intermediate to advanced
* ask questions
* I have bribes
data_clump.rb
- * replace select with query on order
- * this causes feature envy
- * move method to order
- * start_date, end_date are a data clump, passed in three places
+ * show the spec first
+ * move select to Order#placed_between?(start_date, end_date)
+ * identify data clump, passed in three places
* extract to DateRange
* immediate win: coupling is reduced
* the degree to which components rely on each other
View
@@ -1,7 +1,7 @@
require_relative '../lib/data_clump'
describe OrdersReport do
- describe '#total_sales_within_range' do
+ describe '#total_sales_within_date_range' do
it 'returns total sales in range' do
order_within_range = Order.new(amount: 5,
placed_at: Date.new(2012, 1, 28))
@@ -11,7 +11,7 @@
OrdersReport.
new(orders, Date.new(2012, 1, 15), Date.new(2012, 1, 30)).
- total_sales_within_range.should == 5
+ total_sales_within_date_range.should == 5
end
end
end

0 comments on commit d3a076d

Please sign in to comment.