abstract_type 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@ group :metrics do
42
42
  end
43
43
 
44
44
  platforms :mri_19, :rbx do
45
- # gem 'mutant', '~> 0.2.16'
45
+ gem 'mutant', '~> 0.2.17'
46
46
  end
47
47
 
48
48
  platforms :mri_19 do
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.homepage = 'https://github.com/dkubb/abstract_type'
13
13
 
14
14
  gem.files = `git ls-files`.split($/)
15
- gem.test_files = `git ls-files -- {spec}/*`.split($/)
15
+ gem.test_files = `git ls-files -- spec/unit`.split($/)
16
16
  gem.extra_rdoc_files = %w[LICENSE README.md TODO]
17
17
 
18
18
  gem.add_runtime_dependency('backports', '~> 2.8.2')
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 13
3
- total_score: 25
3
+ total_score: 31
@@ -1,2 +1,2 @@
1
1
  ---
2
- threshold: 18.4
2
+ threshold: 19.8
@@ -1,5 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
+ require 'backports'
4
+
3
5
  # Module to allow class and methods to be abstract
4
6
  module AbstractType
5
7
 
@@ -91,7 +93,7 @@ module AbstractType
91
93
  # @api private
92
94
  def create_abstract_singleton_method(name)
93
95
  singleton_class.class_eval do
94
- define_method(name) do
96
+ define_method(name) do |*|
95
97
  raise NotImplementedError, "#{inspect}.#{name} is not implemented"
96
98
  end
97
99
  end
@@ -106,7 +108,7 @@ module AbstractType
106
108
  #
107
109
  # @api private
108
110
  def create_abstract_instance_method(name)
109
- define_method(name) do
111
+ define_method(name) do |*|
110
112
  raise NotImplementedError, "#{self.class.inspect}##{name} is not implemented"
111
113
  end
112
114
  end
@@ -3,6 +3,6 @@
3
3
  module AbstractType
4
4
 
5
5
  # Released gem version
6
- VERSION = '0.0.3'.freeze
6
+ VERSION = '0.0.4'.freeze
7
7
 
8
8
  end # module AbstractType
@@ -12,7 +12,6 @@ if ENV['COVERAGE'] == 'true'
12
12
  end
13
13
 
14
14
  require 'abstract_type'
15
- require 'backports'
16
15
  require 'rspec'
17
16
  require 'rspec/autorun' if RUBY_VERSION < '1.9'
18
17
 
@@ -24,6 +24,11 @@ describe AbstractType::ClassMethods, '#abstract_method' do
24
24
  to(true)
25
25
  end
26
26
 
27
+ it 'creates an abstract method with the expected arity' do
28
+ subject
29
+ object.instance_method(:some_method).arity.should be(-1)
30
+ end
31
+
27
32
  it 'creates a method that raises an exception' do
28
33
  subject
29
34
  expect { subclass.new.some_method }.to raise_error(NotImplementedError, 'Subclass#some_method is not implemented')
@@ -24,6 +24,11 @@ describe AbstractType::ClassMethods, '#abstract_singleton_method' do
24
24
  to(true)
25
25
  end
26
26
 
27
+ it 'creates an abstract method with the expected arity' do
28
+ subject
29
+ object.method(:some_method).arity.should be(-1)
30
+ end
31
+
27
32
  it 'creates a method that raises an exception' do
28
33
  subject
29
34
  expect { subclass.some_method }.to raise_error(NotImplementedError, 'Subclass.some_method is not implemented')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstract_type
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-16 00:00:00.000000000 Z
12
+ date: 2013-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: backports
@@ -124,5 +124,9 @@ rubygems_version: 1.8.25
124
124
  signing_key:
125
125
  specification_version: 3
126
126
  summary: Module to declare abstract classes and methods
127
- test_files: []
127
+ test_files:
128
+ - spec/unit/abstract_type/class_methods/abstract_method_spec.rb
129
+ - spec/unit/abstract_type/class_methods/abstract_singleton_method_spec.rb
130
+ - spec/unit/abstract_type/class_methods/included_spec.rb
131
+ - spec/unit/abstract_type/class_methods/new_spec.rb
128
132
  has_rdoc: