Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## test_helper:
- def full_create_params_nokia(options = {})
- { :nokia_user => {:login => 'mylogin',
- :activation_email => 'someemail@domain.fr',
- :activated_at => Time.new,
- :password => 'password',
- :password_confirmation => 'password',
- :remember_token_expires_at => Time.new,
- :location_zip => '90027',
- :dob => '1977-08-12',
- :mobile_phone_area => "415",
- :mobile_phone_prefix => "341",
- :mobile_phone_number => "7140",
- :carrier_id => '1'},
- :user_pref => {:newsletter => true} }.merge(options)
- end
- ## nokia_user_test:
- def test_should_validate_mobile
- assert_no_difference NokiaUser, :count do
- user = NokiaUser.new_with_associations(full_create_params_nokia(:nokia_user => {:mobile_phone_number => "abc"}))
- assert user.errors.on(:mobile_phone_number)
- end
- end
- ## nokia_user (model)
- def self.new_with_associations(params)
- user = NokiaUser.new(params[:nokia_user])
- logger.info "#{params[:nokia_user].inspect}"
- ...
- end
Add Comment
Please, Sign In to add comment