Sha256: 8ea55c31a5d0f3ecea3f51aa760fdd12e1bffc2c10a527c250887e983a4907ec

Contents?: true

Size: 905 Bytes

Versions: 7

Compression:

Stored size: 905 Bytes

Contents

require 'spec_helper'

# Tests the automatic usage of `current_user` as the `whodunnit` attribute on the draft object
describe WhodunnitsController, :type => :controller do
  let(:trashable) { Trashable.create!(:name => 'Bob') }

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

    it 'records `current_user` via `user_for_draftsman' do
      expect(subject.whodunnit).to eql "153"
    end
  end

  describe 'update' do
    before { put :update, :id => trashable.id }
    subject { Draftsman::Draft.last }

    it 'records `current_user` via `user_for_draftsman' do
      expect(subject.whodunnit).to eql "153"
    end
  end

  describe 'destroy' do
    before { delete :destroy, :id => trashable.id }
    subject { Draftsman::Draft.last }

    it 'records `current_user` via `user_for_draftsman' do
      expect(subject.whodunnit).to eql "153"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
draftsman-0.4.0 spec/controllers/whodunnits_controller_spec.rb
draftsman-0.3.7 spec/controllers/whodunnits_controller_spec.rb
draftsman-0.3.6 spec/controllers/whodunnits_controller_spec.rb
draftsman-0.3.5 spec/controllers/whodunnits_controller_spec.rb
draftsman-0.3.4 spec/controllers/whodunnits_controller_spec.rb
draftsman-0.3.3 spec/controllers/whodunnits_controller_spec.rb
draftsman-0.3.2 spec/controllers/whodunnits_controller_spec.rb