Add support for rspec-3.rc1

This commit is contained in:
Markus Schirp 2014-05-23 20:21:09 +00:00
parent 911f45337f
commit 7fa41111a7
11 changed files with 6 additions and 119 deletions

View file

@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
gem.extra_rdoc_files = %w[TODO LICENSE]
gem.add_runtime_dependency('mutant', "~> #{gem.version}")
gem.add_runtime_dependency('rspec-core', '>= 2.14.1', '<= 3.0.0.beta2')
gem.add_runtime_dependency('rspec-core', '>= 2.14.1', '<= 3.0.0.rc1')
gem.add_development_dependency('bundler', '~> 1.3', '>= 1.3.5')
end

View file

@ -48,7 +48,7 @@ describe 'rspec integration' do
it_behaves_like 'rspec integration'
end
context 'Rspec 3' do
context 'RSpec 3' do
let(:gemfile) { 'Gemfile.rspec3' }
it_behaves_like 'rspec integration'

View file

@ -1,5 +1,5 @@
source 'https://rubygems.org'
gem 'rspec', '~> 3.0.0.beta2'
gem 'rspec-core', '~> 3.0.0.beta2'
gem 'rspec', '~> 3.0.0.rc1'
gem 'rspec-core', '~> 3.0.0.rc1'
gem 'mutant', path: '../'
gem 'mutant-rspec', path: '../'

View file

@ -1,7 +0,0 @@
# encoding: utf-8
shared_examples_for 'a command method' do
it 'returns self' do
should equal(object)
end
end

View file

@ -1,15 +0,0 @@
# encoding: utf-8
shared_examples_for 'an #each method' do
it_should_behave_like 'a command method'
context 'with no block' do
subject { object.each }
it { should be_instance_of(to_enum.class) }
it 'yields the expected values' do
subject.to_a.should eql(object.to_a)
end
end
end

View file

@ -1,17 +0,0 @@
# encoding: utf-8
shared_examples_for 'a hash method' do
it_should_behave_like 'an idempotent method'
specification = proc do
should be_instance_of(Fixnum)
end
it 'is a fixnum' do
instance_eval(&specification)
end
it 'memoizes the hash code' do
subject.should eql(object.memoized(:hash))
end
end

View file

@ -1,7 +0,0 @@
# encoding: utf-8
shared_examples_for 'an idempotent method' do
it 'is idempotent' do
should equal(instance_eval(&self.class.subject))
end
end

View file

@ -1,9 +0,0 @@
# encoding: utf-8
shared_examples_for 'an invertible method' do
it_should_behave_like 'an idempotent method'
it 'is invertible' do
subject.inverse.should equal(object)
end
end

View file

@ -1,18 +0,0 @@
# encoding: utf-8
shared_examples_for 'a method filter parse result' do
before do
expected_class.stub(new: response)
end
let(:response) { double('Response') }
it { should be(response) }
it 'should initialize method filter with correct arguments' do
expected_class.should_receive(:new)
.with(TestApp::Literal, :string)
.and_return(response)
subject
end
end

View file

@ -1,40 +0,0 @@
# encoding: utf-8
shared_examples_for 'a method match' do
subject { Mutant::Matcher::Method.parse(pattern).to_a }
let(:values) { defaults.merge(expectation) }
let(:method_name) { values.fetch(:method_name) }
let(:method_line) { values.fetch(:method_line) }
let(:method_arity) { values.fetch(:method_arity) }
let(:scope) { values.fetch(:scope) }
let(:node_class) { values.fetch(:node_class) }
let(:node) { mutation_subject.node }
let(:context) { mutation_subject.context }
let(:mutation_subject) { subject.first }
it 'should return one subject' do
subject.size.should be(1)
end
it 'should have correct method name' do
name(node).should eql(method_name)
end
it 'should have correct line number' do
node.line.should eql(method_line)
end
it 'should have correct arity' do
arguments(node).required.length.should eql(method_arity)
end
it 'should have correct scope in context' do
context.send(:scope).should eql(scope)
end
it 'should have the correct node class' do
node.should be_a(node_class)
end
end

View file

@ -2,10 +2,10 @@
require 'spec_helper'
describe TestApp::Literal, '#string' do
RSpec.describe TestApp::Literal, '#string' do
subject { object.command(double) }
let(:object) { described_class.new }
it_should_behave_like 'a command method'
it { should be(object) }
end