rcov_rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README +22 -0
- data/lib/tasks/coverage.rake +65 -0
- metadata +65 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 [Matthew Rudy Jacobs]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
RcovRails
|
2
|
+
=========
|
3
|
+
|
4
|
+
A simple "no thoughts required" solution to adding RCOV code coverage to your Rails application.
|
5
|
+
Just install the plugin, install the RCOV gem, and you're done.
|
6
|
+
Enjoy.
|
7
|
+
|
8
|
+
Example
|
9
|
+
=======
|
10
|
+
|
11
|
+
Install as a Rails 2.x Plugin:
|
12
|
+
sudo gem install rcov
|
13
|
+
ruby script/plugin install git://github.com/matthewrudy/rcov_rails
|
14
|
+
rake test:coverage # boom!
|
15
|
+
|
16
|
+
Install as a Rails 3.x Plugin:
|
17
|
+
sudo gem install rcov
|
18
|
+
rails plugin install git://github.com/matthewrudy/rcov_rails
|
19
|
+
rake test:coverage # boom!
|
20
|
+
|
21
|
+
|
22
|
+
Copyright (c) 2010 [Matthew Rudy Jacobs], released under the MIT license
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# this is what a Rails test looks like
|
2
|
+
# copy it;
|
3
|
+
#
|
4
|
+
# Rake::TestTask.new(:units => "db:test:prepare") do |t|
|
5
|
+
# t.libs << "test"
|
6
|
+
# t.pattern = 'test/unit/**/*_test.rb'
|
7
|
+
# t.verbose = true
|
8
|
+
# end
|
9
|
+
# Rake::Task['test:units'].comment = "Run the unit tests in test/unit"
|
10
|
+
#
|
11
|
+
|
12
|
+
begin
|
13
|
+
|
14
|
+
require 'rcov/rcovtask'
|
15
|
+
|
16
|
+
def coverage_task(name, aspects, options={})
|
17
|
+
aspect_tasks = aspects.map{ |aspect| "test:coverage:_#{aspect}" }
|
18
|
+
|
19
|
+
if options[:description]
|
20
|
+
desc options[:description]
|
21
|
+
end
|
22
|
+
|
23
|
+
task name => ["test:coverage:reset"] + aspect_tasks + ["test:coverage:generate"] do
|
24
|
+
if PLATFORM['darwin']
|
25
|
+
system("open coverage/index.html")
|
26
|
+
else
|
27
|
+
puts "coverage created. open coverage/index.html in a web browser"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
namespace :test do
|
33
|
+
|
34
|
+
namespace :coverage do
|
35
|
+
|
36
|
+
["units", "functionals", "integration"].each do |scope|
|
37
|
+
Rcov::RcovTask.new("_#{scope}" => "db:test:prepare") do |t|
|
38
|
+
t.libs << "test"
|
39
|
+
t.test_files = Dir["test/#{scope.singularize}/**/*_test.rb"]
|
40
|
+
t.rcov_opts = ["--no-html", "--aggregate coverage.data", "--exclude '^(?!(app|lib))'"]
|
41
|
+
end
|
42
|
+
|
43
|
+
coverage_task(scope, [scope], :description => "run the #{scope} tests with coverage")
|
44
|
+
end
|
45
|
+
|
46
|
+
task :reset do
|
47
|
+
rm_f "coverage.data"
|
48
|
+
rm_f "coverage"
|
49
|
+
end
|
50
|
+
|
51
|
+
Rcov::RcovTask.new(:generate) do |t|
|
52
|
+
t.libs << "test"
|
53
|
+
t.test_files = []
|
54
|
+
t.rcov_opts = ["--html", "--aggregate coverage.data", "--exclude '^(?!(app|lib))'"]
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
coverage_task(:coverage, [:units, :functionals, :integration])
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
rescue LoadError
|
64
|
+
puts "You must install the 'rcov' gem to use rcov_rails\n sudo gem install rcov"
|
65
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rcov_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Matthew Rudy Jacobs
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-02-25 00:00:00 +08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Ruby, Rails, Rcov put together into a single neat Rake task
|
22
|
+
email: matthewrudyjacobs@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README
|
29
|
+
files:
|
30
|
+
- MIT-LICENSE
|
31
|
+
- README
|
32
|
+
- lib/tasks/coverage.rake
|
33
|
+
has_rdoc: true
|
34
|
+
homepage: http://github.com/matthewrudy/rcov_rails
|
35
|
+
licenses: []
|
36
|
+
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options:
|
39
|
+
- --main
|
40
|
+
- README
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
requirements: []
|
58
|
+
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.3.6
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: Ruby, Rails, Rcov put together into a single neat Rake task
|
64
|
+
test_files: []
|
65
|
+
|