Permalink
Browse files

Add spork and growl notifications.

  • Loading branch information...
1 parent f7241be commit 18fee07c11272a46e90154d70b7829c3701a44e1 @ejholmes ejholmes committed Dec 9, 2012
Showing with 99 additions and 68 deletions.
  1. +1 −1 .travis.yml
  2. +7 −2 Gemfile
  3. +8 −0 Gemfile.lock
  4. +13 −9 Guardfile
  5. +1 −1 app/views/layouts/application.html.haml
  6. +69 −55 spec/spec_helper.rb
View
2 .travis.yml
@@ -4,7 +4,7 @@ rvm:
env:
- DB=postgresql
script:
- - RAILS_ENV=test CI=true bundle exec rake --trace db:migrate spec konacha:run
+ - RAILS_ENV=test POLTERGEIST=true bundle exec rake --trace db:migrate spec konacha:run
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
View
9 Gemfile
@@ -36,11 +36,16 @@ end
group :development, :test do
gem 'rspec-rails'
- gem 'guard-rspec'
gem 'rb-fsevent', '~> 0.9.1'
- gem "factory_girl_rails"
+ gem 'factory_girl_rails'
gem 'faker'
+ # Auto testing
+ gem 'guard-rspec'
+ gem 'guard-spork'
+ gem 'ruby_gntp'
+ gem 'rb-fsevent', '~> 0.9.1'
+
# Javascript
gem 'konacha'
gem 'chai-jquery-rails'
View
8 Gemfile.lock
@@ -92,6 +92,10 @@ GEM
guard-rspec (2.3.1)
guard (>= 1.1)
rspec (~> 2.11)
+ guard-spork (1.4.0)
+ childprocess (>= 0.2.3)
+ guard (>= 1.1)
+ spork (>= 0.8.4)
haml (3.1.7)
haml-rails (0.3.5)
actionpack (>= 3.1, < 4.1)
@@ -237,6 +241,7 @@ GEM
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
+ ruby_gntp (0.3.4)
rubyzip (0.9.9)
sass (3.2.3)
sass-rails (3.2.5)
@@ -264,6 +269,7 @@ GEM
sinon-rails (1.4.2.1)
railties (>= 3.1)
slop (3.3.3)
+ spork (0.9.2)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
@@ -318,6 +324,7 @@ DEPENDENCIES
faker
foreman
guard-rspec
+ guard-spork
haml-rails
jquery-rails
kaminari
@@ -337,6 +344,7 @@ DEPENDENCIES
rails (= 3.2.9)
rb-fsevent (~> 0.9.1)
rspec-rails
+ ruby_gntp
sass-rails (~> 3.2.3)
shoulda-matchers
simple_form
View
22 Guardfile
@@ -1,7 +1,17 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
-guard 'rspec' do
+guard 'spork', rspec_env: { 'RAILS_ENV' => 'test', 'POLTERGEIST' => true } do
+ watch('config/application.rb')
+ watch('config/environment.rb')
+ watch('config/environments/test.rb')
+ watch(%r{^config/initializers/.+\.rb$})
+ watch('Gemfile')
+ watch('Gemfile.lock')
+ watch('spec/spec_helper.rb') { :rspec }
+end
+
+guard 'rspec', cli: '--drb', all_after_pass: false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
@@ -13,12 +23,6 @@ guard 'rspec' do
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
-
- # Capybara features specs
- watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
-
- # Turnip features and steps
- watch(%r{^spec/acceptance/(.+)\.feature$})
- watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
+ # Capybara request specs
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end
-
View
2 app/views/layouts/application.html.haml
@@ -3,7 +3,7 @@
%head
%meta{ :charset => "utf-8" }
%meta{ :'http-equiv' => 'X-UA-Compatible', :content => "IE=Edge,chrome=1" }
- %meta{ :name => "viewport", :content => "user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0;" }
+ %meta{ :name => "viewport", :content => "user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" }
%title= content_for?(:title) ? yield(:title) : "24 Pull Requests"
= csrf_meta_tags
View
124 spec/spec_helper.rb
@@ -1,75 +1,89 @@
require 'simplecov'
SimpleCov.start
-# This file is copied to spec/ when you run 'rails generate rspec:install'
-ENV["RAILS_ENV"] ||= 'test'
-require File.expand_path("../../config/environment", __FILE__)
-require 'rspec/rails'
-require 'rspec/autorun'
-require 'shoulda-matchers'
-require 'webmock'
+require 'spork'
-OmniAuth.config.test_mode = true
+Spork.prefork do
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
+ ENV["RAILS_ENV"] ||= 'test'
-WebMock.disable_net_connect! :allow_localhost => true
+ require 'rails/application'
+ Spork.trap_method(Rails::Application::RoutesReloader, :reload!) # Rails 3.1
-if ENV['CI']
- require 'capybara/poltergeist'
- Capybara.javascript_driver = :poltergeist
-end
+ require File.expand_path("../../config/environment", __FILE__)
+ require 'rspec/rails'
+ require 'rspec/autorun'
+ require 'shoulda-matchers'
+ require 'webmock'
-# Requires supporting ruby files with custom matchers and macros, etc,
-# in spec/support/ and its subdirectories.
-Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+ OmniAuth.config.test_mode = true
-RSpec.configure do |config|
- config.treat_symbols_as_metadata_keys_with_true_values = true
+ WebMock.disable_net_connect! :allow_localhost => true
- # ## Mock Framework
- #
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
- #
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
+ if ENV['POLTERGEIST']
+ require 'capybara/poltergeist'
+ Capybara.javascript_driver = :poltergeist
+ end
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ # Requires supporting ruby files with custom matchers and macros, etc,
+ # in spec/support/ and its subdirectories.
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, remove the following line or assign false
- # instead of true.
- config.use_transactional_fixtures = false
+ RSpec.configure do |config|
+ config.treat_symbols_as_metadata_keys_with_true_values = true
- # Database Cleaner
- config.before(:suite) do
- DatabaseCleaner.clean_with(:truncation)
- end
+ # ## Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
- config.before(:each) do
- DatabaseCleaner.strategy = :transaction
- end
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
- config.before(:each, :js => true) do
- DatabaseCleaner.strategy = :truncation
- end
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = false
- config.before(:each) do
- DatabaseCleaner.start
- end
+ # Database Cleaner
+ config.before(:suite) do
+ DatabaseCleaner.clean_with(:truncation)
+ end
- config.after(:each) do
- DatabaseCleaner.clean
- end
+ config.before(:each) do
+ DatabaseCleaner.strategy = :transaction
+ end
- config.before(:each) do
- Twitter::Client.any_instance.stub(:update)
- end
+ config.before(:each, :js => true) do
+ DatabaseCleaner.strategy = :truncation
+ end
+
+ config.before(:each) do
+ DatabaseCleaner.start
+ end
- # If true, the base class of anonymous controllers will be inferred
- # automatically. This will be the default behavior in future versions of
- # rspec-rails.
- config.infer_base_class_for_anonymous_controllers = false
+ config.after(:each) do
+ DatabaseCleaner.clean
+ end
- config.include FactoryGirl::Syntax::Methods
+ # If true, the base class of anonymous controllers will be inferred
+ # automatically. This will be the default behavior in future versions of
+ # rspec-rails.
+ config.infer_base_class_for_anonymous_controllers = false
+
+ config.include FactoryGirl::Syntax::Methods
+ end
+end
+
+Spork.each_run do
+ FactoryGirl.reload
+ I18n.backend.reload!
+ RSpec.configure do |config|
+ config.before do
+ Twitter::Client.any_instance.stub(:update)
+ end
+ end
end

0 comments on commit 18fee07

Please sign in to comment.