File: field_set_spec.rb

package info (click to toggle)
ruby-ntlm 0.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid
  • size: 408 kB
  • sloc: ruby: 2,663; makefile: 6
file content (33 lines) | stat: -rw-r--r-- 854 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'spec_helper'

describe Net::NTLM::FieldSet do

  fields = []

  it_behaves_like 'a fieldset', fields

  subject(:fieldset_class) do
    Class.new(Net::NTLM::FieldSet)
  end

  context 'an instance' do
    subject(:fieldset_object) do
      fieldset_class.string(:test_string, { :value => 'Test', :active => true, :size => 4})
      fieldset_class.string(:test_string2, { :value => 'Foo', :active => true, :size => 3})
      fieldset_class.new
    end

    it 'should serialize all the fields' do
      expect(fieldset_object.serialize).to eq('TestFoo')
    end

    it 'should parse a string across the fields' do
      fieldset_object.parse('FooBarBaz')
      expect(fieldset_object.serialize).to eq('FooBarB')
    end

    it 'should return an aggregate size of all the fields' do
      expect(fieldset_object.size).to eq(7)
    end
  end
end