Sha256: dbcc437768074c50ef2e96ea374cfdb46815ab938c84bb5db7dbe729579fadbf

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

require "test_helper"

module ThemesForRails
  class AssetsControllerTest < ActionController::TestCase  
    tests ThemesForRails::AssetsController
    should "respond to stylesheets" do
      assert @controller.respond_to?(:stylesheets)
    end
    should "respond with the right stylesheet file when requested" do
      get 'stylesheets', { :theme => 'default', :asset => 'style', :extension => 'css'}
      assert_response :success
      assert_equal @response.content_type, 'text/css'
    end
    should "not be success when the stylesheet file is not found" do
      get 'stylesheets', { :theme => 'default', :asset => 'oldstyle', :extension => 'css'}
      assert_response :missing
    end
    # javascripts
    should "respond to javascripts" do
      assert @controller.respond_to?(:javascripts)
    end
    should "respond with the right javascript file when requested" do
      get 'javascripts', { :theme => 'default', :asset => 'app', :extension => 'js'}
      assert_response :success
      assert_equal @response.content_type, 'text/javascript'
    end
    should "not be success when the javascript file is not found" do
      get 'javascripts', { :theme => 'default', :asset => 'oldapp', :extension => 'js'}
      assert_response :missing
    end
    
    # images
    should "respond to images" do
      assert @controller.respond_to?(:images)
    end
    should "respond with the right image file when requested" do
      get 'images', { :theme => 'default', :asset => 'logo', :extension => 'png'}
      assert_response :success
      assert_equal @response.content_type, 'image/png'
    end
    should "not be success when the image file is not found" do
      get 'images', { :theme => 'default', :asset => 'i_am_not_here', :extension => 'jpg'}
      assert_response :missing
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
themes_for_rails-0.2.2 test/assets_controller_test.rb
themes_for_rails-0.2.1 test/assets_controller_test.rb