Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change specs to use new expect syntax

  • Loading branch information...
commit 8e96f754b8ccdbb36f9b2c463039cbc8439c3bdd 1 parent 338e424
@dkubb authored
View
25 spec/spec_helper.rb
@@ -1,7 +1,30 @@
# encoding: utf-8
-require 'abstract_type'
+if ENV['COVERAGE'] == 'true'
+ require 'simplecov'
+ require 'coveralls'
+
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
+ SimpleCov::Formatter::HTMLFormatter,
+ Coveralls::SimpleCov::Formatter
+ ]
+
+ SimpleCov.start do
+ command_name 'spec:unit'
+
+ add_filter 'config'
+ add_filter 'spec'
+ add_filter 'vendor'
+
+ minimum_coverage 100
+ end
+end
+
require 'devtools/spec_helper'
+require 'abstract_type'
RSpec.configure do |config|
+ config.expect_with :rspec do |expect_with|
+ expect_with.syntax = :expect
+ end
end
View
13 spec/unit/abstract_type/class_methods/abstract_method_spec.rb
@@ -19,18 +19,21 @@
it { should equal(object) }
it 'creates an abstract method' do
- expect { subject }.to change { subclass.method_defined?(:some_method) }.
- from(false).
- to(true)
+ expect { subject }.to change { subclass.method_defined?(:some_method) }
+ .from(false)
+ .to(true)
end
it 'creates an abstract method with the expected arity' do
subject
- object.instance_method(:some_method).arity.should be(-1)
+ expect(object.instance_method(:some_method).arity).to be(-1)
end
it 'creates a method that raises an exception' do
subject
- expect { subclass.new.some_method }.to raise_error(NotImplementedError, 'Subclass#some_method is not implemented')
+ expect { subclass.new.some_method }.to raise_error(
+ NotImplementedError,
+ 'Subclass#some_method is not implemented'
+ )
end
end
View
13 spec/unit/abstract_type/class_methods/abstract_singleton_method_spec.rb
@@ -19,18 +19,21 @@
it { should equal(object) }
it 'creates an abstract method' do
- expect { subject }.to change { subclass.respond_to?(:some_method) }.
- from(false).
- to(true)
+ expect { subject }.to change { subclass.respond_to?(:some_method) }
+ .from(false)
+ .to(true)
end
it 'creates an abstract method with the expected arity' do
subject
- object.method(:some_method).arity.should be(-1)
+ expect(object.method(:some_method).arity).to be(-1)
end
it 'creates a method that raises an exception' do
subject
- expect { subclass.some_method }.to raise_error(NotImplementedError, 'Subclass.some_method is not implemented')
+ expect { subclass.some_method }.to raise_error(
+ NotImplementedError,
+ 'Subclass.some_method is not implemented'
+ )
end
end
View
9 spec/unit/abstract_type/class_methods/included_spec.rb
@@ -9,9 +9,9 @@
let(:klass) { Class.new }
it 'extends the klass' do
- klass.singleton_class.should_not include(described_class::ClassMethods)
+ expect(klass.singleton_class).to_not include(described_class::ClassMethods)
klass.send(:include, subject)
- klass.singleton_class.should include(described_class::ClassMethods)
+ expect(klass.singleton_class).to include(described_class::ClassMethods)
end
it 'delegates to the ancestor' do
@@ -19,8 +19,7 @@
subject.extend Module.new {
define_method(:included) { |_| included_ancestor = true }
}
- expect {
- klass.send(:include, subject)
- }.to change { included_ancestor }.from(false).to(true)
+ expect { klass.send(:include, subject) }
+ .to change { included_ancestor }.from(false).to(true)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.