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-5.0.4 spec/bobot/event/policy_enforcement_spec.rb
bobot-5.0.3 spec/bobot/event/policy_enforcement_spec.rb
bobot-5.0.2 spec/bobot/event/policy_enforcement_spec.rb
bobot-5.0.1 spec/bobot/event/policy_enforcement_spec.rb
bobot-5.0.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.15.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.14.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.13.1 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.13.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.11.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.10.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.9.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.8.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.7.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.6.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.5.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.4.1 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.4.0 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.3.1 spec/bobot/event/policy_enforcement_spec.rb
bobot-4.3.0 spec/bobot/event/policy_enforcement_spec.rb