Sha256: 7093ab3990d32ca4ba3ad066f919242947401b5434ae4df71f178e8f6532f592

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

require 'spec_helper'

describe FooController, type: :controller do
  include Capybara::DSL
  render_views

  context "renders views fetched from database with" do
    it "a basic template" do
      FactoryGirl.create(:database_template, :path => 'foo/default_layout')

      visit '/foo/default_layout'

      expect(response).to render_template("foo/default_layout" )
      expect(page.body).to match(/something here in the body of the page: 4/)
    end

    it "a custom layout" do
      FactoryGirl.create(:database_template, :path => 'foo/custom_layout')
      FactoryGirl.create(:database_template, :path => 'layouts/custom', :body => 'This is a layout with body: <%= yield %>')

      visit '/foo/custom_layout'

      expect(response).to render_template("layouts/custom" )
      expect(response).to render_template("foo/custom_layout" )
      expect(page.body).to match(/This is a layout with body:/)
      expect(page.body).to match(/something here in the body of the page:/)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
panoramic-0.0.7 spec/controllers/rendering_spec.rb
panoramic-0.0.6 spec/controllers/rendering_spec.rb