Permalink
Browse files

Failing test case RE: Ticket 3131

  • Loading branch information...
stefanpenner authored and Yehuda Katz committed Dec 25, 2009
1 parent f5714ab commit b3dd14adbe351a56fd676003b47ff2f585258d25
@@ -1,6 +1,7 @@
require "cases/helper"
require 'models/post'
require 'models/author'
+require 'models/event_author'
require 'models/topic'
require 'models/reply'
require 'models/category'
@@ -1015,6 +1016,18 @@ def test_readonly_attributes
assert_equal "changed", post.body
end
+ def test_multiparameter_attribute_assignment_via_association_proxy
+ multiparameter_date_attribute = {
+ "ends_on(1i)" => "2004", "ends_on(2i)" => "6", "ends_on(3i)" => "24",
+ "ends_on(4i)" => "16", "ends_on(5i)" => "24", "ends_on(6i)" => "00"
+ }
+
+ author = Author.create(:name => "dhh")
+ event = author.events.create(multiparameter_date_attribute)
+
+ assert_equal Time.local(2004,6,24,16,24,0),event.ends_on
+ end
+
def test_multiparameter_attributes_on_date
attributes = { "last_read(1i)" => "2004", "last_read(2i)" => "6", "last_read(3i)" => "24" }
topic = Topic.find(1)
@@ -88,6 +88,9 @@ def testing_proxy_target
has_many :tags, :through => :posts # through has_many :through
has_many :post_categories, :through => :posts, :source => :categories
+ has_many :event_authors
+ has_many :events, :through => :event_authors
+
has_one :essay, :primary_key => :name, :as => :writer
belongs_to :author_address, :dependent => :destroy
@@ -0,0 +1,5 @@
+class EventAuthor < ActiveRecord::Base
+ belongs_to :author
+ belongs_to :event
+end
+
@@ -174,6 +174,12 @@ def create_table(*args, &block)
create_table :events, :force => true do |t|
t.string :title, :limit => 5
+ t.datetime :ends_on
+ end
+
+ create_table :event_authors, :force => true do |t|
+ t.integer :event_id
+ t.integer :author_id
end
create_table :funny_jokes, :force => true do |t|

0 comments on commit b3dd14a

Please sign in to comment.