Skip to content

Commit ce4d9cf

Browse files
author
Raven
committed
Added testing gems
1 parent 92ea112 commit ce4d9cf

File tree

9 files changed

+76
-48
lines changed

9 files changed

+76
-48
lines changed

.autotest

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require 'autotest/growl'
2+
require 'autotest/restart' # optional: forces autotest to pick the changes to this file
3+
require 'autotest/timestamp' # optional: shows timestamps for test runs
4+
5+
# filter out VCS files and other garbage to reduce HDD usage
6+
Autotest.add_hook :initialize do |autotest|
7+
%w{.git .svn .hg .DS_Store ._* vendor tmp log doc}.each do |exception|
8+
autotest.add_exception(exception)
9+
end
10+
end
11+
12+
# do not clear console before running tests
13+
Autotest::Growl::clear_terminal = false

Gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
source 'http://rubygems.org'
22

33
gem 'rails', '3.0.5'
4+
gem 'ZenTest'
5+
gem 'autotest'
6+
gem 'autotest-rails-pure'
7+
gem 'autotest-growl'
8+
gem 'test-unit'
9+
gem 'win32console'
10+
411

512
group :development do
613
gem 'rspec-rails'
@@ -9,6 +16,7 @@ end
916
group :test do
1017
gem 'rspec'
1118
gem 'webrat'
19+
gem 'spork'
1220
end
1321

1422

Gemfile.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
GEM
22
remote: http://rubygems.org/
33
specs:
4+
ZenTest (4.5.0)
45
abstract (1.0.0)
56
actionmailer (3.0.5)
67
actionpack (= 3.0.5)
@@ -29,6 +30,10 @@ GEM
2930
activesupport (= 3.0.5)
3031
activesupport (3.0.5)
3132
arel (2.0.9)
33+
autotest (4.4.6)
34+
ZenTest (>= 4.4.1)
35+
autotest-growl (0.2.9)
36+
autotest-rails-pure (4.1.2)
3237
builder (2.1.2)
3338
diff-lcs (1.1.2)
3439
erubis (2.6.6)
@@ -74,7 +79,9 @@ GEM
7479
activesupport (~> 3.0)
7580
railties (~> 3.0)
7681
rspec (~> 2.5.0)
82+
spork (0.8.4)
7783
sqlite3 (1.3.3-x86-mingw32)
84+
test-unit (2.2.0)
7885
thor (0.14.6)
7986
treetop (1.4.9)
8087
polyglot (>= 0.3.1)
@@ -83,13 +90,21 @@ GEM
8390
nokogiri (>= 1.2.0)
8491
rack (>= 1.0)
8592
rack-test (>= 0.5.3)
93+
win32console (1.3.0-x86-mingw32)
8694

8795
PLATFORMS
8896
x86-mingw32
8997

9098
DEPENDENCIES
99+
ZenTest
100+
autotest
101+
autotest-growl
102+
autotest-rails-pure
91103
rails (= 3.0.5)
92104
rspec
93105
rspec-rails
106+
spork
94107
sqlite3
108+
test-unit
95109
webrat
110+
win32console

config/environments/test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# test suite. You never need to work with it otherwise. Remember that
66
# your test database is "scratch space" for the test suite and is wiped
77
# and recreated between test runs. Don't rely on the data there!
8-
config.cache_classes = true
8+
config.cache_classes = false
99

1010
# Log error messages when you accidentally call methods on nil.
1111
config.whiny_nils = true

spec/controllers/pages_controller_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
describe PagesController do
44

5+
render_views
6+
57
describe "GET 'home'" do
68
it "should be successful" do
79
get 'home'
@@ -16,4 +18,11 @@
1618
end
1719
end
1820

21+
describe "GET 'about'" do
22+
it "should be successful" do
23+
get 'about'
24+
response.should be_success
25+
end
26+
end
27+
1928
end

spec/helpers/pages_helper_spec.rb

Lines changed: 0 additions & 15 deletions
This file was deleted.

spec/spec_helper.rb

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
1-
# This file is copied to spec/ when you run 'rails generate rspec:install'
2-
ENV["RAILS_ENV"] ||= 'test'
3-
require File.expand_path("../../config/environment", __FILE__)
4-
require 'rspec/rails'
1+
require 'spork'
52

6-
# Requires supporting ruby files with custom matchers and macros, etc,
7-
# in spec/support/ and its subdirectories.
8-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
3+
Spork.prefork do
4+
# Loading more in this block will cause your tests to run faster. However,
5+
# if you change any configuration or code from libraries loaded here, you'll
6+
# need to restart spork for it take effect.
7+
ENV["RAILS_ENV"] ||= 'test'
8+
require File.expand_path("../../config/environment", __FILE__)
9+
require 'rspec/rails'
910

10-
RSpec.configure do |config|
11-
# == Mock Framework
12-
#
13-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
14-
#
15-
# config.mock_with :mocha
16-
# config.mock_with :flexmock
17-
# config.mock_with :rr
18-
config.mock_with :rspec
11+
# Requires supporting files with custom matchers and macros, etc,
12+
# in ./support/ and its subdirectories.
13+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
14+
15+
Rspec.configure do |config|
16+
# == Mock Framework
17+
#
18+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
19+
#
20+
# config.mock_with :mocha
21+
# config.mock_with :flexmock
22+
# config.mock_with :rr
23+
config.mock_with :rspec
1924

20-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
25+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
2226

23-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
24-
# examples within a transaction, remove the following line or assign false
25-
# instead of true.
26-
config.use_transactional_fixtures = true
27+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
28+
# examples within a transaction, comment the following line or assign false
29+
# instead of true.
30+
config.use_transactional_fixtures = true
31+
end
32+
end
33+
34+
Spork.each_run do
2735
end

spec/views/pages/contact.html.erb_spec.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.

spec/views/pages/home.html.erb_spec.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)