Sha256: 73ad05c5c3b6062296b72bfd68183ec5324a9faf7c20df961bd8825bbf5f12b4

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

# 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 "/users/update" do
  include UsersHelper

  before do
    login
    assign(:user, @user = current_user)
  end

  describe "no errors:" do
    it "should flip [Edit Profile] form" do
      render
      expect(rendered).to include("crm.flip_form('edit_profile')")
    end

    it "should update Welcome, user!" do
      render
      expect(rendered).to include("$('#welcome_username').html('#{@user.first_name}')")
    end

    it "should update actual user profile information" do
      render
      expect(rendered).to include("$('#profile').html")
    end
  end

  describe "validation errors :" do
    before do
      @user.errors.add(:first_name)
    end

    it "should redraw the [Edit Profile] form" do
      render
      expect(rendered).to include("$('#edit_profile').html")
      expect(rendered).to include("$('#user_email').focus();")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 spec/views/users/update.js.haml_spec.rb
fat_free_crm-0.20.0 spec/views/users/update.js.haml_spec.rb