Sha256: a202d9d9f85f3d65f790e53f5e7926661447aefda0f2c965315baaa57b3d2347
Contents?: true
Size: 1.2 KB
Versions: 51
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' describe MetasploitDataModels::Match::Child do let(:extending_class) { # capture as local for Class.new block scope described_class = self.described_class Class.new(Metasploit::Model::Base) { extend described_class # # Attributes # # @!attribute value # @return [String] attr_accessor :value } } before(:each) do stub_const('ExtendingClass', extending_class) stub_const('ExtendingClass::REGEXP', /\d+-\d+/) end context '#match' do subject(:match) { extending_class.match(formatted_value) } context 'formatted value' do context 'with matching' do let(:formatted_value) { '1-2' } it 'returns instance of extending class' do expect(match).to be_an extending_class end context '#value' do subject(:value) { match.value } it 'is set to formatted value' do expect(value).to eq(formatted_value) end end end context 'without matching' do let(:formatted_value) do '1,2-3' end it { should be_nil } end end end end
Version data entries
51 entries across 51 versions & 1 rubygems