Sha256: 2e591110c7151eab07c49cfda5ddf65ed54971143af663471b7b7d113370cc7d

Contents?: true

Size: 1.28 KB

Versions: 11

Compression:

Stored size: 1.28 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 File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')

describe "admin/users/create" do
  before do
    login_and_assign(admin: true)
  end

  describe "create success" do
    before do
      assign(:user, @user = FactoryGirl.build_stubbed(:user))
      assign(:users, [@user]) # .paginate
    end

    it "should hide [Create User] form and insert user partial" do
      render
      expect(rendered).to include(@user.username)
      expect(rendered).to include(%/$('#user_#{@user.id}').effect("highlight"/)
    end

    # it "should update pagination" do
    #   rendered.should include("#paginate")
    # end
  end

  describe "create failure" do
    it "should re-render [create] template in :create_user div" do
      assign(:user, FactoryGirl.build(:user, username: nil)) # make it invalid
      assign(:users, [current_user])
      render

      expect(rendered).to include('Please specify username')
      expect(rendered).to include(%/$('#create_user').effect("shake"/)
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
fat_free_crm-0.15.2 spec/views/admin/users/create.js.haml_spec.rb
fat_free_crm-0.16.4 spec/views/admin/users/create.js.haml_spec.rb
fat_free_crm-0.15.1 spec/views/admin/users/create.js.haml_spec.rb
fat_free_crm-0.16.3 spec/views/admin/users/create.js.haml_spec.rb
fat_free_crm-0.16.2 spec/views/admin/users/create.js.haml_spec.rb
fat_free_crm-0.16.1 spec/views/admin/users/create.js.haml_spec.rb
fat_free_crm-0.16.0 spec/views/admin/users/create.js.haml_spec.rb
fat_free_crm-0.15.0 spec/views/admin/users/create.js.haml_spec.rb
fat_free_crm-0.15.0.beta.2 spec/views/admin/users/create.js.haml_spec.rb
fat_free_crm-0.15.0.beta spec/views/admin/users/create.js.haml_spec.rb
reduced_fat_crm-0.15.0.beta spec/views/admin/users/create.js.haml_spec.rb