spec/controllers/whodunnits_controller_spec.rb in draftsman-0.3.1 vs spec/controllers/whodunnits_controller_spec.rb in draftsman-0.3.2
- old
+ new
@@ -1,24 +1,33 @@
require 'spec_helper'
# Tests the automatic usage of `current_user` as the `whodunnit` attribute on the draft object
-describe WhodunnitsController do
+describe WhodunnitsController, :type => :controller do
let(:trashable) { Trashable.create!(:name => 'Bob') }
- describe :create do
+ describe 'create' do
before { post :create }
subject { Draftsman::Draft.last }
- its(:whodunnit) { should eql "153" }
+
+ it 'records `current_user` via `user_for_draftsman' do
+ expect(subject.whodunnit).to eql "153"
+ end
end
- describe :update do
+ describe 'update' do
before { put :update, :id => trashable.id }
subject { Draftsman::Draft.last }
- its(:whodunnit) { should eql "153" }
+
+ it 'records `current_user` via `user_for_draftsman' do
+ expect(subject.whodunnit).to eql "153"
+ end
end
- describe :destroy do
+ describe 'destroy' do
before { delete :destroy, :id => trashable.id }
subject { Draftsman::Draft.last }
- its(:whodunnit) { should eql "153" }
+
+ it 'records `current_user` via `user_for_draftsman' do
+ expect(subject.whodunnit).to eql "153"
+ end
end
end