Sha256: d41d79a872a79ed6cf4625608c7b6174cf87745f91ca6e0d4c5c27ceb3d0f1a3

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

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

module YeshuaCrm
  class IssuesDropTest < ActiveSupport::TestCase
    def setup
      @issue = Issue.first
      @user = User.first
      @liquid_render = LiquidRender.new('user' => Liquid::UserDrop.new(@user),
                                        'issue' => Liquid::IssueDrop.new(@issue),
                                        'issues' => Liquid::IssuesDrop.new(Issue.all))
    end

    def test_issues_all
      issues_text = @liquid_render.render('{% for issue in issues.all %} {{issue.subject }} {% endfor %}')
      Issue.all.map(&:subject).each do |subject|
        assert_match subject, issues_text
      end
    end

    def test_issues_size
      assert_equal '4', @liquid_render.render('{{ issues.size }}')
    end

    def test_issue_author
      assert_equal @user.name, @liquid_render.render('{{ issue.author.name }}')
    end

    def test_issue_delegated
      assert_equal [@issue.id, @issue.subject, @issue.description].join('|'),
                   @liquid_render.render('{{ issue.id }}|{{ issue.subject }}|{{ issue.description }}')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yeshua_crm-1.0.1 test/liquid/drops/issues_drop_test.rb
yeshua_crm-1.0.0 test/liquid/drops/issues_drop_test.rb