Sha256: 26c7ebe10b695ffae572807151864e1ee6205052fc1712c687a5e7706c3b5673

Contents?: true

Size: 1.03 KB

Versions: 16

Compression:

Stored size: 1.03 KB

Contents

class SiteHub
  class Cookie
    describe Attribute do
      let(:attribute_name) { 'domain' }
      let(:attribute_value) { 'value' }
      subject do
        described_class.new(attribute_name, attribute_value)
      end
      describe '#initialize' do
        it 'stores the attribute name and its value' do
          expect(subject.name).to eq(attribute_name.to_sym)
          expect(subject.value).to eq(attribute_value)
        end

        it 'sanitises the string parameter' do
          expect(described_class.new("#{attribute_name} \n", attribute_value).name).to eq(attribute_name.to_sym)
        end

        context 'value is nil' do
          subject do
            described_class.new(attribute_name, nil)
          end

          it 'default to empty string' do
            expect(subject.value).to eq('')
          end
        end
      end

      describe '#to_s' do
        it 'contains the attribute name and value' do
          expect(subject.to_s).to eq("#{attribute_name}=#{attribute_value}")
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sitehub-0.5.0.alpha12 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.4.10 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.5.0.alpha11 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.5.0.alpha10 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.5.0.alpha8 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.5.0.alpha7 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.5.0.alpha6 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.5.0.alpha5 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.5.0.alpha4 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.5.0.alpha3 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.5.0.alpha2 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.4.9 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.4.8 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.4.7 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.4.6 spec/sitehub/cookie/attribute_spec.rb
sitehub-0.4.3 spec/sitehub/cookie/attribute_spec.rb