Sha256: 0c60413088f8f17b1c5ef9bd11b2571944bfa780a2a2651f3362fc15a99cf5cd

Contents?: true

Size: 701 Bytes

Versions: 16

Compression:

Stored size: 701 Bytes

Contents

require 'spec_helper'

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

  let(:user) do
    double(
      :staff? => true,
      :is_super_admin? => false,
      :is_admin? => true
    )
  end
  let(:post) { double.as_null_object }

  before do
    controller.stub(:current_user) { user }
    controller.stub(:polymorphic_index_path) { posts_path }
  end

  describe 'PATCH update' do
    before do
      Tenon::Post.stub(:find) { double.as_null_object }
    end

    it "should instantiate the post_category_ids collection if it's empty" do
      patch :update, id: 1, post: { blah: 'blah' }
      expect(controller.params[:post][:post_category_ids]).to eq([])
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
tenon-1.0.15 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.14 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.13 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.12 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.11 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.10 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.9 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.8 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.7 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.6 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.5 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.4 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.3 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.2 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0.1 spec/controllers/tenon/posts_controller_spec.rb
tenon-1.0 spec/controllers/tenon/posts_controller_spec.rb