Sha256: 79ceb92dcd1e409a6c5c77effa2c89f3068d420237e3e97b6e9433fb8b798866

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'
require 'rollbar'

Rollbar.plugins.load!

describe Rollbar::ActiveRecordExtension do
  it 'has the extensions loaded into ActiveRecord::Base' do
    expect(ActiveModel::Validations.ancestors).to include(described_class)
    expect(ActiveModel::Validations.instance_methods.map(&:to_sym)).to include(:report_validation_errors_to_rollbar)
  end

  context 'with an ActiveRecord::Base instance' do
    let(:user) { User.new }

    it 'calls report_validation_errors_to_rollbar' do
      expect(user).to receive(:report_validation_errors_to_rollbar)

      user.valid?
    end
  end

  context 'with class using ActiveModel::Validations' do
    let(:post) { Post.new }

    it 'calls report_validation_errors_to_rollbar' do
      expect(post).to receive(:report_validation_errors_to_rollbar)

      post.valid?
    end
  end

  describe '#report_validation_errors_to_rollbar', :reconfigure_notifier => true do
    context 'having validation errors' do
      let(:user) { User.new }

      it 'send the errors to Rollbar' do
        expect(Rollbar).to receive(:warning)

        user.valid?
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rollbar-2.13.3 spec/rollbar/plugins/validations_spec.rb
rollbar-2.13.2 spec/rollbar/plugins/validations_spec.rb
rollbar-2.13.1 spec/rollbar/plugins/validations_spec.rb
rollbar-2.13.0 spec/rollbar/plugins/validations_spec.rb
rollbar-2.12.0 spec/rollbar/plugins/validations_spec.rb
rollbar-2.11.5 spec/rollbar/plugins/validations_spec.rb
rollbar-2.11.4 spec/rollbar/plugins/validations_spec.rb
rollbar-2.11.3 spec/rollbar/plugins/validations_spec.rb
rollbar-2.11.2 spec/rollbar/plugins/validations_spec.rb
rollbar-2.11.1 spec/rollbar/plugins/validations_spec.rb
rollbar-2.11.0 spec/rollbar/plugins/validations_spec.rb