Sha256: dd43fcba941e0dee5bb29442eced07f135850c826608dea89fda7a1f17fad4a2

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

require_relative "./helpers"

describe Spinebox::ERBContext do
  
  before(:all) do
    Dir.chdir "#{Spinebox.root}/templates/app"
    Spinebox.boot!
  end
  
  context "javascript" do
    it "should offer asset tags concatenated" do
      Spinebox.config.concatenate = true
      javascript_include_tag("application").split("\n").should have(1).tag
    end
  
    it "should offer asset tags unconcatenated" do
      Spinebox.config.concatenate = false
      javascript_include_tag("application").split("\n").should have_at_least(5).tags
    end
  end
  
  context "css" do
    it "should offer asset tags concatenated" do
      Spinebox.config.concatenate = true
      stylesheet_link_tag("application").split("\n").should have(1).tag
    end
  
    it "should offer asset tags unconcatenated" do
      Spinebox.config.concatenate = false
      stylesheet_link_tag("application").split("\n").should have_at_least(1).tag
    end
  end
  
  context "render", :render do
    it "returns a rendered partial" do
      render(:partial => "partial.html").should == "<p>This is a partial</p>"
    end
    
    it "raises an error on missing params" do
      proc{ render }.should raise_error
    end
    
    it "raises an error on missing partial extensions" do
      proc{ render(:partial => "partial") }.should raise_error
    end
    
    it "raises an error on unexistant partial" do
      proc{ render(:partial => "notthere.html") }.should raise_error
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spinebox-0.0.15 spec/erb_context_spec.rb
spinebox-0.0.14 spec/erb_context_spec.rb