require 'spec_helper' require 'fixtures/simple' require 'fixtures/advanced' require 'fixtures/html_content' require 'fixtures/attributes_helper' describe "Haml files" do let(:simple) { Template['fixtures/simple'] } let(:advanced) { Template['fixtures/advanced'] } let(:html_content) { Template['fixtures/html_content'] } let(:attributes_helper) { Template['fixtures/attributes_helper'] } it "should be defined by filename on Template namespace" do expect(simple).to be_kind_of(Template) end it "should render using #render" do expect(simple.render(self)).to include('lol') end it "accepts a context to render template with" do @haml_message = "hello world" expect(advanced.render(self)).to include('hello world') expect([ %{hello worldfoofoofoo}, # haml 4 %{hello worldfoofoofoo}, # haml 5 ]).to include(advanced.render(self)) end it "generates html with a given context" do @h1_content = 'Ford Perfect' expect(html_content.render(self)).to include('