spec/association_spec.rb in schema_associations-1.0.1 vs spec/association_spec.rb in schema_associations-1.1.0

- old
+ new

@@ -319,9 +319,22 @@ reflection.options[:foreign_key].should == "subject" reflection.options[:inverse_of].should == :subject end end + it "maps table prefix" do + with_associations_config(:table_prefix_map => { "wooga_" => "Happy"} ) do + create_tables( + "wooga_posts", {}, {}, + "wooga_comments", {}, { :wooga_post_id => { :references => :wooga_posts} } + ) + class HappyPost < ActiveRecord::Base ; self.table_name = 'wooga_posts' ; end + class HappyComment < ActiveRecord::Base ; self.table_name = 'wooga_comments' ; end + Kernel.warn HappyPost.reflect_on_all_associations.inspect + HappyComment.reflect_on_association(:post).class_name.should == "HappyPost" + HappyPost.reflect_on_association(:comments).class_name.should == "HappyComment" + end + end context "with position" do before(:each) do create_tables( "posts", {}, {},