Sha256: 9f91e9f91b1dd2c59e71790c4a4161c98711f98b0ec1000331d991adfa385dea

Contents?: true

Size: 1.49 KB

Versions: 12

Compression:

Stored size: 1.49 KB

Contents

shared_examples_for 'Metasploit::Model::Search::Operation::Value::Integer' do
  let(:operation_class) do
    described_class
  end

  context '#class' do
    subject do
      operation_class
    end

    it { should include Metasploit::Model::Search::Operation::Value::Integer }
  end

  context '#value' do
    subject(:value) do
      operation.value
    end

    let(:operation) do
      operation_class.new(:value => formatted_value)
    end

    context 'with Integer' do
      let(:formatted_value) do
        1
      end

      it 'should pass through Integer' do
        value.should == formatted_value
      end
    end

    context 'with Integer#to_s' do
      let(:formatted_value) do
        integer.to_s
      end

      let(:integer) do
        1
      end

      it 'should convert String to Integer' do
        value.should == integer
      end
    end

    context 'with mix text and numerals' do
      let(:formatted_value) do
        "#{integer}mix"
      end

      let(:integer) do
        123
      end

      it 'should not extract the number' do
        value.should_not == integer
      end

      it 'should pass through the full value' do
        value.should == formatted_value
      end
    end

    context 'with Float' do
      let(:formatted_value) do
        0.1
      end

      it 'should not truncate Float to Integer' do
        value.should_not == formatted_value.to_i
      end

      it 'should pass through Float' do
        value.should == formatted_value
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
metasploit-model-1.0.0.pre.rails.pre.4.0 spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.30.0 spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.30.0-java spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.29.2 spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.29.2-java spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.29.0 spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.29.0-java spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.28.0 spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.28.0-java spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.28.0.pre.engine.pre.requires spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.27.4 spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
metasploit-model-0.27.4-java spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb