From ad8f7d4217e2709302e778cceae1cfcb3bfb13b3 Mon Sep 17 00:00:00 2001 From: laserlemon Date: Sat, 29 May 2010 01:51:37 +0800 Subject: [PATCH] Fixed the attributes spec dummy service class definition so that it works in Ruby 1.9.1. --- spec/attributes_spec.rb | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/spec/attributes_spec.rb b/spec/attributes_spec.rb index 88bc21f..843c13f 100644 --- a/spec/attributes_spec.rb +++ b/spec/attributes_spec.rb @@ -1,20 +1,18 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') -describe "Service Attributes" do - before(:all) do - class Service - ATTRIBUTE_TYPES = %w(array integer float decimal boolean string text datetime) - - include Shippinglogic::Attributes - - ATTRIBUTE_TYPES.each do |type| - attribute :"#{type}_without_default", type - attribute :"#{type}_with_default_value", type, :default => 1 - attribute :"#{type}_with_default_proc", type, :default => lambda{ Time.now } - end - end - end +class Service + ATTRIBUTE_TYPES = %w(array integer float decimal boolean string text datetime) + include Shippinglogic::Attributes + + ATTRIBUTE_TYPES.each do |type| + attribute :"#{type}_without_default", type + attribute :"#{type}_with_default_value", type, :default => 1 + attribute :"#{type}_with_default_proc", type, :default => lambda{|s| Time.now } + end +end + +describe "Service Attributes" do after(:all) do Object.send(:remove_const, :Service) end