Sha256: 63e0b7c5685525f0d05dc3328c38a2d4859d4d8564b1100bbcc3477998f2a4cb

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
require 'spec_helper'

describe PasswordsController do
  let(:user) { FactoryGirl.build(:user) }

  describe "update" do
    before(:each) do
      allow(User).to receive(:find_using_perishable_token).and_return(user)
    end

    it "should accept non-blank passwords" do
      password = "password"
      expect(user).to receive(:update_attributes).and_return(true)
      put :update, params: { id: 1, user: { password: password, password_confirmation: password } }
      expect(response).to redirect_to(profile_url)
    end

    it "should not accept blank passwords" do
      password = "    "
      expect(user).not_to receive(:update_attributes)
      put :update, params: { id: 1, user: { password: password, password_confirmation: password } }
      expect(response).to render_template('edit')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fat_free_crm-0.15.2 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.16.4 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.15.1 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.16.3 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.16.2 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.16.1 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.16.0 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.15.0 spec/controllers/passwords_controller_spec.rb