Sha256: 3f37e4cab7855812af143a32721236c35983e6b8abcd0fb7e4265717842c9569

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe(RCAP::Info) do
  describe('initialising') do
    context('a CAP 1.2 info') do
      let(:alert) do
        RCAP::CAP_1_2::Alert.new
      end

      let(:original_info) do
        RCAP::CAP_1_2::Info.new do |info|
          info.event = 'Event'
          info.urgency = RCAP::CAP_1_2::Info::URGENCY_EXPECTED
          info.severity = RCAP::CAP_1_2::Info::SEVERITY_SEVERE
          info.certainty = RCAP::CAP_1_2::Info::CERTAINTY_LIKELY
        end
      end

      shared_examples_for('the 1.2 Info object is initialised correctly') do
        it('sets the event') { info.event.should == original_info.event }
        it('sets the urgency') { info.urgency.should == original_info.urgency }
        it('sets the severity') { info.severity.should == original_info.severity }
        it('sets the certainty') { info.certainty.should == original_info.certainty }
      end

      context('from a Hash') do
        let(:info) do
          RCAP::Info.from_h(alert, original_info.to_h)
        end

        it_should_behave_like('the 1.2 Info object is initialised correctly')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rcap-2.7.4 spec/info_spec.rb
rcap-2.7.3 spec/info_spec.rb
rcap-2.7.0 spec/info_spec.rb
rcap-2.6.0 spec/info_spec.rb
rcap-2.5.1 spec/info_spec.rb
rcap-2.5.0 spec/info_spec.rb