Sha256: 0775c16be648224a574d73a54aa3fdbef9355ee0e39075598507ff711d65931b

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 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
      User.stub(:find_using_perishable_token).and_return(user)
    end

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

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

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.13.5 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.13.4 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.13.3 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.13.2 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.13.1 spec/controllers/passwords_controller_spec.rb