test/base_test.rb in active_presenter-0.0.1 vs test/base_test.rb in active_presenter-0.0.2
- old
+ new
@@ -15,10 +15,14 @@
expect User.any_instance.to.receive(:login=).with('james') do
SignupPresenter.new(:user_login => 'james')
end
+ # admin= should be protected from mass assignment
+ expect SignupPresenter.new.to.be.attribute_protected?(:user_admin)
+ expect SignupPresenter.new(:user_admin => true).user.not.to.be.admin?
+
expect 'mymockvalue' do
User.any_instance.stubs(:login).returns('mymockvalue')
SignupPresenter.new.user_login
end
@@ -99,9 +103,10 @@
end
expect SignupPresenter.new(:user => User.new(hash_for_user)).to.be.save!
expect SignupPresenter.new.to.be.respond_to?(:user_login)
+ expect SignupPresenter.new.to.be.respond_to?(:user_password_confirmation)
expect SignupPresenter.new.to.be.respond_to?(:valid?) # just making sure i didn't break everything :)
expect User.create!(hash_for_user).not.to.be.login_changed? do |user|
s = SignupPresenter.new(:user => user)
s.update_attributes :user_login => 'Something Totally Different'