Consistently use expect syntax

This commit is contained in:
Markus Schirp 2014-01-19 21:42:21 +01:00
parent 8ff548f013
commit 399f352328
11 changed files with 27 additions and 29 deletions

View file

@ -13,21 +13,21 @@ describe Mutant, 'rspec integration' do
let(:base_cmd) { 'bundle exec mutant -I lib --require test_app --use rspec' }
specify 'it allows to kill mutations' do
Kernel.system("#{base_cmd} ::TestApp::Literal#string").should be(true)
expect(Kernel.system("#{base_cmd} ::TestApp::Literal#string")).to be(true)
end
specify 'it allows to exclude mutations' do
cli = "#{base_cmd} ::TestApp::Literal#string --ignore-subject ::TestApp::Literal#uncovered_string"
Kernel.system(cli).should be(true)
cli = "#{base_cmd} ::TestApp::Literal#string ::TestApp::Literal#uncovered_string --ignore-subject ::TestApp::Literal#uncovered_string"
expect(Kernel.system(cli)).to be(true)
end
specify 'fails to kill mutations when they are not covered' do
cli = "#{base_cmd} ::TestApp::Literal#uncovered_string"
Kernel.system(cli).should be(false)
expect(Kernel.system(cli)).to be(false)
end
specify 'fails when some mutations are not covered' do
cli = "#{base_cmd} ::TestApp::Literal"
Kernel.system(cli).should be(false)
expect(Kernel.system(cli)).to be(false)
end
end

View file

@ -5,6 +5,6 @@ require 'spec_helper'
describe Mutant, 'as a zombie' do
specify 'it allows to create zombie from mutant' do
Mutant::Zombifier.run('mutant')
Zombie.constants.should include(:Mutant)
expect(Zombie.constants).to include(:Mutant)
end
end

View file

@ -9,28 +9,28 @@ shared_examples_for 'a method matcher' do
let(:mutation_subject) { yields.first }
it 'should return one subject' do
yields.size.should be(1)
expect(yields.size).to be(1)
end
it_should_behave_like 'an #each method'
it 'should have correct method name' do
name.should eql(method_name)
expect(name).to eql(method_name)
end
it 'should have correct line number' do
(node.location.expression.line - base).should eql(method_line)
expect(node.location.expression.line - base).to eql(method_line)
end
it 'should have correct arity' do
arguments.children.length.should eql(method_arity)
expect(arguments.children.length).to eql(method_arity)
end
it 'should have correct scope in context' do
context.send(:scope).should eql(scope)
expect(context.scope).to eql(scope)
end
it 'should have the correct node type' do
node.type.should be(type)
expect(node.type).to be(type)
end
end

View file

@ -48,6 +48,6 @@ RSpec.configure do |config|
config.include(ParserHelper)
config.include(Mutant::NodeHelpers)
config.expect_with :rspec do |rspec|
rspec.syntax = [:expect, :should]
rspec.syntax = :expect
end
end

View file

@ -31,6 +31,6 @@ describe Mutant::Context::Scope, '#root' do
end
it 'should create correct source' do
generated_source.should eql(expected_source)
expect(generated_source).to eql(expected_source)
end
end

View file

@ -41,8 +41,8 @@ describe Mutant::Loader::Eval, '.call' do
it 'should set file and line correctly' do
subject
::SomeNamespace::Bar
expect(::SomeNamespace::Bar
.instance_method(:some_method)
.source_location.should eql([__FILE__, 3])
.source_location).to eql([__FILE__, 3])
end
end

View file

@ -32,7 +32,7 @@ describe Mutant::Matcher::Chain do
pending 'FIX RBX rspec? BUG HERE'
else
it 'yields the expected values' do
subject.to_a.should eql(object.to_a)
expect(subject.to_a).to eql(object.to_a)
end
end
end

View file

@ -58,7 +58,7 @@ describe Mutant::Matcher::Methods::Instance, '#each' do
it 'should yield expected subjects' do
subject
yields.should eql(subjects)
expect(yields).to eql(subjects)
end
it_should_behave_like 'an #each method'

View file

@ -52,7 +52,7 @@ describe Mutant::Matcher::Methods::Singleton, '#each' do
it 'should yield expected subjects' do
subject
yields.should eql(subjects)
expect(yields).to eql(subjects)
end
it_should_behave_like 'an #each method'

View file

@ -34,7 +34,7 @@ describe Mutant::Matcher::Namespace, '#each' do
pending 'FIX RBX rspec? BUG HERE'
else
it 'yields the expected values' do
subject.to_a.should eql(object.to_a)
expect(subject.to_a).to eql(object.to_a)
end
end
end

View file

@ -8,9 +8,7 @@ describe Mutant do
subject { object.singleton_subclass_instance(name, superclass, &block) }
before do
subject
end
before { subject }
let(:name) { 'Test' }
let(:block) { proc { def foo; end } }
@ -22,22 +20,22 @@ describe Mutant do
it 'sets expected name' do
name = generated.class.name
name.should eql("::#{self.name}")
name.should be_frozen
expect(name).to eql("::#{self.name}")
expect(name).to be_frozen
end
it 'stores instance of subclass' do
generated.should be_kind_of(superclass)
expect(generated).to be_kind_of(superclass)
end
it 'evaluates the context of proc inside subclass' do
generated.should respond_to(:foo)
expect(generated).to respond_to(:foo)
end
it 'generates nice #inspect' do
inspect = generated.inspect
inspect.should eql("::#{self.name}")
inspect.should be_frozen
expect(inspect).to eql("::#{self.name}")
expect(inspect).to be_frozen
end
end
end