Sha256: 69e9a8a9e0d7bcf1714ed9836bf38c05f5988035219ed630c4eb4699672035a7

Contents?: true

Size: 975 Bytes

Versions: 2

Compression:

Stored size: 975 Bytes

Contents

# encoding: UTF-8
require "spec_helper"

describe String, "#templatize" do
  context "given a file name with 1 extension" do
    let(:file_name) { "blog.haml" }

    it "converts it to a Sinatra-compliant template name" do
      file_name.templatize.should eq(:blog)
    end
  end

  context "given a nested file name with 1 extension" do
    let(:file_name) { "blog/home.erb" }

    it "converts it to a Sinatra-compliant template name" do
      file_name.templatize.should eq(:"blog/home")
    end
  end

  context "given a file name with 2 extensions" do
    let(:file_name) { "page.html.liquid" }

    it "converts it to a Sinatra-compliant template name" do
      file_name.templatize.should eq(:"page.html")
    end
  end

  context "given a nested file name with 2 extensions" do
    let(:file_name) { "article/post.html.haml" }

    it "converts it to a Sinatra-compliant template name" do
      file_name.templatize.should eq(:"article/post.html")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mango-0.6.3 spec/lib/core_ext/string_spec.rb
mango-0.6.2 spec/lib/core_ext/string_spec.rb