Sha256: 8c0077533e0b01434eb2248dcd7167b1f97883f9d94b09dc4f9c47a25a9b9f0b

Contents?: true

Size: 1.11 KB

Versions: 38

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Metasploit::Model::Search::Operation::Boolean do
  context 'CONSTANTS' do
    context 'FORMATTED_VALUE_TO_VALUE' do
      subject(:formatted_value_to_value) do
        described_class::FORMATTED_VALUE_TO_VALUE
      end

      its(['false']) { should be_false }
      its(['true']) { should be_true }
    end
  end

  context 'validations' do
    it { should allow_value(false).for(:value) }
    it { should allow_value(true).for(:value) }
    it { should_not allow_value(nil).for(:value) }
  end

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

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

    context "with 'false'" do
      let(:formatted_value) do
        'false'
      end

      it { should be_false }
    end

    context "with 'true'" do
      let(:formatted_value) do
        'true'
      end

      it { should be_true }
    end

    context 'with other' do
      let(:formatted_value) do
        'unknown'
      end

      it 'should return value unparsed' do
        value.should == formatted_value
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
metasploit-model-1.0.0.pre.rails.pre.4.0 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.30.0 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.30.0-java spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.29.2 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.29.2-java spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.29.0 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.29.0-java spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.28.0 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.28.0-java spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.28.0.pre.engine.pre.requires spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.4 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.4-java spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.3 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.3-java spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.2 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.2-java spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.1 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.1-java spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.0 spec/app/models/metasploit/model/search/operation/boolean_spec.rb
metasploit-model-0.27.0-java spec/app/models/metasploit/model/search/operation/boolean_spec.rb