Glad it works. Just so you know, you can get created_at and updated_at
by calling #timestamps:
require 'rubygems'
require 'acts_as_fu'
require 'spec'
describe "timestamps" do
before(:each) do
build_model(:people) { timestamps }
@person = Person.create!
end
it "adds created_at" do
@person.created_at.should_not be_nil
end
it "adds updated_at" do
@person.updated_at.should_not be_nil
end
end
Pat
On Jan 30, 3:24 pm, James Byrne <[email protected]> wrote:
> James Byrne wrote:
> > Pat Nakajima wrote:
> >> James,
>
> >> Can you show me how you're trying to use ActsAsFu?
>
> >> Pat
>
> > Not easily, because I removed the code. When I get a moment I will
> > reset it and post here. It will be later today.
>
> Here is what I have. FYI once I removed the custom logger from
> spec_helper.rb everything worked just fine thereafter.
>
> # hll_audit_stamps_spec.rb
> require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
>
> describe "Builds a Model with custom magic columns" do
> before(:all) do
> build_model :magiks do
> string :description
> # these are Rails' own magic columns
> datetime :created_at
> datetime :created_on
> datetime :updated_at
> datetime :updated_on
> # these are our custom magic columns
> ActiveRecord::Base::HLL_AUDIT_COLUMNS.each do |magic_column|
> string magic_column if /.*_by\z/.match(magic_column)
> datetime magic_column if /.*_(at|on)\z/.match(magic_column)
> end
> end
> @my_mage = Magik.new
> @my_mage.save!
> end
>
> # control - make sure the default behaviour is preserved
> it "should set Rails created_at" do
> @my_mage.created_at.should_not be_nil
> puts @my_mage.created_at
> end
>
> it "should set Rails created_on" do
> @my_mage.created_on.should_not be_nil
> puts @my_mage.created_on
> end
> ...
> --
> Posted viahttp://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> [email protected]http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users