require "rails_helper" RSpec.describe StripePciGuard do it "rileva hash carta grezza" do expect(described_class.raw_card_hash?({ number: "4242424242424242" })).to be true expect(described_class.raw_card_hash?({ exp_month: 12 })).to be true expect(described_class.raw_card_hash?({ token: "tok_visa" })).to be false end it "blocca PaymentMethod.create con numero carta" do skip "Stripe gem non caricata" unless defined?(Stripe::PaymentMethod) expect { Stripe::PaymentMethod.create( type: "card", card: { number: "4242424242424242", exp_month: 12, exp_year: 2034, cvc: "123" } ) }.to raise_error(SecurityError, /PCI/) end end