Skip to content

Instantly share code, notes, and snippets.

override def calculate(cartItem: CartItem): DiscountResult = {
val saleDao = saleDao.findSale
if (shopKeeperSale != None) {
if (isThis(cartItem.getProductData) ||
isThat(cartItem.getProductData)) {
new DiscountResult(DiscountType.SOME_TYPE_A, percentageOff)
} else {
new DiscountResult(DiscountType.SOME_TYPE_B, percentageOff)
@techwhizbang
techwhizbang / rspec2_mongoid_activerecord_rails3.rb
Created October 19, 2010 22:34
RSpec 2 with ActiveRecord and Mongoid together (temporary hack)
#put this in your spec_helper.rb if you're using Rails 3, Rspec2, Mongoid, and #ActiveRecord together until the "real" fix comes along
class RSpec::Core::Configuration
attr_accessor :fixture_path, :use_transactional_fixtures
def fixture_path=(path)
@fixture_path = path
end
def use_transactional_fixtures=(bool)
@use_transactional_fixtures = bool
module API
module ServiceCall
protected
def service_call(&block)
begin
puts "in begin block"
raise "exception occurred here"
parse_response(yield) if block_given?