spec/lib/metasploit/model/search/with_spec.rb in metasploit-model-1.0.0.pre.rails.pre.4.0 vs spec/lib/metasploit/model/search/with_spec.rb in metasploit-model-1.0.0
- old
+ new
@@ -1,8 +1,6 @@
-require 'spec_helper'
-
-describe Metasploit::Model::Search::With do
+RSpec.describe Metasploit::Model::Search::With do
let(:base_class) do
described_class = self.described_class
Class.new do
include described_class
@@ -35,47 +33,47 @@
:new => operator
)
end
it 'should pass given options to operator_class.new' do
- operator_class.should_receive(:new).with(
+ expect(operator_class).to receive(:new).with(
hash_including(options)
).and_return(operator)
search_with_operator
end
it 'should merge :klass into options passed to operator.new' do
- operator_class.should_receive(:new).with(
+ expect(operator_class).to receive(:new).with(
hash_including(
:klass => base_class
)
)
search_with_operator
end
it 'should validate operator' do
- operator_class.stub(:new).and_return(operator)
+ allow(operator_class).to receive(:new).and_return(operator)
- operator.should_receive(:valid!)
+ expect(operator).to receive(:valid!)
search_with_operator
end
it 'should add operator to search_with_operator_by_name' do
search_with_operator
- base_class.search_with_operator_by_name[operator.name].should == operator
+ expect(base_class.search_with_operator_by_name[operator.name]).to eq(operator)
end
end
context 'search_with_operator_by_name' do
subject(:search_with_operator_by_name) do
base_class.search_with_operator_by_name
end
it 'should default to empty Hash' do
- search_with_operator_by_name.should == {}
+ expect(search_with_operator_by_name).to eq({})
end
end
end
\ No newline at end of file