Sha256: 839155bea9f578c4d3cd565750da26d7be624d578565efecdcfab5d67b808ef7

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Roadie do
  describe ".inline_css" do
    it "creates an instance of Roadie::Inliner and execute it" do
      Roadie::Inliner.should_receive(:new).with('attri', 'butes').and_return(double('inliner', :execute => 'html'))
      Roadie.inline_css('attri', 'butes').should == 'html'
    end
  end

  describe ".assets" do
    it "delegates to Rails.application.assets" do
      Rails.stub(:application => double(:assets => 'assets'))
      Roadie.assets.should == 'assets'
    end
  end

  describe ".load_css(targets)" do
    it "loads files matching the target names in Rails assets" do
      Roadie.load_css(['foo']).should == 'contents of foo'
      Roadie.load_css(['foo.css']).should == 'contents of foo'
    end

    it "loads files in order and join them with a newline" do
      Roadie.load_css(%w[foo bar]).should == "contents of foo\ncontents of bar"
      Roadie.load_css(%w[bar foo]).should == "contents of bar\ncontents of foo"
    end

    it "loads files also from asset subdirectories" do
      Roadie.load_css(%w[foo subdirectory/findme.css]).should == "contents of foo\ncan you really find me?"
      Roadie.load_css(%w[bar foo]).should == "contents of bar\ncontents of foo"
    end

    it "raises a Roadie::CSSFileNotFound error when a css file could not be found" do
      expect { Roadie.load_css(['not_here']) }.to raise_error(Roadie::CSSFileNotFound, /not_here/)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roadie-2.0.0 spec/lib/roadie_spec.rb