Sha256: af35c34ea52b86969eb9f47654b89bdeebdf0dc3e3f030069c632a8053869b88
Contents?: true
Size: 1.86 KB
Versions: 1
Compression:
Stored size: 1.86 KB
Contents
require 'spec_helper' describe Earl::URL do describe '#scheme' do context 'when provided' do subject { Earl::URL.new 'http://www.foo.com' } its( :scheme ){ should eq( 'http' ) } its( :scheme? ){ should be_true } it 'should be settable' do subject.scheme = 'https' subject.scheme.should eq( 'https' ) end end context 'when not provided' do subject { Earl::URL.new 'www.foo.com' } its( :scheme ){ should eq( nil ) } its( :scheme? ){ should be_false } it 'should be settable' do subject.scheme = 'https' subject.scheme.should eq( 'https' ) end end end describe '#domain' do pending end describe '#subdomain' do context 'when provided' do subject { Earl::URL.new 'http://www.foo.com' } its( :subdomain ){ should eq( 'www' ) } its( :subdomain? ){ should be_true } it 'should be settable' do subject.subdomain = 'secure' subject.subdomain.should eq( 'secure' ) end end context 'when not provided' do subject { Earl::URL.new 'foo.com' } its( :subdomain ){ should eq( nil ) } its( :subdomain? ){ should be_false } it 'should be settable' do subject.subdomain = 'secure' subject.subdomain.should eq( 'secure' ) end end end describe '#host' do context 'when provided' do subject { Earl::URL.new 'http://www.foo.com' } its( :host ){ should eq( 'foo.com' ) } its( :host? ){ should be_true } it 'should be settable' do subject.host = 'bar.com' subject.host.should eq( 'bar.com' ) end end context 'when not provided' do it 'should raise an error' do expect { Earl::URL.new 'http://' }.to raise_error( URI::InvalidURIError ) end end end describe '#path' do pending end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
earl-0.1.0 | spec/earl/parts_spec.rb |