Skip to content

Commit

Permalink
Added gaurd
Browse files Browse the repository at this point in the history
  • Loading branch information
roca committed Oct 10, 2011
1 parent e0b023f commit 3773ed5
Show file tree
Hide file tree
Showing 5 changed files with 1,034 additions and 80 deletions.
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ group :test do
gem 'webrat', '0.7.1'
gem 'spork', '0.9.0.rc9'
gem 'factory_girl_rails','1.0'
gem 'rb-fsevent'
gem 'growl_notify'
gem 'guard'
gem 'guard-rspec'
gem 'guard-livereload'
gem 'guard-spork'

end
# Use unicorn as the web server
# gem 'unicorn'
Expand Down
26 changes: 26 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ GEM
activesupport (= 3.1.0)
activesupport (3.1.0)
multi_json (~> 1.0)
addressable (2.2.6)
arel (2.2.1)
bcrypt-ruby (3.0.1)
builder (3.0.0)
Expand All @@ -46,7 +47,11 @@ GEM
execjs
coffee-script-source (1.1.2)
diff-lcs (1.1.3)
em-websocket (0.3.1)
addressable (>= 2.1.1)
eventmachine (>= 0.12.9)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.2.6)
multi_json (~> 1.0)
factory_girl (1.3.3)
Expand All @@ -55,6 +60,19 @@ GEM
rails (>= 3.0.0.beta4)
faker (0.3.1)
gravatar_image_tag (1.0.0)
growl_notify (0.0.3)
rb-appscript
guard (0.8.4)
thor (~> 0.14.6)
guard-livereload (0.3.1)
em-websocket (>= 0.2.0)
guard (>= 0.4.0)
multi_json (~> 1.0.3)
guard-rspec (0.5.0)
guard (>= 0.8.4)
guard-spork (0.3.1)
guard (>= 0.8.4)
spork (>= 0.8.4)
haml (3.1.3)
hike (1.2.1)
i18n (0.6.0)
Expand Down Expand Up @@ -96,6 +114,8 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
rb-appscript (0.6.1)
rb-fsevent (0.4.3.1)
rdoc (3.9.4)
rspec (2.6.0)
rspec-core (~> 2.6.0)
Expand Down Expand Up @@ -146,10 +166,16 @@ DEPENDENCIES
factory_girl_rails (= 1.0)
faker (= 0.3.1)
gravatar_image_tag (= 1.0.0)
growl_notify
guard
guard-livereload
guard-rspec
guard-spork
haml
jquery-rails
kaminari
rails (= 3.1.0)
rb-fsevent
rspec-rails (= 2.6.1)
sass-rails (~> 3.1.0)
spork (= 0.9.0.rc9)
Expand Down
44 changes: 44 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme


guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('Gemfile.lock')
watch('spec/spec_helper.rb')
watch('test/test_helper.rb')
end

guard 'livereload' do
watch(%r{app/.+\.(erb|haml)})
watch(%r{app/helpers/.+\.rb})
watch(%r{(public/|app/assets).+\.(css|js|html)})
watch(%r{(app/assets/.+\.css)\.s[ac]ss}) { |m| m[1] }
watch(%r{(app/assets/.+\.js)\.coffee}) { |m| m[1] }
watch(%r{config/locales/.+\.yml})
end

guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }

# Rails example
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('spec/spec_helper.rb') { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end



127 changes: 47 additions & 80 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,94 +2,61 @@
require 'spork'

Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
ENV["RAILS_ENV"] ||= 'test'
unless defined?(Rails)
require File.dirname(__FILE__) + "/../config/environment"
end
require 'rspec/rails'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

Rspec.configure do |config|
# == 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.mock_with :rspec

config.fixture_path = "#{::Rails.root}/spec/fixtures"

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, comment the following line or assign false
# instead of true.
config.use_transactional_fixtures = true

### Part of a Spork hack. See http://bit.ly/arY19y
# Emulate initializer set_clear_dependencies_hook in
# railties/lib/rails/application/bootstrap.rb
ActiveSupport::Dependencies.clear
end
end
# --- Instructions ---
# - Sort through your spec_helper file. Place as much environment loading
# code that you don't normally modify during development in the
# Spork.prefork block.
# - Place the rest under Spork.each_run block
# - Any code that is left outside of the blocks will be ran during preforking
# and during each_run!
# - These instructions should self-destruct in 10 seconds. If they don't,
# feel free to delete them.
#

Spork.each_run do
end

Spork.each_run do
# This code will be run each time you run your specs.

end

# --- Instructions ---
# - Sort through your spec_helper file. Place as much environment loading
# code that you don't normally modify during development in the
# Spork.prefork block.
# - Place the rest under Spork.each_run block
# - Any code that is left outside of the blocks will be ran during preforking
# and during each_run!
# - These instructions should self-destruct in 10 seconds. If they don't,
# feel free to delete them.
#

# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
# == 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.mock_with :rspec

# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
config.fixture_path = "#{::Rails.root}/spec/fixtures"

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/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, comment the following line or assign false
# instead of true.
config.use_transactional_fixtures = true

RSpec.configure do |config|
# == 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.mock_with :rspec

config.fixture_path = "#{::Rails.root}/spec/fixtures"

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, comment the following line or assign false
# instead of true.
config.use_transactional_fixtures = true

def test_sign_in(user)
controller.sign_in(user)
def test_sign_in(user)
controller.sign_in(user)
end

end

def test_sign_in(user)
controller.sign_in(user)
end
end



Spork.each_run do

end


Loading

0 comments on commit 3773ed5

Please sign in to comment.