Sha256: bdca93ed36f5c5fe0364caa509de2342e6e90e29d467fef938fe816fdf7b1635

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'test_helper'

class AccountTest < ActiveSupport::TestCase
  
  fixtures :all
  
  test "accepts nested attributes for users on create" do
    @account = Account.create({ :user_attributes => { :tw_share => false, :fb_share => false, :tb_share => true } })
    @user = @account.user
    
    assert @user.account, "should have an account"
    assert !@user.fb_share?, "should have accepted nested attributes"
    assert !@user.tw_share?, "should have accepted nested attributes"
    assert @user.tb_share?, "should have accepted nested attributes"
  end
  
  test "accepts nested attributes for users on update" do
    @account = Account.create()
    @account.create_user()

    @account.update_attributes({ :user_attributes => { :tw_share => true, :fb_share => false, :tb_share => true } })

    assert !@account.user.fb_share?, "should have accepted nested attributes"
    assert @account.user.tw_share?, "should have accepted nested attributes"
    assert @account.user.tb_share?, "should have accepted nested attributes"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
serializer-0.0.9 test/dummy/test/unit/account_test.rb