summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/validators/ip_address_validator_shared_examples.rb
blob: 5680d4f772ccf2e17bae057f738ea39d28f758b5 (plain)
1
2
3
4
5
6
7
8
9
10
# frozen_string_literal: true

RSpec.shared_examples 'validates IP address' do
  subject { object }

  it { is_expected.to allow_value('192.168.17.43').for(attribute.to_sym) }
  it { is_expected.to allow_value('2001:0db8:85a3:0000:0000:8a2e:0370:7334').for(attribute.to_sym) }

  it { is_expected.not_to allow_value('invalid IP').for(attribute.to_sym) }
end