Sha256: abc87cdf85890be73db901d7b18686ef5e2aea1b9c45e16ae638a95e90c06f42

Contents?: true

Size: 1.07 KB

Versions: 23

Compression:

Stored size: 1.07 KB

Contents

require File.dirname(__FILE__) + '/../liquid_helper'
include LiquidHelperMethods

module RedmineCrm
  class UsersDropTest < ActiveSupport::TestCase
    def setup
      @user = User.first
      @liquid_render = LiquidRender.new('user' => Liquid::UserDrop.new(@user),
                                        'users' => Liquid::UsersDrop.new(User.all))
    end

    def test_users_all
      users_text = @liquid_render.render('{% for user in users.all %} {{user.name }} {% endfor %}')
      User.all.map(&:name).each do |name|
        assert_match name, users_text
      end
    end

    def test_users_current
      assert_equal User.first.name, @liquid_render.render('{{ users.current.name }}')
    end

    def test_users_size
      assert_equal '3', @liquid_render.render('{{ users.size }}')
    end

    def test_user_name
      assert_equal @user.name, @liquid_render.render('{{ user.name }}')
    end

    def test_user_delegated
      assert_equal [@user.name, @user.language].join('|'),
                   @liquid_render.render('{{ user.name }}|{{ user.language }}')
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
redmine_crm-0.0.63 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.62 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.61 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.60 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.59 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.58 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.57 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.56 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.55 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.54 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.53 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.52 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.51 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.50 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.49 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.48 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.47 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.46 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.45 test/liquid/drops/uses_drop_test.rb
redmine_crm-0.0.44 test/liquid/drops/uses_drop_test.rb