Sha256: d2dbcf3eccecc34035a28ef49a012890f83207187fb4b0f8ab5250bf4c12c1e8

Contents?: true

Size: 973 Bytes

Versions: 1

Compression:

Stored size: 973 Bytes

Contents

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
      expect(file_name.templatize).to 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
      expect(file_name.templatize).to 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
      expect(file_name.templatize).to 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
      expect(file_name.templatize).to eq(:"article/post.html")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mango-0.9.0 spec/lib/core_ext/string_spec.rb