Sha256: bd2165f918652be5627073943028b5b4e20d855f78ae5c4c92e483741fac7960

Contents?: true

Size: 756 Bytes

Versions: 67

Compression:

Stored size: 756 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 }
    controller.stub(:after_update_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

67 entries across 67 versions & 1 rubygems

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