final 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53d6f273607cf9d9557742aaab37d55a6cad13e6f47293c22cbdcafcc4723e56
4
- data.tar.gz: 536323e0eb84b1dc8a19f6e430482dd4be0e5072f11e99e35440906e7b10f7a6
3
+ metadata.gz: 5f7914e66cf69af464eda26e6289e3f05c6a078349e2b9fe91ad4e0a20dec5ca
4
+ data.tar.gz: 5146a6c91f11149bb18071978f68f422ae60a748c0f5fa563ff73c66f4558ffb
5
5
  SHA512:
6
- metadata.gz: d5815db9427d71536e75ce722bd8c9016668bfd9fbaa9c9e00809d2ba70c8f3b4a081ca37a9ef191b3d6345671c6cab32d848630263fb23281f5e4c3e51e8d97
7
- data.tar.gz: c249219a7f52fca6243f625ae4508b09548cfacd2185cbe87a14cdec0bd015911397ad4943b2988bbed2eccdf7f986976194fa4745e228b62561938ca6aceb9e
6
+ metadata.gz: 832ed6846121c6c19d486f44a34f08b33cc69bed9999628b1a5655f97d211f8773c87f4f60c604f3d709fb951f63307948c9b33bdd00e11c388071896dc8d232
7
+ data.tar.gz: 58990ef4509fd12f0e73a6374485684076fcec5891181b5052ef24abebe9cb91a18fb38fbbe2a0a6311274a5c2ea9cec9205c9f96a29123413d85d67c1629ce6
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.3.0 - 16-Sep-2020
2
+ * Switched from test-unit to rspec, and made corresponding updates.
3
+
1
4
  == 0.2.1 - 1-Jun-2020
2
5
  * Added a LICENSE file to distro as required by the Apache-2.0 license.
3
6
 
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org' do
2
+ gem 'rake'
3
+ group 'test' do
4
+ gem 'rspec', '~> 3.9'
5
+ end
6
+ end
data/MANIFEST CHANGED
@@ -6,4 +6,4 @@
6
6
  * final.gemspec
7
7
  * certs/djberg96_pub.pem
8
8
  * lib/final.rb
9
- * test/test_final.rb
9
+ * spec/final_spec.rb
data/Rakefile CHANGED
@@ -1,29 +1,26 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/testtask'
4
-
5
- CLEAN.include('**/*.gem', '**/*.rbc')
6
-
7
- namespace :gem do
8
- desc 'Build the final gem'
9
- task :create => [:clean] do
10
- require 'rubygems/package'
11
- spec = eval(IO.read('final.gemspec'))
12
- spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
13
- Gem::Package.build(spec, true)
14
- end
15
-
16
- desc "Install the final gem"
17
- task :install => [:create] do
18
- file = Dir["*.gem"].first
19
- sh "gem install -l #{file}"
20
- end
21
- end
22
-
23
- Rake::TestTask.new do |t|
24
- task :test => :clean
25
- t.warning = true
26
- t.verbose = true
27
- end
28
-
29
- task :default => :test
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rspec/core/rake_task'
4
+
5
+ CLEAN.include('**/*.gem', '**/*.rbc')
6
+
7
+ namespace :gem do
8
+ desc 'Build the final gem'
9
+ task :create => [:clean] do
10
+ require 'rubygems/package'
11
+ spec = eval(IO.read('final.gemspec'))
12
+ spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
13
+ Gem::Package.build(spec, true)
14
+ end
15
+
16
+ desc "Install the final gem"
17
+ task :install => [:create] do
18
+ file = Dir["*.gem"].first
19
+ sh "gem install -l #{file}"
20
+ end
21
+ end
22
+
23
+ desc "Run the test suite"
24
+ RSpec::Core::RakeTask.new(:spec)
25
+
26
+ task :default => :spec
@@ -2,17 +2,20 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'final'
5
- spec.version = '0.2.1'
5
+ spec.version = '0.3.0'
6
6
  spec.license = 'Apache-2.0'
7
7
  spec.author = 'Daniel J. Berger'
8
8
  spec.email = 'djberg96@gmail.com'
9
9
  spec.homepage = 'https://github.com/djberg96/final'
10
10
  spec.summary = "An implementation of 'final' for Ruby"
11
- spec.test_files = Dir['test/test*']
11
+ spec.test_files = Dir['spec/*_spec.rb']
12
12
  spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
13
  spec.cert_chain = Dir['certs/*']
14
14
 
15
- spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
15
+ spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
16
+
17
+ spec.add_development_dependency "rake"
18
+ spec.add_development_dependency "rspec", "~> 3.9"
16
19
 
17
20
  spec.metadata = {
18
21
  'homepage_uri' => 'https://github.com/djberg96/final',
@@ -6,7 +6,7 @@ module Final
6
6
  class Error < RuntimeError; end
7
7
 
8
8
  # The version of the final library.
9
- FINAL_VERSION = '0.2.1'.freeze
9
+ FINAL_VERSION = '0.3.0'.freeze
10
10
 
11
11
  def self.included(mod)
12
12
  # Store already defined methods.
@@ -0,0 +1,41 @@
1
+ ########################################################################
2
+ # final_spec.rb
3
+ #
4
+ # Test suite for the final library.
5
+ ########################################################################
6
+ require 'rspec'
7
+ require 'final'
8
+
9
+ RSpec.describe Final do
10
+ let(:klass){
11
+ Class.new do
12
+ include Final
13
+ def bar; end
14
+ end
15
+ }
16
+
17
+ before do
18
+ @foo = klass.new
19
+ end
20
+
21
+ example "version constant returns expected version number" do
22
+ expect(Final::FINAL_VERSION).to eq('0.3.0')
23
+ expect(Final::FINAL_VERSION).to be_frozen
24
+ end
25
+
26
+ example "final class cannot be subclassed" do
27
+ expect{ class Bar < klass; end }.to raise_error(Final::Error)
28
+ end
29
+
30
+ example "final class cannot have instance methods redefined" do
31
+ expect{ klass.define_method(:bar){ "bar" } }.to raise_error(Final::Error)
32
+ end
33
+
34
+ example "adding a new method is not an error" do
35
+ expect{ klass.define_method(:foo){ "foo" } }.not_to raise_error
36
+ end
37
+
38
+ example "finalized classes do not interfere with each other" do
39
+ expect{ class Foo2; include Final; def bar; end; end }.not_to raise_error
40
+ end
41
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: final
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -35,8 +35,36 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date:
38
+ date:
39
39
  dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: rake
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rspec
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.9'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.9'
40
68
  - !ruby/object:Gem::Dependency
41
69
  name: rake
42
70
  requirement: !ruby/object:Gem::Requirement
@@ -77,16 +105,17 @@ extra_rdoc_files:
77
105
  - MANIFEST
78
106
  files:
79
107
  - LICENSE
80
- - test
81
- - test/test_final.rb
82
108
  - CHANGES
83
109
  - MANIFEST
110
+ - spec
111
+ - spec/final_spec.rb
84
112
  - README
85
113
  - Rakefile
86
114
  - certs
87
115
  - certs/djberg96_pub.pem
88
116
  - lib
89
117
  - lib/final.rb
118
+ - Gemfile
90
119
  - final.gemspec
91
120
  homepage: https://github.com/djberg96/final
92
121
  licenses:
@@ -98,7 +127,7 @@ metadata:
98
127
  documentation_uri: https://github.com/djberg96/final/wiki
99
128
  source_code_uri: https://github.com/djberg96/final
100
129
  wiki_uri: https://github.com/djberg96/final/wiki
101
- post_install_message:
130
+ post_install_message:
102
131
  rdoc_options: []
103
132
  require_paths:
104
133
  - lib
@@ -113,9 +142,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
142
  - !ruby/object:Gem::Version
114
143
  version: '0'
115
144
  requirements: []
116
- rubygems_version: 3.0.8
117
- signing_key:
145
+ rubygems_version: 3.1.4
146
+ signing_key:
118
147
  specification_version: 4
119
148
  summary: An implementation of 'final' for Ruby
120
149
  test_files:
121
- - test/test_final.rb
150
+ - spec/final_spec.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,44 +0,0 @@
1
- ########################################################################
2
- # test_final.rb
3
- #
4
- # Test suite for the final library.
5
- ########################################################################
6
- require 'rubygems'
7
- require 'test-unit'
8
- require 'final'
9
-
10
- class TC_Final < Test::Unit::TestCase
11
- class Foo
12
- include Final
13
- def bar; end
14
- end
15
-
16
- def setup
17
- @foo = Foo.new
18
- end
19
-
20
- test "version constant returns expected version number" do
21
- assert_equal('0.2.1', Final::FINAL_VERSION)
22
- assert_true(Final::FINAL_VERSION.frozen?)
23
- end
24
-
25
- test "final class cannot be subclassed" do
26
- assert_raise(Final::Error){ class Bar < Foo; end }
27
- end
28
-
29
- test "final class cannot have instance methods redefined" do
30
- assert_raise(Final::Error){ class Foo; def bar; end; end }
31
- end
32
-
33
- test "adding a new method is not an error" do
34
- assert_nothing_raised{ class Foo; def baz; end; end }
35
- end
36
-
37
- test "finalized classes do not interfere with each other" do
38
- assert_nothing_raised{ class Foo2; include Final; def bar; end; end }
39
- end
40
-
41
- def teardown
42
- @foo = nil
43
- end
44
- end