Change deprecated mock() to double()
* Fix code alignment
This commit is contained in:
parent
506c778126
commit
2c6934f146
26 changed files with 93 additions and 90 deletions
|
@ -77,7 +77,7 @@ describe Mutant::CLI, '.new' do
|
|||
end
|
||||
|
||||
context 'with namespace matcher' do
|
||||
let(:arguments) { %w(--rspec-unit ::TestApp*) }
|
||||
let(:arguments) { %w(--rspec-unit ::TestApp*) }
|
||||
let(:expected_matcher) { Mutant::CLI::Classifier::Namespace::Recursive.new(Mutant::Cache.new, '::TestApp*') }
|
||||
|
||||
it_should_behave_like 'a cli parser'
|
||||
|
@ -94,7 +94,7 @@ describe Mutant::CLI, '.new' do
|
|||
end
|
||||
|
||||
let(:expected_matcher) { Mutant::CLI::Classifier::Method.new(Mutant::Cache.new, 'TestApp::Literal#float') }
|
||||
let(:expected_filter) { Mutant::Mutation::Filter::Whitelist.new(filters) }
|
||||
let(:expected_filter) { Mutant::Mutation::Filter::Whitelist.new(filters) }
|
||||
|
||||
it_should_behave_like 'a cli parser'
|
||||
end
|
||||
|
|
|
@ -3,12 +3,12 @@ require 'spec_helper'
|
|||
describe Mutant::CLI, '.run' do
|
||||
subject { object.run(argv) }
|
||||
|
||||
let(:object) { described_class }
|
||||
let(:argv) { mock('ARGV') }
|
||||
let(:attributes) { mock('Options') }
|
||||
let(:runner) { mock('Runner', :success? => success) }
|
||||
let(:config) { mock('Config') }
|
||||
let(:instance) { mock(described_class.name, :config => config) }
|
||||
let(:object) { described_class }
|
||||
let(:argv) { double('ARGV') }
|
||||
let(:attributes) { double('Options') }
|
||||
let(:runner) { double('Runner', :success? => success) }
|
||||
let(:config) { double('Config') }
|
||||
let(:instance) { double(described_class.name, :config => config) }
|
||||
|
||||
before do
|
||||
described_class.stub(:new => instance)
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe Mutant::CLI::Classifier, '.build' do
|
||||
subject { described_class.build(cache, input) }
|
||||
|
||||
let(:cache) { mock('Cache') }
|
||||
let(:cache) { double('Cache') }
|
||||
|
||||
this_spec = 'Mutant::CLI::Classifier.build'
|
||||
|
||||
|
@ -12,25 +12,25 @@ describe Mutant::CLI::Classifier, '.build' do
|
|||
should eql(expected_class.new(cache, expected_class::REGEXP.match(input)))
|
||||
end
|
||||
|
||||
let(:expected_class) { Mutant::CLI::Classifier::Method }
|
||||
let(:expected_class) { Mutant::CLI::Classifier::Method }
|
||||
end
|
||||
|
||||
context 'with explicit toplevel scope' do
|
||||
|
||||
let(:input) { '::TestApp::Literal#string' }
|
||||
let(:input) { '::TestApp::Literal#string' }
|
||||
|
||||
it_should_behave_like this_spec
|
||||
end
|
||||
|
||||
context 'with instance method notation' do
|
||||
|
||||
let(:input) { 'TestApp::Literal#string' }
|
||||
let(:input) { 'TestApp::Literal#string' }
|
||||
|
||||
it_should_behave_like this_spec
|
||||
end
|
||||
|
||||
context 'with singleton method notation' do
|
||||
let(:input) { 'TestApp::Literal.string' }
|
||||
let(:input) { 'TestApp::Literal.string' }
|
||||
|
||||
it_should_behave_like this_spec
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ describe Mutant::Context::Scope, '#root' do
|
|||
subject { object.root(node) }
|
||||
|
||||
let(:object) { described_class.new(TestApp::Literal, path) }
|
||||
let(:path) { mock('Path') }
|
||||
let(:path) { double('Path') }
|
||||
let(:node) { parse(':node') }
|
||||
|
||||
let(:scope) { subject.body }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe Mutant::Context::Scope, '#unqualified_name' do
|
||||
subject { object.unqualified_name }
|
||||
|
||||
let(:path) { mock('Path') }
|
||||
let(:path) { double('Path') }
|
||||
|
||||
context 'with top level constant name' do
|
||||
let(:object) { described_class.new(TestApp, path) }
|
||||
|
|
|
@ -7,16 +7,19 @@ describe Mutant::Differ, '.colorize_line' do
|
|||
|
||||
context 'line beginning with "+"' do
|
||||
let(:line) { '+line' }
|
||||
|
||||
it { should eql(Mutant::Color::GREEN.format(line)) }
|
||||
end
|
||||
|
||||
context 'line beginning with "-"' do
|
||||
let(:line) { '-line' }
|
||||
|
||||
it { should eql(Mutant::Color::RED.format(line)) }
|
||||
end
|
||||
|
||||
context 'line beginning in other char' do
|
||||
let(:line) { ' line' }
|
||||
|
||||
it { should eql(line) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ describe Mutant::Differ, '#diff' do
|
|||
end
|
||||
|
||||
context 'when there is a diff NOT at begin of hunk' do
|
||||
let(:old) { %w(foo bar) }
|
||||
let(:old) { %w(foo bar) }
|
||||
let(:new) { %w(foo baz bar) }
|
||||
|
||||
it { should eql("@@ -1,3 +1,4 @@\n foo\n+baz\n bar\n") }
|
||||
|
@ -24,7 +24,7 @@ describe Mutant::Differ, '#diff' do
|
|||
end
|
||||
|
||||
context 'when the diff has a long context at begin' do
|
||||
let(:old) { %w(foo bar baz boz a b c) }
|
||||
let(:old) { %w(foo bar baz boz a b c) }
|
||||
let(:new) { %w(foo bar baz boz a b c other) }
|
||||
|
||||
it { should eql("@@ -1,8 +1,9 @@\n foo\n bar\n baz\n boz\n a\n b\n c\n+other\n") }
|
||||
|
@ -34,7 +34,7 @@ describe Mutant::Differ, '#diff' do
|
|||
|
||||
context 'when the diff has a long context at end, deleting' do
|
||||
let(:old) { %w(other foo bar baz boz a b c) }
|
||||
let(:new) { %w(foo bar baz boz a b c) }
|
||||
let(:new) { %w(foo bar baz boz a b c) }
|
||||
|
||||
it { should eql("@@ -1,9 +1,8 @@\n-other\n foo\n bar\n baz\n boz\n a\n b\n c\n") }
|
||||
|
||||
|
@ -42,7 +42,7 @@ describe Mutant::Differ, '#diff' do
|
|||
end
|
||||
|
||||
context 'when the diff has a long context at end, inserting' do
|
||||
let(:old) { %w(foo bar baz boz a b c) }
|
||||
let(:old) { %w(foo bar baz boz a b c) }
|
||||
let(:new) { %w(other foo bar baz boz a b c) }
|
||||
|
||||
it { should eql("@@ -1,8 +1,9 @@\n+other\n foo\n bar\n baz\n boz\n a\n b\n c\n") }
|
||||
|
|
|
@ -4,10 +4,10 @@ describe Mutant::Killer::Rspec, '.new' do
|
|||
|
||||
subject { object.new(strategy, mutation) }
|
||||
|
||||
let(:strategy) { mock('Strategy', :spec_files => ['foo'], :error_stream => $stderr, :output_stream => $stdout) }
|
||||
let(:context) { mock('Context') }
|
||||
let(:mutation) { mock('Mutation', :subject => mutation_subject) }
|
||||
let(:mutation_subject) { mock('Mutation Subject') }
|
||||
let(:strategy) { double('Strategy', :spec_files => ['foo'], :error_stream => $stderr, :output_stream => $stdout) }
|
||||
let(:context) { double('Context') }
|
||||
let(:mutation) { double('Mutation', :subject => mutation_subject) }
|
||||
let(:mutation_subject) { double('Mutation Subject') }
|
||||
|
||||
let(:object) { described_class }
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ require 'spec_helper'
|
|||
describe Mutant::Killer, '#success?' do
|
||||
subject { object.success? }
|
||||
|
||||
let(:object) { class_under_test.new(strategy, mutation) }
|
||||
let(:strategy) { mock('Strategy') }
|
||||
let(:mutation) { mock('Mutation', :success? => kill_state) }
|
||||
let(:kill_state) { mock('Kill State') }
|
||||
let(:object) { class_under_test.new(strategy, mutation) }
|
||||
let(:strategy) { double('Strategy') }
|
||||
let(:mutation) { double('Mutation', :success? => kill_state) }
|
||||
let(:kill_state) { double('Kill State') }
|
||||
|
||||
before do
|
||||
kill_state.stub(:freeze => kill_state, :dup => kill_state)
|
||||
|
|
|
@ -4,10 +4,10 @@ describe Mutant::Loader::Eval, '.run' do
|
|||
|
||||
subject { object.run(node, mutation_subject) }
|
||||
|
||||
let(:object) { described_class }
|
||||
let(:mutation_subject) { mock('Subject', :source_path => path, :source_line => line) }
|
||||
let(:path) { 'test.rb' }
|
||||
let(:line) { 1 }
|
||||
let(:object) { described_class }
|
||||
let(:mutation_subject) { double('Subject', :source_path => path, :source_line => line) }
|
||||
let(:path) { 'test.rb' }
|
||||
let(:line) { 1 }
|
||||
|
||||
let(:source) do
|
||||
<<-RUBY
|
||||
|
|
|
@ -7,11 +7,11 @@ describe Mutant::Matcher::Chain, '#each' do
|
|||
|
||||
let(:matchers) { [matcher_a, matcher_b] }
|
||||
|
||||
let(:matcher_a) { mock('Matcher A') }
|
||||
let(:matcher_b) { mock('Matcher B') }
|
||||
let(:matcher_a) { double('Matcher A') }
|
||||
let(:matcher_b) { double('Matcher B') }
|
||||
|
||||
let(:subject_a) { mock('Subject A') }
|
||||
let(:subject_b) { mock('Subject B') }
|
||||
let(:subject_a) { double('Subject A') }
|
||||
let(:subject_b) { double('Subject B') }
|
||||
|
||||
before do
|
||||
matcher_a.stub(:each).and_yield(subject_a).and_return(matcher_a)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe Mutant::Matcher::Chain, '#matchers' do
|
|||
subject { object.matchers }
|
||||
|
||||
let(:object) { described_class.new(matchers) }
|
||||
let(:matchers) { mock('Matchers') }
|
||||
let(:matchers) { double('Matchers') }
|
||||
|
||||
it { should be(matchers) }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ describe Mutant::Matcher::Method::Instance, '.build' do
|
|||
|
||||
subject { object.build(cache, scope, method) }
|
||||
|
||||
let(:cache) { mock }
|
||||
let(:cache) { double }
|
||||
|
||||
let(:scope) do
|
||||
Class.new do
|
||||
|
|
|
@ -38,9 +38,9 @@ describe Mutant::Matcher::Methods::Instance, '#each' do
|
|||
|
||||
end
|
||||
|
||||
let(:subject_a) { mock('Subject A') }
|
||||
let(:subject_b) { mock('Subject B') }
|
||||
let(:subject_c) { mock('Subject C') }
|
||||
let(:subject_a) { double('Subject A') }
|
||||
let(:subject_b) { double('Subject B') }
|
||||
let(:subject_c) { double('Subject C') }
|
||||
|
||||
let(:subjects) { [subject_a, subject_b, subject_c] }
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ describe Mutant::Matcher::Methods::Singleton, '#each' do
|
|||
|
||||
end
|
||||
|
||||
let(:subject_a) { mock('Subject A') }
|
||||
let(:subject_b) { mock('Subject B') }
|
||||
let(:subject_c) { mock('Subject C') }
|
||||
let(:subject_a) { double('Subject A') }
|
||||
let(:subject_b) { double('Subject B') }
|
||||
let(:subject_c) { double('Subject C') }
|
||||
|
||||
let(:subjects) { [subject_a, subject_b, subject_c] }
|
||||
|
||||
|
|
|
@ -3,15 +3,15 @@ require 'spec_helper'
|
|||
describe Mutant::Matcher::Namespace, '#each' do
|
||||
subject { object.each { |item| yields << item } }
|
||||
|
||||
let(:yields) { [] }
|
||||
let(:yields) { [] }
|
||||
let(:object) { described_class.new(cache, TestApp::Literal) }
|
||||
|
||||
let(:cache) { Mutant::Cache.new }
|
||||
|
||||
let(:singleton_a) { mock('SingletonA', :name => 'TestApp::Literal') }
|
||||
let(:singleton_b) { mock('SingletonB', :name => 'TestApp::Foo') }
|
||||
let(:subject_a) { mock('SubjectA') }
|
||||
let(:subject_b) { mock('SubjectB') }
|
||||
let(:singleton_a) { double('SingletonA', :name => 'TestApp::Literal') }
|
||||
let(:singleton_b) { double('SingletonB', :name => 'TestApp::Foo') }
|
||||
let(:subject_a) { double('SubjectA') }
|
||||
let(:subject_b) { double('SubjectB') }
|
||||
|
||||
before do
|
||||
Mutant::Matcher::Methods::Singleton.stub(:each).with(cache, singleton_a).and_yield(subject_a)
|
||||
|
|
|
@ -6,7 +6,7 @@ describe Mutant::Runner::Config, '#subjects' do
|
|||
subject { object.subjects }
|
||||
|
||||
let(:config) do
|
||||
mock(
|
||||
double(
|
||||
'Config',
|
||||
:subjects => [mutation_subject],
|
||||
:strategy => strategy,
|
||||
|
@ -14,10 +14,10 @@ describe Mutant::Runner::Config, '#subjects' do
|
|||
)
|
||||
end
|
||||
|
||||
let(:reporter) { mock('Reporter') }
|
||||
let(:strategy) { mock('Strategy') }
|
||||
let(:mutation_subject) { mock('Mutation subject') }
|
||||
let(:subject_runner) { mock('Subject runner') }
|
||||
let(:reporter) { double('Reporter') }
|
||||
let(:strategy) { double('Strategy') }
|
||||
let(:mutation_subject) { double('Mutation subject') }
|
||||
let(:subject_runner) { double('Subject runner') }
|
||||
|
||||
class DummySubjectRunner
|
||||
include Concord::Public.new(:config, :mutation)
|
||||
|
|
|
@ -6,7 +6,7 @@ describe Mutant::Runner::Config, '#success?' do
|
|||
let(:object) { described_class.run(config) }
|
||||
|
||||
let(:config) do
|
||||
mock(
|
||||
double(
|
||||
'Config',
|
||||
:reporter => reporter,
|
||||
:strategy => strategy,
|
||||
|
@ -14,11 +14,11 @@ describe Mutant::Runner::Config, '#success?' do
|
|||
)
|
||||
end
|
||||
|
||||
let(:reporter) { mock('Reporter') }
|
||||
let(:strategy) { mock('Strategy') }
|
||||
let(:subjects) { [subject_a, subject_b] }
|
||||
let(:subject_a) { mock('Subject A', :fails? => false) }
|
||||
let(:subject_b) { mock('Subject B', :fails? => false) }
|
||||
let(:reporter) { double('Reporter') }
|
||||
let(:strategy) { double('Strategy') }
|
||||
let(:subjects) { [subject_a, subject_b] }
|
||||
let(:subject_a) { double('Subject A', :fails? => false) }
|
||||
let(:subject_b) { double('Subject B', :fails? => false) }
|
||||
|
||||
class DummySubjectRunner
|
||||
include Concord::Public.new(:config, :subject)
|
||||
|
|
|
@ -5,7 +5,7 @@ describe Mutant::Runner, '#failed?' do
|
|||
|
||||
let(:object) { class_under_test.run(config) }
|
||||
|
||||
let(:config) { mock('Config') }
|
||||
let(:config) { double('Config') }
|
||||
let(:class_under_test) do
|
||||
success = self.success
|
||||
|
||||
|
|
|
@ -4,17 +4,17 @@ describe Mutant::Runner::Mutation, '#killer' do
|
|||
let(:object) { described_class.run(config, mutation) }
|
||||
|
||||
let(:config) do
|
||||
mock(
|
||||
double(
|
||||
'Config',
|
||||
:reporter => reporter,
|
||||
:strategy => strategy
|
||||
)
|
||||
end
|
||||
|
||||
let(:reporter) { mock('Reporter') }
|
||||
let(:mutation) { mock('Mutation') }
|
||||
let(:strategy) { mock('Strategy') }
|
||||
let(:killer) { mock('Killer') }
|
||||
let(:reporter) { double('Reporter') }
|
||||
let(:mutation) { double('Mutation') }
|
||||
let(:strategy) { double('Strategy') }
|
||||
let(:killer) { double('Killer') }
|
||||
|
||||
subject { object.killer }
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ describe Mutant::Runner::Subject, '#success?' do
|
|||
|
||||
let(:object) { described_class.run(config, mutation_subject) }
|
||||
|
||||
let(:reporter) { mock('Reporter') }
|
||||
let(:mutation_subject) { mock('Subject', :map => mutations) }
|
||||
let(:config) { mock('Config', :reporter => reporter) }
|
||||
let(:mutation_a) { mock('Mutation A', :failed? => false) }
|
||||
let(:mutation_b) { mock('Mutation B', :failed? => false) }
|
||||
let(:mutations) { [mutation_a, mutation_b] }
|
||||
let(:reporter) { double('Reporter') }
|
||||
let(:mutation_subject) { double('Subject', :map => mutations) }
|
||||
let(:config) { double('Config', :reporter => reporter) }
|
||||
let(:mutation_a) { double('Mutation A', :failed? => false) }
|
||||
let(:mutation_b) { double('Mutation B', :failed? => false) }
|
||||
let(:mutations) { [mutation_a, mutation_b] }
|
||||
|
||||
before do
|
||||
reporter.stub(:report => reporter)
|
||||
|
|
|
@ -3,11 +3,11 @@ require 'spec_helper'
|
|||
describe Mutant::Strategy::Rspec::DM2::Lookup::Method::Instance, '#spec_files' do
|
||||
subject { object.spec_files }
|
||||
|
||||
let(:object) { described_class.new(mutation_subject) }
|
||||
let(:mutation_subject) { mock('Subject', :name => method_name, :public? => is_public, :context => context) }
|
||||
let(:context) { mock('Context', :name => 'Foo') }
|
||||
let(:method_name) { :bar }
|
||||
let(:files) { 'Files'.freeze }
|
||||
let(:object) { described_class.new(mutation_subject) }
|
||||
let(:mutation_subject) { double('Subject', :name => method_name, :public? => is_public, :context => context) }
|
||||
let(:context) { double('Context', :name => 'Foo') }
|
||||
let(:method_name) { :bar }
|
||||
let(:files) { 'Files'.freeze }
|
||||
|
||||
this_example_group = 'Mutant::Strategy::Rspec::DM2::Lookup::Method::Instance#spec_files'
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ describe Mutant::Strategy::Rspec::DM2::Lookup::Method::Singleton, '#spec_files'
|
|||
|
||||
subject { object.spec_files }
|
||||
|
||||
let(:object) { described_class.new(mutation_subject) }
|
||||
let(:mutation_subject) { mock('Subject', :name => method_name, :public? => is_public, :context => context) }
|
||||
let(:method_name) { :bar }
|
||||
let(:files) { 'Files'.freeze }
|
||||
let(:context) { mock('Context', :name => 'Foo') }
|
||||
let(:object) { described_class.new(mutation_subject) }
|
||||
let(:mutation_subject) { double('Subject', :name => method_name, :public? => is_public, :context => context) }
|
||||
let(:method_name) { :bar }
|
||||
let(:files) { 'Files'.freeze }
|
||||
let(:context) { double('Context', :name => 'Foo') }
|
||||
|
||||
this_example_group = 'Mutant::Strategy::Rspec::DM2::Lookup::Method::Singleton#spec_files'
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ describe Mutant::Subject, '#context' do
|
|||
end
|
||||
|
||||
let(:object) { class_under_test.new(context, node) }
|
||||
let(:node) { mock('Node') }
|
||||
let(:context) { mock('Context') }
|
||||
let(:node) { double('Node') }
|
||||
let(:context) { double('Context') }
|
||||
|
||||
it { should be(context) }
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ describe Mutant::Subject, '#each' do
|
|||
|
||||
let(:object) { class_under_test.new(context, node) }
|
||||
let(:yields) { [] }
|
||||
let(:node) { mock('Node') }
|
||||
let(:context) { mock('Context') }
|
||||
let(:mutant) { mock('Mutant') }
|
||||
let(:mutation_a) { mock('Mutation A') }
|
||||
let(:mutation_b) { mock('Mutation B') }
|
||||
let(:node) { double('Node') }
|
||||
let(:context) { double('Context') }
|
||||
let(:mutant) { double('Mutant') }
|
||||
let(:mutation_a) { double('Mutation A') }
|
||||
let(:mutation_b) { double('Mutation B') }
|
||||
|
||||
it_should_behave_like 'an #each method'
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ describe Mutant::Subject, '#node' do
|
|||
end
|
||||
|
||||
let(:object) { class_under_test.new(context, node) }
|
||||
let(:node) { mock('Node') }
|
||||
let(:context) { mock('Context') }
|
||||
let(:node) { double('Node') }
|
||||
let(:context) { double('Context') }
|
||||
|
||||
it { should be(node) }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue