Sha256: ee82bc31d478937305577bce2b570d3d52f300c3697ccc8fc1654eeacbf4ee6c
Contents?: true
Size: 1.2 KB
Versions: 46
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' require 'middleman-core/preview_server/server_ip_address' RSpec.describe Middleman::PreviewServer::ServerIpAddress do subject(:ip_address) { described_class.new(string) } let(:string) { '127.0.0.1' } describe '#to_s' do context 'when ipv4' do let(:string) { '127.0.0.1' } it { expect(ip_address.to_s).to eq string } end context 'when ipv6' do context 'without suffix' do let(:string) { '2607:f700:8000:12e:b3d9:1cba:b52:aa1b' } it { expect(ip_address.to_s).to eq string } end context 'with suffix' do let(:string) { '2607:f700:8000:12e:b3d9:1cba:b52:aa1b%wlp1s0' } let(:result) { '2607:f700:8000:12e:b3d9:1cba:b52:aa1b' } it { expect(ip_address.to_s).to eq result } end end end describe '#to_browser' do context 'when ip_address' do it { expect(ip_address.to_browser).to eq string } end context 'when ipv4' do let(:string) { '127.0.0.1' } it { expect(ip_address.to_browser).to eq string } end context 'when ipv6' do let(:string) { '2607:f700:8000:12e:b3d9:1cba:b52:aa1b' } it { expect(ip_address.to_browser).to eq "[#{string}]" } end end end
Version data entries
46 entries across 46 versions & 3 rubygems