Skip to content

Commit 9391d84

Browse files
author
S. Brent Faulkner
committed
working tests and coverage
1 parent 1f3d12f commit 9391d84

7 files changed

+73
-9
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
pkg
2-
rdoc
2+
rdoc
3+
.bundle
4+
coverage
5+

Gemfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
source "http://rubygems.org"
2+
3+
gemspec
4+
5+
# Lock to "rake" version 0.9.2.2 in order to use deprecated "rake/rdoctask".
6+
# Once we drop official support for Ruby 1.8.7, we can loosen this constraint
7+
# and allow our dependencies to "float" to the latest version of "rake".
8+
gem 'rake', '0.9.2.2'
9+

Gemfile.lock

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
PATH
2+
remote: .
3+
specs:
4+
encryptor (1.1.3)
5+
6+
GEM
7+
remote: http://rubygems.org/
8+
specs:
9+
rake (0.9.2.2)
10+
rcov (1.0.0)
11+
12+
PLATFORMS
13+
ruby
14+
15+
DEPENDENCIES
16+
encryptor!
17+
rake (= 0.9.2.2)
18+
rcov

README.rdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A simple wrapper for the standard ruby OpenSSL library
44

5-
Used by http://github.com/shuber/attr_encrypted to easily encrypt/decrypt attributes in any class
5+
Used by http://github.com/attr-encrypted/attr_encrypted to easily encrypt/decrypt attributes in any class
66

77

88
== Installation

Rakefile

+15-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ require 'rake'
22
require 'rake/testtask'
33
require 'rake/rdoctask'
44

5-
desc 'Default: run unit tests'
6-
task :default => :test
7-
85
desc 'Test the encryptor gem'
96
Rake::TestTask.new(:test) do |t|
107
t.libs << 'lib'
@@ -19,4 +16,18 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
1916
rdoc.options << '--line-numbers' << '--inline-source'
2017
rdoc.rdoc_files.include('README*')
2118
rdoc.rdoc_files.include('lib/**/*.rb')
22-
end
19+
end
20+
21+
if RUBY_VERSION < '1.9.3'
22+
require 'rcov/rcovtask'
23+
24+
task :rcov do
25+
system "rcov -o coverage/rcov --exclude '^(?!lib)' " + FileList[ 'test/**/*_test.rb' ].join(' ')
26+
end
27+
28+
desc 'Default: run unit tests under rcov.'
29+
task :default => :rcov
30+
else
31+
desc 'Default: run unit tests.'
32+
task :default => :test
33+
end

encryptor.gemspec

+12-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,21 @@ Gem::Specification.new do |s|
1515
s.summary = 'A simple wrapper for the standard ruby OpenSSL library'
1616
s.description = 'A simple wrapper for the standard ruby OpenSSL library to encrypt and decrypt strings'
1717

18-
s.author = 'Sean Huber'
19-
s.email = 'shuber@huberry.com'
20-
s.homepage = 'http://github.com/shuber/encryptor'
18+
s.authors = ['Sean Huber', 'S. Brent Faulkner', 'William Monk']
19+
s.email = ['shuber@huberry.com', 'sbfaulkner@gmail.com', 'billy.monk@gmail.com']
20+
s.homepage = 'http://github.com/attr-encrypted/encryptor'
2121

2222
s.require_paths = ['lib']
2323

2424
s.files = Dir['{bin,lib}/**/*'] + %w(MIT-LICENSE Rakefile README.rdoc)
2525
s.test_files = Dir['test/**/*']
26+
27+
s.add_development_dependency('rake', '0.9.2.2')
28+
29+
if RUBY_VERSION < '1.9.3'
30+
s.add_development_dependency('rcov')
31+
else
32+
s.add_development_dependency('simplecov')
33+
s.add_development_dependency('simplecov-rcov')
34+
end
2635
end

test/test_helper.rb

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
if RUBY_VERSION >= '1.9.3'
2+
require 'simplecov'
3+
require 'simplecov-rcov'
4+
5+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6+
SimpleCov::Formatter::HTMLFormatter,
7+
SimpleCov::Formatter::RcovFormatter,
8+
]
9+
10+
SimpleCov.start do
11+
add_filter 'test'
12+
end
13+
end
14+
115
require 'test/unit'
216
require 'digest/sha2'
317

0 commit comments

Comments
 (0)