Sha256: 058121ee43854ecca644bd2c69eeb7f151241d7b5f0f46edac80a212d55c9a89
Contents?: true
Size: 754 Bytes
Versions: 4
Compression:
Stored size: 754 Bytes
Contents
require 'test_helper' class SubscriptionTest < ActiveSupport::TestCase test "accepts nested attributes from belongs_to side of association" do @user = User.create() @subscription = @user.create_subscription() user_id = @user.id.to_s @subscription.update_attributes({ "user_attributes" => { "notifications" => "1", "id" => user_id } }) @user.reload assert @user.subscription, "should have an subscription" assert @user.notifications?, "should have accepted nested attributes setting to true" @subscription.update_attributes({ "user_attributes" => { "notifications" => "0", "id" => user_id } }) @user.reload assert !@user.notifications?, "should have accepted nested attributes setting to false" end end
Version data entries
4 entries across 4 versions & 1 rubygems