Source

RubyCSharp / Dynamic / ruby_dynamic / spec / customer_spec.rb

Full commit
require './customer'

describe Customer do

    describe "Dynamic Properties" do
    
      context "Given additional dynamic data for a customer" do
      
        before(:each) do
            @additional_data = { :comments => "Some comments...",
                                 :number_of_dependents => 3 }
        end
      
        describe "When object is constructed" do
          
          let(:customer) { Customer.new(@additional_data) } 

          it "should expose the additional properties" do
              customer.should respond_to(:comments)
              customer.should respond_to(:number_of_dependents)
          end
          
          it "should expose getters" do
            customer.comments.should == "Some comments..."
            customer.number_of_dependents.should == 3
          end
          
          it "should expose setters" do
            customer.comments = "New comment"
            customer.number_of_dependents = 9
            
            customer.comments.should == "New comments"
            customer.number_of_dependents.should == 9
          end
        end
      end
   end
end