Sha256: 3435b61b32f98e4e17c4ee70812a95fec6ed8ac782428f6789910d8db61f625f

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 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 UsersHelper do

  let(:myself) { FactoryGirl.create(:user, :id => 54)}
  let(:user1) { FactoryGirl.create(:user,  :id => 60, :first_name => 'Bob', :last_name => "Hope") }
  let(:user2) { FactoryGirl.create(:user,  :id => 75, :first_name => 'Billy', :last_name => "Joel") }

  describe "user_options_for_select" do
    it "includes 'myself'" do
      user_options_for_select([user1, user2], myself).should include(["Myself", 54])
    end

    it "includes other users" do
      user_options_for_select([user1, user2], myself).should include(["Bob Hope", 60], ["Billy Joel", 75])
    end
  end

  describe "user_select" do
    it "includes blank option" do
      user_select(:lead, [user1, user2], myself).should match(/<option value="">Unassigned<\/option>/)
    end

    it "includes myself" do
      user_select(:lead, [user1, user2], myself).should match(/<option value="54">Myself<\/option>/)
    end

    it "includes other users" do
      user_select(:lead, [user1, user2], myself).should match(/<option value="60">Bob Hope<\/option>/)
      user_select(:lead, [user1, user2], myself).should match(/<option value="75">Billy Joel<\/option>/)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/helpers/users_helper_spec.rb
fat_free_crm-0.13.5 spec/helpers/users_helper_spec.rb
fat_free_crm-0.13.4 spec/helpers/users_helper_spec.rb
fat_free_crm-0.13.3 spec/helpers/users_helper_spec.rb
fat_free_crm-0.13.2 spec/helpers/users_helper_spec.rb
fat_free_crm-0.12.3 spec/helpers/users_helper_spec.rb
fat_free_crm-0.12.2 spec/helpers/users_helper_spec.rb
fat_free_crm-0.13.1 spec/helpers/users_helper_spec.rb
fat_free_crm-0.12.1 spec/helpers/users_helper_spec.rb
fat_free_crm-0.13.0 spec/helpers/users_helper_spec.rb
fat_free_crm-0.12.0 spec/helpers/users_helper_spec.rb