spec/fuzzing/fuzzer_spec.rb in ronin-support-0.5.1 vs spec/fuzzing/fuzzer_spec.rb in ronin-support-0.5.2

- old
+ new

@@ -11,60 +11,60 @@ let(:substitutions) { ['bar'] } it "should accept Regexps" do fuzzer = subject.new(/foo/ => substitutions) - fuzzer.rules.should have_key(/foo/) + expect(fuzzer.rules).to have_key(/foo/) end context "when given Strings" do subject { described_class.new('foo' => substitutions) } it "should convert to Regexp" do - subject.rules.should have_key(/foo/) + expect(subject.rules).to have_key(/foo/) end end context "when given Symbols" do subject { described_class.new(:word => substitutions) } it "should lookup the Regexp constant" do - subject.rules.should have_key(Regexp::WORD) + expect(subject.rules).to have_key(Regexp::WORD) end end context "otherwise" do it "should raise a TypeError" do - lambda { + expect { subject.new(Object.new => substitutions) - }.should raise_error(TypeError) + }.to raise_error(TypeError) end end end context "substitutions" do let(:pattern) { /foo/ } it "should accept Enumerable values" do fuzzer = subject.new(pattern => ['bar']) - fuzzer.rules[pattern].should == ['bar'] + expect(fuzzer.rules[pattern]).to eq(['bar']) end context "when given Symbols" do subject { described_class.new(pattern => :bad_strings) } it "should map to an Enumerator for a Fuzzing method" do - subject.rules[pattern].should be_kind_of(Enumerable) + expect(subject.rules[pattern]).to be_kind_of(Enumerable) end end context "otherwise" do it "should raise a TypeError" do - lambda { + expect { subject.new(pattern => Object.new) - }.should raise_error(TypeError) + }.to raise_error(TypeError) end end end end @@ -72,38 +72,38 @@ let(:string) { "foo bar" } subject { described_class.new(/o/ => ['O', '0'], /a/ => ['A', '@']) } it "should apply each fuzzing rule individually" do - subject.each(string).to_a.should =~ [ + expect(subject.each(string).to_a).to match_array([ "fOo bar", "f0o bar", "foO bar", "fo0 bar", "foo bAr", "foo b@r" - ] + ]) end context "when mutations contain Integers" do subject { described_class.new(/o/ => [48]) } it "should convert them to characters" do - subject.each(string).to_a.should =~ [ + expect(subject.each(string).to_a).to match_array([ "f0o bar", "fo0 bar" - ] + ]) end end context "when mutations contain Procs" do subject { described_class.new(/o/ => [lambda { |str| str.upcase }]) } it "should call them with the matched String" do - subject.each(string).to_a.should =~ [ + expect(subject.each(string).to_a).to match_array([ "fOo bar", "foO bar" - ] + ]) end end end end