Skip to content

phstc/Headshift_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here is my code for the Code Kata (gist.github.com/5977211c8c3c30b43063) proposed

I wrote the checkout class following your interface

co = Checkout.new(pricing_rules)
co.scan(item)
co.scan(item)
price = co.total

I don’t know if I didn’t understand. But I’m not totaly agree with co.scan. IMHO I think that the pricing_rules must be calculated in the method total

I wrote this code as simple as I could ;)

rake

Rake command will execute a short questionnaire and after it will execute the entire test suite ;)

I cloned the products in checkout_spec.rb

co.scan(@fruit_tea.clone)

To use different references, to don’t break my code in this part

if count % 2 == 1
  product.price = 0
end

If I use the same reference, it will change all objects price (same reference) to 0

About

Headshift_test

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages