Sha256: 7e5b34193da747818ca463f0d13c2c976570deda9612433da557df1f8a2ba5e9

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

require 'test_helper'

module ApplicationTests
  class RouterTest < ActionController::TestCase
    tests MusicianController

    context "A Rails app" do
      should "pass url_helpers to the cell instance" do
        assert_equal "/", BassistCell.new(@controller).root_path
      end
      
      should "allow cells to use url_helpers" do
        BassistCell.class_eval do
          def promote; render; end
        end

        get "index"
        assert_response :success
        assert_equal "Find me at <a href=\"/musician\">vd.com</a>", @response.body
      end
      
      should "delegate #url_options to the parent_controller" do
        @controller.instance_eval do
          def default_url_options
            {:host => "cells.rails.org"}
          end
        end
        
        assert_equal "http://cells.rails.org/", BassistCell.new(@controller).root_url
      end

      should "allow cells to use *_url helpers when mixing in AC::UrlFor" do
        get "promote"
        assert_response :success
        assert_equal "Find me at <a href=\"http://test.host/\">vd.com</a>\n", @response.body
      end

      should "allow cells to use #config" do
        BassistCell.class_eval do
          def provoke; render; end
        end

        get "promotion"
        assert_response :success
        assert_equal "That's me, naked <img alt=\"Me\" src=\"/images/me.png\" />", @response.body
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cells-3.6.5 test/rails/router_test.rb
cells-3.6.4 test/rails/router_test.rb
cells-3.6.3 test/rails/router_test.rb