Permalink
Browse files

adding guard and spork

  • Loading branch information...
1 parent 5e82253 commit 880f683ff0017ae594949af204aeb4b98dd04f43 Hanif, Hakimuddin committed May 11, 2014
Showing with 132 additions and 0 deletions.
  1. +2 −0 Gemfile
  2. +43 −0 Gemfile.lock
  3. +26 −0 Guardfile
  4. +7 −0 spec/requests/static_pages_spec.rb
  5. +54 −0 spec/spec_helper.rb
View
@@ -7,6 +7,8 @@ gem 'rails', '4.0.5'
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
+ gem 'guard-rspec', '2.5.0'
+ gem 'spork-rails', '4.0.0'
end
group :test do
View
@@ -33,8 +33,14 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
+ celluloid (0.15.2)
+ timers (~> 1.1.0)
+ celluloid-io (0.15.0)
+ celluloid (>= 0.15.0)
+ nio4r (>= 0.5.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
+ coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
@@ -46,6 +52,16 @@ GEM
erubis (2.7.0)
execjs (2.0.2)
ffi (1.9.3)
+ formatador (0.2.4)
+ guard (2.6.1)
+ formatador (>= 0.2.4)
+ listen (~> 2.7)
+ lumberjack (~> 1.0)
+ pry (>= 0.9.12)
+ thor (>= 0.18.1)
+ guard-rspec (2.5.0)
+ guard (>= 1.1)
+ rspec (~> 2.11)
hike (1.2.3)
i18n (0.6.9)
jbuilder (1.0.2)
@@ -54,17 +70,29 @@ GEM
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
+ listen (2.7.4)
+ celluloid (>= 0.15.2)
+ celluloid-io (>= 0.15.0)
+ rb-fsevent (>= 0.9.3)
+ rb-inotify (>= 0.9)
+ lumberjack (1.0.5)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
+ method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.5.3)
minitest (4.7.5)
multi_json (1.10.0)
+ nio4r (1.0.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
pg (0.15.1)
polyglot (0.3.4)
+ pry (0.9.12.6)
+ coderay (~> 1.0)
+ method_source (~> 0.8)
+ slop (~> 3.4)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
@@ -87,8 +115,15 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.1)
+ rb-fsevent (0.9.4)
+ rb-inotify (0.9.4)
+ ffi (>= 0.5.0)
rdoc (3.12.2)
json (~> 1.4)
+ rspec (2.13.0)
+ rspec-core (~> 2.13.0)
+ rspec-expectations (~> 2.13.0)
+ rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
@@ -114,6 +149,11 @@ GEM
multi_json (~> 1.0)
rubyzip (< 1.0.0)
websocket (~> 1.0.4)
+ slop (3.5.0)
+ spork (1.0.0rc4)
+ spork-rails (4.0.0)
+ rails (>= 3.0.0, < 5)
+ spork (>= 1.0rc0)
sprockets (2.12.1)
hike (~> 1.2)
multi_json (~> 1.0)
@@ -127,6 +167,7 @@ GEM
thor (0.19.1)
thread_safe (0.3.3)
tilt (1.4.1)
+ timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
@@ -146,6 +187,7 @@ PLATFORMS
DEPENDENCIES
capybara (= 2.1.0)
coffee-rails (= 4.0.1)
+ guard-rspec (= 2.5.0)
jbuilder (= 1.0.2)
jquery-rails (= 3.0.4)
pg (= 0.15.1)
@@ -155,6 +197,7 @@ DEPENDENCIES
sass-rails (= 4.0.1)
sdoc (= 0.3.20)
selenium-webdriver (= 2.35.1)
+ spork-rails (= 4.0.0)
sqlite3 (= 1.3.8)
turbolinks (= 1.1.1)
uglifier (= 2.1.1)
View
@@ -0,0 +1,26 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+require 'active_support/inflector'
+
+guard 'rspec' , 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" }
+
+ # Rails example
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_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('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' }
+end
+
@@ -10,6 +10,13 @@
expect(page).to have_content('Sample App')
end
+
+ it "should have title Home" do
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
+ visit '/static_pages/home'
+
+ expect(page).to have_title("Home")
+ end
end
describe "Help page" do
View
@@ -1,3 +1,52 @@
+require 'rubygems'
+require 'spork'
+#uncomment the following line to use spork with the debugger
+#require 'spork/ext/ruby-debug'
+
+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.
+
+end
+
+Spork.each_run do
+ # This code will be run each time you run your specs.
+
+end
+
+# --- Instructions ---
+# Sort the contents of this file into a Spork.prefork and a Spork.each_run
+# block.
+#
+# The Spork.prefork block is run only once when the spork server is started.
+# You typically want to place most of your (slow) initializer code in here, in
+# particular, require'ing any 3rd-party gems that you don't normally modify
+# during development.
+#
+# The Spork.each_run block is run each time you run your specs. In case you
+# need to load files that tend to change during development, require them here.
+# With Rails, your application modules are loaded automatically, so sometimes
+# this block can remain empty.
+#
+# Note: You can modify files loaded *from* the Spork.each_run block without
+# restarting the spork server. However, this file itself will not be reloaded,
+# so if you change any of the code inside the each_run block, you still need to
+# restart the server. In general, if you have non-trivial code in this file,
+# it's advisable to move it into a separate file so you can easily edit it
+# without restarting spork. (For example, with RSpec, you could move
+# non-trivial code into a file spec/support/my_helper.rb, making sure that the
+# spec/support/* files are require'd from inside the each_run block.)
+#
+# Any code that is left outside the two blocks will be run during preforking
+# *and* during each_run -- that's probably not what you want.
+#
+# 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 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
@@ -42,3 +91,8 @@
config.include Capybara::DSL
end
+
+Spork.each_run do
+ # This code will be run each time you run your specs.
+
+end

0 comments on commit 880f683

Please sign in to comment.