Sha256: 66c7fe5c6011ab081950734727f3173ac0a882d746d99dfe8f2005e8da3f4f80

Contents?: true

Size: 1.21 KB

Versions: 37

Compression:

Stored size: 1.21 KB

Contents

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

module RedmineCrm
  class NewsDropTest < ActiveSupport::TestCase
    def setup
      @news = News.first
      @user = User.first
      @liquid_render = LiquidRender.new('user' => Liquid::UserDrop.new(@user),
                                        'news' => Liquid::NewsDrop.new(@news),
                                        'newss' => Liquid::NewssDrop.new(News.all))
    end

    def test_newss_all
      newss_text = @liquid_render.render('{% for news in newss.all %} {{news.title }} {% endfor %}')
      News.all.map(&:title).each do |title|
        assert_match title, newss_text
      end
    end

    def test_newss_last
      assert_equal News.last.title, @liquid_render.render('{{ newss.last.title }}')
    end

    def test_newss_size
      assert_equal '2', @liquid_render.render('{{ newss.size }}')
    end

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

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

Version data entries

37 entries across 37 versions & 1 rubygems

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