Sha256: 934330eb1136242f1a528023f0b0805984acc240ac6ba06acac45095f5947931

Contents?: true

Size: 947 Bytes

Versions: 3

Compression:

Stored size: 947 Bytes

Contents

require "test_helper"

describe FrontEndController do

  before { @routes = Rails.application.routes }
    
  describe 'GET #node' do
    let(:page)      { Page.create attributes }
    let(:permalink) { page.permalink }
    let(:action!)   { get :node, permalink: permalink }

    describe 'when node does not exist' do
      let(:permalink) { 'does/not/exist' }
      it { proc { action! }.must_raise ActiveRecord::RecordNotFound }
    end
    describe 'when node not published' do
      let(:attributes) { FactoryGirl.attributes_for :node, type: 'Page' }
      it { proc { action! }.must_raise ActiveRecord::RecordNotFound }
    end
    describe 'when node is published' do
      let(:attributes) { FactoryGirl.attributes_for :published_node, type: 'Page' }
      before { action! }
      it { response.must_render_template 'nodes/page' }
      it { assigns[:node].must_equal page }
      it { assigns[:page].must_equal page }
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
push_type_core-0.2.0 test/controllers/front_end_controller_test.rb
push_type_core-0.2.0.beta2 test/controllers/front_end_controller_test.rb
push_type_core-0.1.1 test/controllers/front_end_controller_test.rb