Sha256: 0ab80b9c874ff2ecc56013e80b3c8e820aab3be7fa87c83370bf51e76617a4df

Contents?: true

Size: 1014 Bytes

Versions: 3

Compression:

Stored size: 1014 Bytes

Contents

require 'spec_helper'
require 'support/feature_detection'

describe UsersController, type: :controller do
  let(:trashable) { Trashable.create!(name: 'Bob') }

  describe 'create' do
    before { post :create }
    subject { Draftsman::Draft.last }

    it 'records user name via `user_for_draftsman`' do
      expect(subject.whodunnit).to eql 'A User'
    end
  end

  describe 'update' do
    it 'records user name via `user_for_draftsman`' do
      if request_test_helpers_require_keyword_args?
        put :update, params: { id: trashable.id }
      else
        put :update, id: trashable.id
      end

      expect(Draftsman::Draft.last.whodunnit).to eql 'A User'
    end
  end

  describe 'destroy' do
    it 'records user name via `user_for_draftsman`' do
      if request_test_helpers_require_keyword_args?
        delete :destroy, params: { id: trashable.id }
      else
        delete :destroy, id: trashable.id
      end

      expect(Draftsman::Draft.last.whodunnit).to eql 'A User'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
draftsman-0.7.2 spec/controllers/users_controller_spec.rb
draftsman-0.7.1 spec/controllers/users_controller_spec.rb
draftsman-0.7.0 spec/controllers/users_controller_spec.rb