motion_abstract_type 0.0.6 → 0.0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGQ2Nzk0MmMxNjc0OGYwYTRiNjgxYzI1ZjBkYzk0N2ZmOGQ0Y2ZiMw==
4
+ Yzk5NWM1MjU4MDNjNjk0ZWVmODZjOWIxMGY4OWMyZTk2MzY0YWIzZg==
5
5
  data.tar.gz: !binary |-
6
- Yzk0NGMxZDZkMDAwNTI2NzhmZGQ1ZDZlNDQ3OTcwYzA0ZWIxNzE2Ng==
6
+ M2JmNjM3ZWI3MWU2MmJiMGVmOWJhYzU4MWIwZGZjZjkxYzRhZmU5Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2RlYjExMzY4YTQxOThjZTUwNWYxYTRhYjhiNTQ5ZjdhMTkzYmNjMGYwMGZm
10
- NjI1NmQyODdhOWY0YTJlYWE3OWYzYmY2MThkYTQ0YTY4NDg1MjYxODU1ODI3
11
- NWU2MmY5ODBiMmJjYTYwYzdjNzJiMGE5ODM1NWJjYjAyZjQ5Zjc=
9
+ NTYxMTcxM2M5ZTViMDMyYTFlMzU5MjRjMDhhNmZiOTE2MTk4NDI1NzcwYjg1
10
+ MGIwNDk1ODY1MzQxMDczNzZkZjgwNDZiMjQ4NmE1Zjg2NThhM2FhZmE0M2Vl
11
+ MjdhOWYxN2QzNzUwMTAzNmQ1ZTc3MDNjOTY1ZjllYTU2OTljYjQ=
12
12
  data.tar.gz: !binary |-
13
- OThmMGVhMzA1MjZkNTFmYzMwY2JmZjMzYWYxZmRhMDE2ZWZkN2YyNGFjZTkz
14
- NjA3NTkzOTUxM2ZmZTUyNmY2MDdmNjU3ZDMwMjM2YzlmMTIzNzY2NDEyNDli
15
- YWQ1MDQxMzUyYWNmZDE2NWMwZjI3YWVkNDgwNjM2NjRjZDdiMjg=
13
+ MTc1ZDEwYTUwMjY5ZDVhYTFhZTI3NzNmOTRkZjdkZjk0MmY3MmZkMjRmNDMw
14
+ NTY3MmFlOGM0NmEzODc5NjAxNmZmZjVjYTM2NjM0MTYyZWIwNTVlZTZjYWI5
15
+ MzliM2UzN2NjOTlkMzczZmVmMGViNTgxNzY3Y2ZhNzNjMDFiZjQ=
data/README.md CHANGED
@@ -1,22 +1,22 @@
1
- motion_abstract_type
2
- ==============
1
+ # motion_abstract_type
3
2
 
4
- A RubyMotion port of [dkubb's](https://github.com/dkubb) [abstract_type](https://github.com/dkubb/abstract_type)
3
+ A RubyMotion port of [dkubb's](https://github.com/dkubb) [abstract_type](https://github.com/dkubb/abstract_type) library.
5
4
 
6
- Installation
7
- ------------
5
+ ## Installation
8
6
 
9
- With Rubygems:
7
+ Add this line to your application's Gemfile:
10
8
 
11
- ```bash
12
- $ gem install motion_abstract_type
13
- $ irb -rubygems
14
- >> require 'motion_abstract_type'
15
- => true
16
- ```
9
+ gem 'motion_abstract_type'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install motion_abstract_type
17
18
 
18
- Examples
19
- --------
19
+ ## Usage
20
20
 
21
21
  ``` ruby
22
22
  class Foo
@@ -37,21 +37,12 @@ class Baz < Foo; end
37
37
 
38
38
  object = Baz.new
39
39
  object.bar # raises NotImplementedError: Baz#bar is not implemented
40
-
41
40
  ```
42
41
 
43
- Credits
44
- -------
45
-
46
- * Dan Kubb ([dkubb](https://github.com/dkubb))
47
- * Markus Schirp ([mbj](https://github.com/mbj))
48
-
49
- Contributing
50
- ------------
51
-
52
- See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
53
-
54
- Copyright
55
- ---------
42
+ ## Contributing
56
43
 
57
- Copyright &copy; 2009-2013 Dan Kubb. See LICENSE for details.
44
+ 1. Fork it
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create new Pull Request
@@ -2,8 +2,9 @@ unless defined?(Motion::Project::Config)
2
2
  raise "This file must be required within a RubyMotion project Rakefile."
3
3
  end
4
4
 
5
+ require 'motion-require'
6
+ Motion::Require.all(Dir.glob(File.expand_path('../project/**/*.rb', __FILE__)))
7
+
5
8
  Motion::Project::App.setup do |app|
6
- Dir.glob(File.join(File.dirname(__FILE__), 'motion_abstract_type/**/*.rb')).each do |file|
7
- app.files.unshift(file)
8
- end
9
+ # configuration
9
10
  end
@@ -3,6 +3,6 @@
3
3
  module AbstractType
4
4
 
5
5
  # Gem version
6
- VERSION = '0.0.6'.freeze
6
+ VERSION = '0.0.6.1'.freeze
7
7
 
8
8
  end # module AbstractType
metadata CHANGED
@@ -1,10 +1,9 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion_abstract_type
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.6.1
5
5
  platform: ruby
6
6
  authors:
7
- - Dan Kubb
8
7
  - Ryan Closner
9
8
  autorequire:
10
9
  bindir: bin
@@ -12,66 +11,47 @@ cert_chain: []
12
11
  date: 2013-08-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: bundler
14
+ name: motion-require
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - ~>
17
+ - - ! '>='
19
18
  - !ruby/object:Gem::Version
20
- version: '1.3'
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
21
24
  - - ! '>='
22
25
  - !ruby/object:Gem::Version
23
- version: 1.3.5
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
24
34
  type: :development
25
35
  prerelease: false
26
36
  version_requirements: !ruby/object:Gem::Requirement
27
37
  requirements:
28
- - - ~>
29
- - !ruby/object:Gem::Version
30
- version: '1.3'
31
38
  - - ! '>='
32
39
  - !ruby/object:Gem::Version
33
- version: 1.3.5
34
- description: Module to declare abstract classes and methods for RubyMotion
40
+ version: '0'
41
+ description: A RubyMotion port of abstract_type
35
42
  email:
36
- - dan.kubb@gmail.com
37
43
  - ryan@ryanclosner.com
38
44
  executables: []
39
45
  extensions: []
40
- extra_rdoc_files:
41
- - LICENSE
42
- - README.md
43
- - TODO
46
+ extra_rdoc_files: []
44
47
  files:
45
- - .gitignore
46
- - .rspec
47
- - .ruby-gemset
48
- - .travis.yml
49
- - CONTRIBUTING.md
50
- - Gemfile
51
- - Gemfile.devtools
52
- - Guardfile
53
- - LICENSE
54
48
  - README.md
55
- - Rakefile
56
- - TODO
57
- - config/flay.yml
58
- - config/flog.yml
59
- - config/mutant.yml
60
- - config/reek.yml
61
- - config/roodi.yml
62
- - config/yardstick.yml
63
49
  - lib/motion_abstract_type.rb
64
- - lib/motion_abstract_type/abstract_type.rb
65
- - lib/motion_abstract_type/version.rb
66
- - motion_abstract_type.gemspec
67
- - spec/spec_helper.rb
68
- - spec/support/config_alias.rb
69
- - spec/unit/abstract_type/class_methods/abstract_method_spec.rb
70
- - spec/unit/abstract_type/class_methods/abstract_singleton_method_spec.rb
71
- - spec/unit/abstract_type/class_methods/included_spec.rb
72
- - spec/unit/abstract_type/class_methods/new_spec.rb
73
- homepage: https://github.com/rclosner/motion_abstract_type
74
- licenses: []
50
+ - lib/project/abstract_type.rb
51
+ - lib/project/version.rb
52
+ homepage: http://github.com/rclosner/motion_abstract_type
53
+ licenses:
54
+ - ''
75
55
  metadata: {}
76
56
  post_install_message:
77
57
  rdoc_options: []
@@ -92,10 +72,6 @@ rubyforge_project:
92
72
  rubygems_version: 2.0.6
93
73
  signing_key:
94
74
  specification_version: 4
95
- summary: Module to declare abstract classes and methods for RubyMotion
96
- test_files:
97
- - spec/unit/abstract_type/class_methods/abstract_method_spec.rb
98
- - spec/unit/abstract_type/class_methods/abstract_singleton_method_spec.rb
99
- - spec/unit/abstract_type/class_methods/included_spec.rb
100
- - spec/unit/abstract_type/class_methods/new_spec.rb
75
+ summary: A RubyMotion port of abstract_type
76
+ test_files: []
101
77
  has_rdoc:
data/.gitignore DELETED
@@ -1,37 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## Rubinius
17
- *.rbc
18
- .rbx
19
-
20
- ## PROJECT::GENERAL
21
- *.gem
22
- coverage
23
- profiling
24
- turbulence
25
- rdoc
26
- pkg
27
- tmp
28
- doc
29
- log
30
- .yardoc
31
- measurements
32
-
33
- ## BUNDLER
34
- .bundle
35
- Gemfile.lock
36
-
37
- ## PROJECT::SPECIFIC
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --color
2
- --format progress
3
- --profile
4
- --order random
@@ -1 +0,0 @@
1
- abstract_type
@@ -1,30 +0,0 @@
1
- language: ruby
2
- before_install: gem install bundler
3
- bundler_args: --without yard guard metrics benchmarks
4
- script: "bundle exec rake ci"
5
- rvm:
6
- - 1.9.2
7
- - 1.9.3
8
- - 2.0.0
9
- - rbx-19mode
10
- - jruby-19mode
11
- - ruby-head
12
- notifications:
13
- irc:
14
- channels:
15
- - irc.freenode.org#rom-rb
16
- on_success: never
17
- on_failure: change
18
- email:
19
- recipients:
20
- - dan.kubb@gmail.com
21
- on_success: never
22
- on_failure: change
23
- matrix:
24
- allow_failures:
25
- - rvm: ruby-head
26
- include:
27
- - rvm: jruby-19mode
28
- env: JRUBY_OPTS="$JRUBY_OPTS --debug"
29
- - rvm: jruby-head
30
- env: JRUBY_OPTS="$JRUBY_OPTS --debug"
@@ -1,11 +0,0 @@
1
- Contributing
2
- ------------
3
-
4
- * If you want your code merged into the mainline, please discuss the proposed changes with me before doing any work on it. This library is still in early development, and the direction it is going may not always be clear. Some features may not be appropriate yet, may need to be deferred until later when the foundation for them is laid, or may be more applicable in a plugin.
5
- * Fork the project.
6
- * Make your feature addition or bug fix.
7
- * Follow this [style guide](https://github.com/dkubb/styleguide).
8
- * Add specs for it. This is important so I don't break it in a future version unintentionally. Tests must cover all branches within the code, and code must be fully covered.
9
- * Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
10
- * Run "rake ci". This must pass and not show any regressions in the metrics for the code to be merged.
11
- * Send me a pull request. Bonus points for topic branches.
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- # encoding: utf-8
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- gem 'devtools', :git => 'https://github.com/rom-rb/devtools.git'
8
- eval File.read('Gemfile.devtools')
@@ -1,59 +0,0 @@
1
- # encoding: utf-8
2
-
3
- group :development do
4
- gem 'rake', '~> 10.1.0'
5
- gem 'rspec', '~> 2.13.0'
6
- gem 'yard', '~> 0.8.6.1'
7
- end
8
-
9
- group :yard do
10
- gem 'kramdown', '~> 1.0.1'
11
- end
12
-
13
- group :guard do
14
- gem 'guard', '~> 1.8.1'
15
- gem 'guard-bundler', '~> 1.0.0'
16
- gem 'guard-rspec', '~> 3.0.2'
17
-
18
- # file system change event handling
19
- gem 'listen', '~> 1.2.2'
20
- gem 'rb-fchange', '~> 0.0.6', :require => false
21
- gem 'rb-fsevent', '~> 0.9.3', :require => false
22
- gem 'rb-inotify', '~> 0.9.0', :require => false
23
-
24
- # notification handling
25
- gem 'libnotify', '~> 0.8.0', :require => false
26
- gem 'rb-notifu', '~> 0.0.4', :require => false
27
- gem 'terminal-notifier-guard', '~> 1.5.3', :require => false
28
- end
29
-
30
- group :metrics do
31
- gem 'coveralls', '~> 0.6.7'
32
- gem 'flay', '~> 2.3.0'
33
- gem 'flog', '~> 4.1.0'
34
- gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git'
35
- gem 'simplecov', '~> 0.7.1'
36
- gem 'yardstick', '~> 0.9.6'
37
-
38
- platforms :ruby_19 do
39
- gem 'yard-spellcheck', '~> 0.1.5'
40
- end
41
-
42
- platforms :ruby_19, :ruby_20 do
43
- gem 'mutant', '~> 0.3.0.beta6'
44
- end
45
-
46
- platforms :rbx do
47
- gem 'pelusa', '~> 0.2.2'
48
- end
49
- end
50
-
51
- group :benchmarks do
52
- gem 'rbench', '~> 0.2.3'
53
- end
54
-
55
- platform :jruby do
56
- group :jruby do
57
- gem 'jruby-openssl', '~> 0.8.5'
58
- end
59
- end
data/Guardfile DELETED
@@ -1,18 +0,0 @@
1
- # encoding: utf-8
2
-
3
- guard :bundler do
4
- watch('Gemfile')
5
- end
6
-
7
- guard :rspec do
8
- # run all specs if the spec_helper or supporting files files are modified
9
- watch('spec/spec_helper.rb') { 'spec' }
10
- watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec' }
11
-
12
- # run unit specs if associated lib code is modified
13
- watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}"] }
14
- watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' }
15
-
16
- # run a spec if it is modified
17
- watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
18
- end
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- Copyright (c) 2009-2013 Dan Kubb
2
- Copyright (c) 2012 Markus Schirp
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining
5
- a copy of this software and associated documentation files (the
6
- "Software"), to deal in the Software without restriction, including
7
- without limitation the rights to use, copy, modify, merge, publish,
8
- distribute, sublicense, and/or sell copies of the Software, and to
9
- permit persons to whom the Software is furnished to do so, subject to
10
- the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,5 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'devtools'
4
-
5
- Devtools.init_rake_tasks
data/TODO DELETED
File without changes
@@ -1,3 +0,0 @@
1
- ---
2
- threshold: 9
3
- total_score: 17
@@ -1,2 +0,0 @@
1
- ---
2
- threshold: 9.0
@@ -1,3 +0,0 @@
1
- ---
2
- name: abstract_type
3
- namespace: AbstractType
@@ -1,93 +0,0 @@
1
- ---
2
- UncommunicativeParameterName:
3
- accept: []
4
- exclude: []
5
- enabled: true
6
- reject:
7
- - !ruby/regexp /^.$/
8
- - !ruby/regexp /[0-9]$/
9
- - !ruby/regexp /[A-Z]/
10
- TooManyMethods:
11
- max_methods: 10
12
- exclude: []
13
- enabled: true
14
- max_instance_variables: 2
15
- UncommunicativeMethodName:
16
- accept: []
17
- exclude: []
18
- enabled: true
19
- reject:
20
- - !ruby/regexp /^[a-z]$/
21
- - !ruby/regexp /[0-9]$/
22
- - !ruby/regexp /[A-Z]/
23
- LongParameterList:
24
- max_params: 2 # TODO: decrease max_params to 2
25
- exclude: []
26
- enabled: true
27
- overrides: {}
28
- FeatureEnvy:
29
- exclude: []
30
- enabled: true
31
- ClassVariable:
32
- exclude: []
33
- enabled: true
34
- BooleanParameter:
35
- exclude: []
36
- enabled: true
37
- IrresponsibleModule:
38
- exclude: []
39
- enabled: true
40
- UncommunicativeModuleName:
41
- accept: []
42
- exclude: []
43
- enabled: true
44
- reject:
45
- - !ruby/regexp /^.$/
46
- - !ruby/regexp /[0-9]$/
47
- NestedIterators:
48
- ignore_iterators: []
49
- exclude: [
50
- 'AbstractType::ClassMethods#create_abstract_singleton_method'
51
- ]
52
- enabled: true
53
- max_allowed_nesting: 1
54
- TooManyStatements:
55
- max_statements: 7 # TODO: decrease max_statements to 5 or less
56
- exclude: []
57
- enabled: true
58
- DuplicateMethodCall:
59
- allow_calls: []
60
- exclude: []
61
- enabled: true
62
- max_calls: 1
63
- UtilityFunction:
64
- max_helper_calls: 1
65
- exclude: []
66
- enabled: true
67
- Attribute:
68
- exclude: []
69
- enabled: false
70
- UncommunicativeVariableName:
71
- accept: []
72
- exclude: []
73
- enabled: true
74
- reject:
75
- - !ruby/regexp /^.$/
76
- - !ruby/regexp /[0-9]$/
77
- - !ruby/regexp /[A-Z]/
78
- RepeatedConditional:
79
- exclude: []
80
- enabled: true
81
- max_ifs: 1
82
- DataClump:
83
- exclude: []
84
- enabled: true
85
- max_copies: 1
86
- min_clump_size: 3
87
- ControlParameter:
88
- exclude: []
89
- enabled: true
90
- LongYieldList:
91
- max_params: 1
92
- exclude: []
93
- enabled: true
@@ -1,18 +0,0 @@
1
- ---
2
- AbcMetricMethodCheck: { score: 10.3 }
3
- AssignmentInConditionalCheck: { }
4
- CaseMissingElseCheck: { }
5
- ClassLineCountCheck: { line_count: 293 }
6
- ClassNameCheck: { pattern: !ruby/regexp '/\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/' }
7
- ClassVariableCheck: { }
8
- CyclomaticComplexityBlockCheck: { complexity: 2 }
9
- CyclomaticComplexityMethodCheck: { complexity: 4 }
10
- EmptyRescueBodyCheck: { }
11
- ForLoopCheck: { }
12
- # TODO: decrease line_count to 5 to 10
13
- MethodLineCountCheck: { line_count: 14 }
14
- MethodNameCheck: { pattern: !ruby/regexp '/\A(?:[a-z\d](?:_?[a-z\d])+[?!=]?|\[\]=?|==|<=>|[+*&|-])\z/' }
15
- ModuleLineCountCheck: { line_count: 295 }
16
- ModuleNameCheck: { pattern: !ruby/regexp '/\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/' }
17
- # TODO: decrease parameter_count to 2 or less
18
- ParameterNumberCheck: { parameter_count: 3 }
@@ -1,2 +0,0 @@
1
- ---
2
- threshold: 100
@@ -1,19 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.expand_path('../lib/motion_abstract_type/version', __FILE__)
4
-
5
- Gem::Specification.new do |gem|
6
- gem.name = 'motion_abstract_type'
7
- gem.version = AbstractType::VERSION.dup
8
- gem.authors = [ 'Dan Kubb', 'Ryan Closner' ]
9
- gem.email = %w[ dan.kubb@gmail.com ryan@ryanclosner.com ]
10
- gem.description = 'Module to declare abstract classes and methods for RubyMotion'
11
- gem.summary = gem.description
12
- gem.homepage = 'https://github.com/rclosner/motion_abstract_type'
13
-
14
- gem.files = `git ls-files`.split($/)
15
- gem.test_files = `git ls-files -- spec/unit`.split($/)
16
- gem.extra_rdoc_files = %w[LICENSE README.md TODO]
17
-
18
- gem.add_development_dependency('bundler', '~> 1.3', '>= 1.3.5')
19
- end
@@ -1,7 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'motion_abstract_type'
4
- require 'devtools/spec_helper'
5
-
6
- RSpec.configure do |config|
7
- end
@@ -1,5 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'rbconfig'
4
-
5
- ::Config = RbConfig unless defined?(::Config)
@@ -1,36 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe AbstractType::ClassMethods, '#abstract_method' do
6
- subject { object.abstract_method(:some_method) }
7
-
8
- let(:object) { Class.new { include AbstractType } }
9
- let(:subclass) { Class.new(object) }
10
-
11
- before do
12
- Subclass = subclass
13
- end
14
-
15
- after do
16
- Object.class_eval { remove_const(:Subclass) }
17
- end
18
-
19
- it { should equal(object) }
20
-
21
- it 'creates an abstract method' do
22
- expect { subject }.to change { subclass.method_defined?(:some_method) }.
23
- from(false).
24
- to(true)
25
- end
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
-
32
- it 'creates a method that raises an exception' do
33
- subject
34
- expect { subclass.new.some_method }.to raise_error(NotImplementedError, 'Subclass#some_method is not implemented')
35
- end
36
- end
@@ -1,36 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe AbstractType::ClassMethods, '#abstract_singleton_method' do
6
- subject { object.abstract_singleton_method(:some_method) }
7
-
8
- let(:object) { Class.new { include AbstractType } }
9
- let(:subclass) { Class.new(object) }
10
-
11
- before do
12
- Subclass = subclass
13
- end
14
-
15
- after do
16
- Object.class_eval { remove_const(:Subclass) }
17
- end
18
-
19
- it { should equal(object) }
20
-
21
- it 'creates an abstract method' do
22
- expect { subject }.to change { subclass.respond_to?(:some_method) }.
23
- from(false).
24
- to(true)
25
- end
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
-
32
- it 'creates a method that raises an exception' do
33
- subject
34
- expect { subclass.some_method }.to raise_error(NotImplementedError, 'Subclass.some_method is not implemented')
35
- end
36
- end
@@ -1,26 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe AbstractType, '.included' do
6
- subject { object }
7
-
8
- let(:object) { described_class }
9
- let(:klass) { Class.new }
10
-
11
- it 'extends the klass' do
12
- klass.singleton_class.should_not include(described_class::ClassMethods)
13
- klass.send(:include, subject)
14
- klass.singleton_class.should include(described_class::ClassMethods)
15
- end
16
-
17
- it 'delegates to the ancestor' do
18
- included_ancestor = false
19
- subject.extend Module.new {
20
- define_method(:included) { |_| included_ancestor = true }
21
- }
22
- expect {
23
- klass.send(:include, subject)
24
- }.to change { included_ancestor }.from(false).to(true)
25
- end
26
- end
@@ -1,49 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- describe AbstractType::ClassMethods, '#new' do
6
- context 'with arguments' do
7
- subject { object.new(:foo) }
8
-
9
- let(:abstract_type) do
10
- Class.new do
11
- include AbstractType
12
-
13
- def initialize(foo)
14
- @foo = foo
15
- end
16
- end
17
- end
18
-
19
- context 'called on a subclass' do
20
- let(:object) { Class.new(abstract_type) }
21
-
22
- it { should be_instance_of(object) }
23
- end
24
-
25
- context 'called on the class' do
26
- let(:object) { abstract_type }
27
-
28
- specify { expect { subject }.to raise_error(NotImplementedError, "#{object} is an abstract type") }
29
- end
30
- end
31
-
32
- context 'without arguments' do
33
- subject { object.new }
34
-
35
- let(:abstract_type) { Class.new { include AbstractType } }
36
-
37
- context 'called on a subclass' do
38
- let(:object) { Class.new(abstract_type) }
39
-
40
- it { should be_instance_of(object) }
41
- end
42
-
43
- context 'called on the class' do
44
- let(:object) { abstract_type }
45
-
46
- specify { expect { subject }.to raise_error(NotImplementedError, "#{object} is an abstract type") }
47
- end
48
- end
49
- end