Skip to content

Commit c3d94aa

Browse files
committed
Add some initial test coverage with dummy app.
1 parent c3f8805 commit c3d94aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+10316
-3
lines changed

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "http://rubygems.org"
2+
3+
gemspec

Gemfile.lock

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
PATH
2+
remote: .
3+
specs:
4+
exception_notification (2.4.1)
5+
actionmailer (~> 3.0.9)
6+
7+
GEM
8+
remote: http://rubygems.org/
9+
specs:
10+
abstract (1.0.0)
11+
actionmailer (3.0.9)
12+
actionpack (= 3.0.9)
13+
mail (~> 2.2.19)
14+
actionpack (3.0.9)
15+
activemodel (= 3.0.9)
16+
activesupport (= 3.0.9)
17+
builder (~> 2.1.2)
18+
erubis (~> 2.6.6)
19+
i18n (~> 0.5.0)
20+
rack (~> 1.2.1)
21+
rack-mount (~> 0.6.14)
22+
rack-test (~> 0.5.7)
23+
tzinfo (~> 0.3.23)
24+
activemodel (3.0.9)
25+
activesupport (= 3.0.9)
26+
builder (~> 2.1.2)
27+
i18n (~> 0.5.0)
28+
activerecord (3.0.9)
29+
activemodel (= 3.0.9)
30+
activesupport (= 3.0.9)
31+
arel (~> 2.0.10)
32+
tzinfo (~> 0.3.23)
33+
activeresource (3.0.9)
34+
activemodel (= 3.0.9)
35+
activesupport (= 3.0.9)
36+
activesupport (3.0.9)
37+
arel (2.0.10)
38+
builder (2.1.2)
39+
erubis (2.6.6)
40+
abstract (>= 1.0.0)
41+
i18n (0.5.0)
42+
mail (2.2.19)
43+
activesupport (>= 2.3.6)
44+
i18n (>= 0.4.0)
45+
mime-types (~> 1.16)
46+
treetop (~> 1.4.8)
47+
mime-types (1.16)
48+
polyglot (0.3.2)
49+
rack (1.2.3)
50+
rack-mount (0.6.14)
51+
rack (>= 1.0.0)
52+
rack-test (0.5.7)
53+
rack (>= 1.0)
54+
rails (3.0.9)
55+
actionmailer (= 3.0.9)
56+
actionpack (= 3.0.9)
57+
activerecord (= 3.0.9)
58+
activeresource (= 3.0.9)
59+
activesupport (= 3.0.9)
60+
bundler (~> 1.0)
61+
railties (= 3.0.9)
62+
railties (3.0.9)
63+
actionpack (= 3.0.9)
64+
activesupport (= 3.0.9)
65+
rake (>= 0.8.7)
66+
rdoc (~> 3.4)
67+
thor (~> 0.14.4)
68+
rake (0.9.2)
69+
rdoc (3.8)
70+
sqlite3 (1.3.4)
71+
thor (0.14.6)
72+
treetop (1.4.10)
73+
polyglot
74+
polyglot (>= 0.3.1)
75+
tzinfo (0.3.29)
76+
77+
PLATFORMS
78+
ruby
79+
80+
DEPENDENCIES
81+
exception_notification!
82+
rails (~> 3.0.9)
83+
sqlite3 (~> 1.3.4)

Rakefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require 'bundler'
2+
Bundler::GemHelper.install_tasks
3+
4+
require 'rake/testtask'
5+
6+
Rake::TestTask.new(:test) do |t|
7+
t.libs << 'lib'
8+
t.libs << 'test'
9+
t.pattern = 'test/**/*_test.rb'
10+
t.verbose = true
11+
end
12+
13+
task :default => :test

exception_notification.gemspec

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ Gem::Specification.new do |s|
66
s.summary = "Exception notification by email for Rails apps"
77
s.email = "[email protected]"
88

9-
s.files = ['README.md'] + Dir['lib/**/*']
9+
s.files = Dir['Rakefile', 'README.md' 'lib/**/*']
10+
s.test_files = Dir.glob "test/**/*_test.rb"
11+
s.require_path = 'lib'
1012

1113
s.add_dependency("actionmailer", "~> 3.0.9")
12-
13-
s.require_path = 'lib'
14+
s.add_development_dependency "rails", "~> 3.0.9"
15+
s.add_development_dependency "sqlite3", "~> 1.3.4"
1416
end

test/dummy/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.bundle
2+
db/*.sqlite3
3+
log/*.log
4+
tmp/

test/dummy/Gemfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
source 'http://rubygems.org'
2+
3+
gem 'rails', '3.0.9'
4+
5+
# Bundle edge Rails instead:
6+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
7+
8+
gem 'sqlite3'
9+
10+
gem 'exception_notification', :path => "../../.."
11+
# Use unicorn as the web server
12+
# gem 'unicorn'
13+
14+
# Deploy with Capistrano
15+
# gem 'capistrano'
16+
17+
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
18+
# gem 'ruby-debug'
19+
# gem 'ruby-debug19', :require => 'ruby-debug'
20+
21+
# Bundle the extra gems:
22+
# gem 'bj'
23+
# gem 'nokogiri'
24+
# gem 'sqlite3-ruby', :require => 'sqlite3'
25+
# gem 'aws-s3', :require => 'aws/s3'
26+
27+
# Bundle gems for the local environment. Make sure to
28+
# put test-only gems in this group so their generators
29+
# and rake tasks are available in development mode:
30+
# group :development, :test do
31+
# gem 'webrat'
32+
# end

test/dummy/Gemfile.lock

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
PATH
2+
remote: ../../..
3+
specs:
4+
exception_notification (2.4.1)
5+
actionmailer (~> 3.0.9)
6+
7+
GEM
8+
remote: http://rubygems.org/
9+
specs:
10+
abstract (1.0.0)
11+
actionmailer (3.0.9)
12+
actionpack (= 3.0.9)
13+
mail (~> 2.2.19)
14+
actionpack (3.0.9)
15+
activemodel (= 3.0.9)
16+
activesupport (= 3.0.9)
17+
builder (~> 2.1.2)
18+
erubis (~> 2.6.6)
19+
i18n (~> 0.5.0)
20+
rack (~> 1.2.1)
21+
rack-mount (~> 0.6.14)
22+
rack-test (~> 0.5.7)
23+
tzinfo (~> 0.3.23)
24+
activemodel (3.0.9)
25+
activesupport (= 3.0.9)
26+
builder (~> 2.1.2)
27+
i18n (~> 0.5.0)
28+
activerecord (3.0.9)
29+
activemodel (= 3.0.9)
30+
activesupport (= 3.0.9)
31+
arel (~> 2.0.10)
32+
tzinfo (~> 0.3.23)
33+
activeresource (3.0.9)
34+
activemodel (= 3.0.9)
35+
activesupport (= 3.0.9)
36+
activesupport (3.0.9)
37+
arel (2.0.10)
38+
builder (2.1.2)
39+
erubis (2.6.6)
40+
abstract (>= 1.0.0)
41+
i18n (0.5.0)
42+
mail (2.2.19)
43+
activesupport (>= 2.3.6)
44+
i18n (>= 0.4.0)
45+
mime-types (~> 1.16)
46+
treetop (~> 1.4.8)
47+
mime-types (1.16)
48+
polyglot (0.3.2)
49+
rack (1.2.3)
50+
rack-mount (0.6.14)
51+
rack (>= 1.0.0)
52+
rack-test (0.5.7)
53+
rack (>= 1.0)
54+
rails (3.0.9)
55+
actionmailer (= 3.0.9)
56+
actionpack (= 3.0.9)
57+
activerecord (= 3.0.9)
58+
activeresource (= 3.0.9)
59+
activesupport (= 3.0.9)
60+
bundler (~> 1.0)
61+
railties (= 3.0.9)
62+
railties (3.0.9)
63+
actionpack (= 3.0.9)
64+
activesupport (= 3.0.9)
65+
rake (>= 0.8.7)
66+
rdoc (~> 3.4)
67+
thor (~> 0.14.4)
68+
rake (0.9.2)
69+
rdoc (3.8)
70+
sqlite3 (1.3.4)
71+
thor (0.14.6)
72+
treetop (1.4.10)
73+
polyglot
74+
polyglot (>= 0.3.1)
75+
tzinfo (0.3.29)
76+
77+
PLATFORMS
78+
ruby
79+
80+
DEPENDENCIES
81+
exception_notification!
82+
rails (= 3.0.9)
83+
sqlite3

test/dummy/Rakefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require File.expand_path('../config/application', __FILE__)
5+
require 'rake'
6+
7+
Dummy::Application.load_tasks
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationController < ActionController::Base
2+
protect_from_forgery
3+
end
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
class PostsController < ApplicationController
2+
# GET /posts/1
3+
# GET /posts/1.xml
4+
def show
5+
@post = Post.find(params[:id])
6+
7+
respond_to do |format|
8+
format.html # show.html.erb
9+
format.xml { render :xml => @post }
10+
end
11+
end
12+
13+
# POST /posts
14+
# POST /posts.xml
15+
def create
16+
# Have this line raise an exception
17+
@post = Post.nw(params[:post])
18+
19+
respond_to do |format|
20+
if @post.save
21+
format.html { redirect_to(post_path(@post), :notice => 'Post was successfully created.') }
22+
format.xml { render :xml => @post, :status => :created, :location => @post }
23+
else
24+
format.html { render :action => "new" }
25+
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
26+
end
27+
end
28+
end
29+
end

0 commit comments

Comments
 (0)