Sha256: 09f627614c2bee1c1b4c52a51d43f402ed61a79856be7730b719951d30da7e6a

Contents?: true

Size: 1.9 KB

Versions: 6

Compression:

Stored size: 1.9 KB

Contents

require "spec_helper"

module Refinery
  describe CustomAssetsHelper do
    describe "custom_javascripts" do
      before(:each) do
        Refinery::Core.clear_javascripts!
      end

      it "should return one custom javascript in array when one javascript is registred" do
        Refinery::Core.config.register_javascript("test")
        helper.custom_javascripts.should eq ["test"]
      end

      it "should return two custom javascripts in array when two javascripts are registred" do
        Refinery::Core.config.register_javascript("test")
        Refinery::Core.config.register_javascript("parndt")
        helper.custom_javascripts.should eq ["test", "parndt"]
      end

      it "should return empty array when no javascript is registred" do
        helper.custom_javascripts.should eq []
      end
    end

    describe "custom_stylesheets" do
      before(:each) do
        Refinery::Core.clear_stylesheets!
      end

      it "should return one custom stylesheet class in array when one stylesheet is registred" do
        Refinery::Core.config.register_stylesheet("test")
        helper.custom_stylesheets.first.path.should eq "test"
      end

      it "should return two custom stylesheet classes in array when two stylesheets are registred" do
        Refinery::Core.config.register_stylesheet("test")
        Refinery::Core.config.register_stylesheet("parndt")
        helper.custom_stylesheets.collect(&:path).should eq ["test", "parndt"]
      end

      it "should return empty array when no stylesheet is registred" do
        helper.custom_stylesheets.should eq []
      end

      it "should return stylesheet class with path and options when both are specified" do
        Refinery::Core.config.register_stylesheet("test", :media => 'screen')
        helper.custom_stylesheets.first.path.should eq("test")
        helper.custom_stylesheets.first.options.should eq({:media => 'screen'})
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-core-2.0.5 spec/helpers/refinery/custom_assets_helper_spec.rb
refinerycms-core-2.0.4 spec/helpers/refinery/custom_assets_helper_spec.rb
refinerycms-core-2.0.3 spec/helpers/refinery/custom_assets_helper_spec.rb
refinerycms-core-2.0.2 spec/helpers/refinery/custom_assets_helper_spec.rb
refinerycms-core-2.0.1 spec/helpers/refinery/custom_assets_helper_spec.rb
refinerycms-core-2.0.0 spec/helpers/refinery/custom_assets_helper_spec.rb