Sha256: 98406f9fc3fb7c18c993a296885c58cbf25a9dd0296f0b641dce9df183991990

Contents?: true

Size: 1.5 KB

Versions: 15

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
      expect(user_options_for_select([user1, user2], myself)).to include(["Myself", 54])
    end

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

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

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

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

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/helpers/users_helper_spec.rb
fat_free_crm-0.15.2 spec/helpers/users_helper_spec.rb
fat_free_crm-0.16.4 spec/helpers/users_helper_spec.rb
fat_free_crm-0.14.1 spec/helpers/users_helper_spec.rb
fat_free_crm-0.15.1 spec/helpers/users_helper_spec.rb
fat_free_crm-0.16.3 spec/helpers/users_helper_spec.rb
fat_free_crm-0.16.2 spec/helpers/users_helper_spec.rb
fat_free_crm-0.16.1 spec/helpers/users_helper_spec.rb
fat_free_crm-0.16.0 spec/helpers/users_helper_spec.rb
fat_free_crm-0.15.0 spec/helpers/users_helper_spec.rb
fat_free_crm-0.15.0.beta.2 spec/helpers/users_helper_spec.rb
fat_free_crm-0.15.0.beta spec/helpers/users_helper_spec.rb
fat_free_crm-0.14.0 spec/helpers/users_helper_spec.rb
reduced_fat_crm-0.15.0.beta spec/helpers/users_helper_spec.rb
reduced_fat_crm-0.14.0 spec/helpers/users_helper_spec.rb