Sha256: 7e314a3c902cf8945b53012eb9239247c19cc919b47a341d7cca39426ddc50d5

Contents?: true

Size: 1.19 KB

Versions: 7

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

# Tests controller `info_for_draftsman` method
describe InformantsController, :type => :controller do
  let(:trashable) { Trashable.create!(:name => 'Bob') }

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

    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
    before { put :update, :id => trashable.id }
    subject { Draftsman::Draft.last }

    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
    before { delete :destroy, :id => trashable.id }
    subject { Draftsman::Draft.last }

    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

Version data entries

7 entries across 7 versions & 1 rubygems

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