Sha256: bab355fd609f514f5678d552b0de5c8383fb42381b9b6a797a2363e5ea6c69d9

Contents?: true

Size: 916 Bytes

Versions: 26

Compression:

Stored size: 916 Bytes

Contents

require 'rails_helper'

RSpec.describe Bobot::Event::PolicyEnforcement do
  let :payload do
    {
      'sender' => {
        'id' => '3'
      },
      'recipient' => {
        'id' => '3'
      },
      'timestamp' => 145_776_419_762_7,
      'policy-enforcement' => {
        'action' => 'block',
        'reason' => <<-REASON
          The bot violated our Platform Policies
          (https://developers.facebook.com/policy/#messengerplatform).
          Common violations include sending out excessive spammy
          messages or being non-functional.
        REASON
      }
    }
  end

  let(:policy_enforcement) { payload['policy-enforcement'] }

  subject { described_class.new(payload) }

  describe '.action' do
    specify { expect(subject.action).to eq(policy_enforcement['action']) }
  end

  describe '.reason' do
    specify { expect(subject.reason).to eq(policy_enforcement['reason']) }
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
bobot-4.2.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.1.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.0.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-3.7.9 spec/bobot/event/policy_enforcement_spec.rb
bobot-3.7.8 spec/bobot/event/policy_enforcement_spec.rb
bobot-3.7.6 spec/bobot/event/policy_enforcement_spec.rb