Sha256: 220384cf07fab17b11ab9edbdb45bbb3d678c6837d2fb0918ef6e3e4579374bd

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 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, 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, id: 1, user: { password: password, password_confirmation: password }
      expect(response).to render_template('edit')
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.14.1 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.15.0.beta.2 spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.15.0.beta spec/controllers/passwords_controller_spec.rb
fat_free_crm-0.14.0 spec/controllers/passwords_controller_spec.rb
reduced_fat_crm-0.15.0.beta spec/controllers/passwords_controller_spec.rb
reduced_fat_crm-0.14.0 spec/controllers/passwords_controller_spec.rb