Sha256: edb89e8551f0a8cac507b0bcef76c023d4fbd5bc8b9295a5630eb57dffbe5a7f

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

module Hushed
  module Documents
    module DocumentInterfaceTestcases

      def test_it_should_be_able_to_generate_a_filename
        assert bn = @object.business_unit
        assert type = @object.type
        assert number = @object.document_number
        assert date = @object.date.strftime("%Y%m%d_%H%M%S")
        expected_filename = "#{bn}_#{type}_#{number}_#{date}.xml"
        assert_equal expected_filename, @object.filename
      end

      def test_it_should_not_raise_an_exception_when_getting_the_warehouse
        assert @object.warehouse
      end

      def test_it_should_not_raise_an_exception_when_getting_the_message_id
        assert @object.message_id
      end

      def test_it_should_not_raise_an_exception_when_getting_the_type
        assert @object.type
      end

      def test_it_should_not_raise_an_exception_when_getting_the_date
        assert @object.date
      end

      def test_it_should_be_initializable_with_a_hash
        begin
          @object.class.new(:thinger => 123)
        rescue TypeError
          flunk "It should be possible to initialize #{@object.class} with an args hash"
        rescue StandardError
        end
      end

    end
  end

  describe "DocumentDouble" do
    include Documents::DocumentInterfaceTestcases

    before do
      @object = DocumentDouble.new(
        :message_id => '1234567',
        :date => Time.new(2013, 04, 05, 12, 30, 15).utc,
        :client => ClientDouble.new(:warehouse => 'fancywarehouse'),
        :type => 'Thinger',
        :business_unit => 'HUSHED',
        :document_number => '123456',
        :warehouse => 'fancywarehouse'
      )
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hushed-0.0.9 spec/unit/documents/document_spec.rb
hushed-0.0.8 spec/unit/documents/document_spec.rb
hushed-0.0.7 spec/unit/documents/document_spec.rb
hushed-0.0.6 spec/unit/documents/document_spec.rb
hushed-0.0.5 spec/unit/documents/document_spec.rb
hushed-0.0.4 spec/unit/documents/document_spec.rb
hushed-0.0.3 spec/unit/documents/document_spec.rb