Sha256: ab5b4deaf064ca8f0d757b81cba9375aa33e5174df8eb5bee0663f98b659eeeb

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

# encoding: utf-8


require 'test_helper'
require File.dirname(File.expand_path(__FILE__))+'/test_helper'

class LiferayHelpersTest < ActionController::TestCase # :nodoc:
  include Caterpillar::Helpers::Liferay
  
  def test_link_to_liferay
    #user = User.first
    #flunk
    assert true
  end
  
  def test_liferay_resource_url
    # Simulated value from the cookie sent
    resource_url = "http://localhost:8080/resourceUrl"

    params = {
      :controller => :c1,
      :action     => :a1
    }
    
    # expected behavior
    url = liferay_resource_url(params, resource_url)
    assert_not_nil url
    assert_equal "#{resource_url}&railsRoute=/c1/a1", url
    
    params = {
      :controller => :c1
    }
    
    # expected behavior without :action param
    url = liferay_resource_url(params, resource_url)
    assert_not_nil url
    assert_equal "#{resource_url}&railsRoute=/c1/index", url
    
    # expected behavior without :controller
    params = {}
    url = liferay_resource_url(params, resource_url)
    assert_not_nil url
    assert_equal "#{resource_url}", url
    
    # expected behavior without resource_url
    assert_raise RuntimeError do
      liferay_resource_url(params, nil)
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
caterpillar-1.4.4 test/liferay_helpers_test.rb
caterpillar-1.4.3 test/liferay_helpers_test.rb
caterpillar-1.4.2 test/liferay_helpers_test.rb
caterpillar-1.4.1 test/liferay_helpers_test.rb
caterpillar-1.4.0 test/liferay_helpers_test.rb
caterpillar-1.3.1 test/liferay_helpers_test.rb