Sha256: f76210803ba606d4482524a738a6a7f0548f120ae3736e704bac2f18800ba0cf

Contents?: true

Size: 1.04 KB

Versions: 83

Compression:

Stored size: 1.04 KB

Contents

# We test the PostCategoriesController as it inherits completely from
# resources controller.  Other controllers should only test
# methods that they override.  SimpleResourcesController inherits
# from Tenon::ResourcesController, there are only two actions to
# test here.

require 'spec_helper'

describe Tenon::PostCategoriesController do
  routes { Tenon::Engine.routes }

  let(:user) do
    double(
      :staff? => true,
      :is_super_admin? => false,
      :is_admin? => true
    )
  end

  before do
    controller.stub(:current_user) { user }
    controller.stub(:polymorphic_index_path) { '/tenon/banners' }
  end

  describe 'GET index' do
    it 'should instantiate a new resource' do
      expect(Tenon::PostCategory).to receive(:new)
      get :index
    end
  end

  describe 'GET edit' do
    before do
      Tenon::PostCategory.stub(:find) { double.as_null_object }
    end

    it 'should render the form partial' do
      get :edit, id: 1
      expect(response).to render_template(partial: 'tenon/post_categories/_form')
    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
tenon-1.1.8 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.1.7 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.1.6 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.1.5 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.1.4 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.1.3 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.1.2 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.1.1 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.76 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.75 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.74 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.73 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.72 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.71 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.70 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.69 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.68 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.67 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.66 spec/controllers/tenon/simple_resources_controller_spec.rb
tenon-1.0.65 spec/controllers/tenon/simple_resources_controller_spec.rb