Sha256: 7313c76773722bbb58863004f769e85dd7a890fb64bb37c5f78bc205049394dd

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

RSpec.describe Frozen::Template::Stylesheet do
  let(:stylesheet) { Frozen::Template::Stylesheet.new }
  describe "#initialize" do
    it "should have default style" do
      expect(stylesheet.options[:style]).to eq(:compressed)
    end
  end
  describe "#render" do
    context "with scss " do
      it "renders contents" do
        expect(stylesheet).to receive(:file_type) { "scss" }
        expect(stylesheet).to receive(:contents) {
          ".parent{child{color: red}}"
        }
        expect(stylesheet.render).to eq(".parent child{color:red}\n")
      end
    end
    context "with sass " do
      it "renders contents" do
        expect(stylesheet).to receive(:file_type) { "sass" }
        expect(stylesheet).to receive(:contents) {
          ".parent\n\t.child\n\t\tcolor: red"
        }
        expect(stylesheet.render).to eq(".parent .child{color:red}\n")
      end
    end
  end
  describe "#build_file_path" do
    it "should return build path inside css folder" do
      stylesheet.file_path = "assets/stylesheets/main.scss"
      stylesheet.template_root_path = "assets/stylesheets"
      expect(stylesheet.build_file_path).to eq("css/main.css")
    end
    it "should return nested build path for css" do
      stylesheet.file_path = "assets/stylesheets/sub/sub.scss"
      stylesheet.template_root_path = "assets/stylesheets"
      expect(stylesheet.build_file_path).to eq("css/sub/sub.css")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frozen-0.0.1 spec/lib/frozen/template/stylesheet_spec.rb