Sha256: a4457c86723ae9a493756f8430b07724b64b0736ab912d0bc2752e6fcf0a8da4

Contents?: true

Size: 1.49 KB

Versions: 26

Compression:

Stored size: 1.49 KB

Contents

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

  context '#class' do
    subject do
      operation_class
    end

    it { should include Metasploit::Model::Search::Operation::Integer::Value }
  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

26 entries across 26 versions & 1 rubygems

Version Path
metasploit-model-0.27.3 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.27.3-java spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.27.2 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.27.2-java spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.27.1 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.27.1-java spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.27.0 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.27.0-java spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.27.0.pre.dep.pre.railties spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.26.1-java spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.26.1 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.25.7 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.25.7-java spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.25.6 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.25.6-java spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.25.3 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.25.3-java spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.25.2 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.25.2-java spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb
metasploit-model-0.25.1 spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb