spec/controllers/informants_controller_spec.rb in draftsman-0.3.1 vs spec/controllers/informants_controller_spec.rb in draftsman-0.3.2
- old
+ new
@@ -1,27 +1,45 @@
require 'spec_helper'
# Tests controller `info_for_draftsman` method
-describe InformantsController do
+describe InformantsController, :type => :controller do
let(:trashable) { Trashable.create!(:name => 'Bob') }
- describe :create do
+ describe 'create' do
before { post :create }
subject { Draftsman::Draft.last }
- its(:ip) { should eql '123.45.67.89' }
- its(:user_agent) { should eql '007' }
+
+ it 'records `ip` from custom `info_for_draftsman`' do
+ expect(subject.ip).to eql '123.45.67.89'
+ end
+
+ it 'records `user_agent` from custom `info_for_draftsman`' do
+ expect(subject.user_agent).to eql '007'
+ end
end
- describe :update do
+ describe 'update' do
before { put :update, :id => trashable.id }
subject { Draftsman::Draft.last }
- its(:ip) { should eql '123.45.67.89' }
- its(:user_agent) { should eql '007' }
+
+ it 'records `ip` from custom `info_for_draftsman`' do
+ expect(subject.ip).to eql '123.45.67.89'
+ end
+
+ it 'records `user_agent` from custom `info_for_draftsman`' do
+ expect(subject.user_agent).to eql '007'
+ end
end
- describe :destroy do
+ describe 'destroy' do
before { delete :destroy, :id => trashable.id }
subject { Draftsman::Draft.last }
- its(:ip) { should eql '123.45.67.89' }
- its(:user_agent) { should eql '007' }
+
+ it 'records `ip` from custom `info_for_draftsman`' do
+ expect(subject.ip).to eql '123.45.67.89'
+ end
+
+ it 'records `user_agent` from custom `info_for_draftsman`' do
+ expect(subject.user_agent).to eql '007'
+ end
end
end