Commit f8e0f065

mo k <mo@mokhan.ca>
2011-08-03 01:52:32
add guard and factory girl factory for user.
1 parent b7f5339
config/environments/test.rb
@@ -32,4 +32,5 @@ Cake::Application.configure do
 
   # Print deprecation notices to the stderr
   config.active_support.deprecation = :stderr
+  config.action_mailer.default_url_options = { :host => 'www.blah.com'}
 end
spec/controllers/creations_controller_spec.rb
@@ -1,12 +1,11 @@
 require 'spec_helper'
 
-# This spec was generated by rspec-rails when you ran the scaffold generator.
-# It demonstrates how one might use RSpec to specify the controller code that
-# was generated by the Rails when you ran the scaffold generator.
-
 describe CreationsController do
   include Devise::TestHelpers
 
+  let(:user){ Factory.create(:user) }
+  let(:creation){ Factory.create(:creation) }
+
   def mock_user(stubs={})
     @mock_user ||= mock_model(User, stubs).as_null_object
   end
spec/factories/user.rb
@@ -0,0 +1,5 @@
+Factory.define :user, :class => User do |u|
+  u.name 'mo'
+  u.email 'mo@cakeside.com'
+  u.password 'password'
+end
spec/spec_helper.rb
@@ -2,6 +2,7 @@
 ENV["RAILS_ENV"] ||= 'test'
 require File.expand_path("../../config/environment", __FILE__)
 require 'rspec/rails'
+require 'capybara/rspec'
 
 # Requires supporting ruby files with custom matchers and macros, etc,
 # in spec/support/ and its subdirectories.
@@ -18,7 +19,7 @@ RSpec.configure do |config|
   config.mock_with :rspec
 
   # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
-  config.fixture_path = "#{::Rails.root}/spec/fixtures"
+  # 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, remove the following line or assign false
.rvmrc
@@ -0,0 +1,1 @@
+rvm 1.9.2@cakeside --create
Gemfile
@@ -1,10 +1,6 @@
 source 'http://rubygems.org'
 
 gem 'rails'
-
-# Bundle edge Rails instead:
-# gem 'rails', :git => 'git://github.com/rails/rails.git'
-
 gem 'rake'
 gem 'sqlite3-ruby', :require => 'sqlite3'
 gem 'devise'
@@ -20,29 +16,24 @@ gem 'thinking-sphinx'
 gem 'fog'
 gem 'kaminari'
 gem 'acts-as-taggable-on'
-
-# Use unicorn as the web server
-# gem 'unicorn'
-
-# Deploy with Capistrano
 gem 'capistrano'
 
-# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
-# gem 'ruby-debug'
-# gem 'ruby-debug19'
-
-# Bundle the extra gems:
-# gem 'bj'
-# gem 'nokogiri'
-# gem 'aws-s3', :require => 'aws/s3'
-
-# Bundle gems for the local environment. Make sure to
-# put test-only gems in this group so their generators
-# and rake tasks are available in development mode:
- group :development, :test do
-   gem 'webrat'
-   gem 'rspec-rails'
- end
- group :production do
-   gem 'pg'
- end
+group :development, :test do
+  gem 'webrat'
+  gem 'rspec-rails'
+  gem 'jasmine'
+end
+group :test do
+  gem 'factory_girl_rails'
+  gem 'capybara'
+  gem 'guard-rspec'
+  gem 'guard-livereload'
+  gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
+  gem 'growl', :require => false if RUBY_PLATFORM =~ /darwin/i
+  # linux part is not tested
+  gem 'rb-inotify', :require => false if RUBY_PLATFORM =~ /linux/i
+  gem 'libnotify', :require => false if RUBY_PLATFORM =~ /linux/i
+end
+group :production do
+  gem 'pg'
+end
Gemfile.lock
@@ -30,54 +30,88 @@ GEM
       activesupport (= 3.0.9)
     activesupport (3.0.9)
     acts-as-taggable-on (2.0.6)
-    addressable (2.2.4)
+    addressable (2.2.6)
     arel (2.0.10)
     bcrypt-ruby (2.1.4)
     builder (2.1.2)
-    capistrano (2.6.0)
+    capistrano (2.8.0)
       highline
       net-scp (>= 1.0.0)
       net-sftp (>= 2.0.0)
       net-ssh (>= 2.0.14)
       net-ssh-gateway (>= 1.1.0)
+    capybara (1.0.0)
+      mime-types (>= 1.16)
+      nokogiri (>= 1.3.3)
+      rack (>= 1.0.0)
+      rack-test (>= 0.5.4)
+      selenium-webdriver (~> 0.2.0)
+      xpath (~> 0.1.4)
     carrierwave (0.5.6)
       activesupport (~> 3.0)
+    childprocess (0.2.0)
+      ffi (~> 1.0.6)
     devise (1.4.2)
       bcrypt-ruby (~> 2.1.2)
       orm_adapter (~> 0.0.3)
       warden (~> 1.0.3)
     diff-lcs (1.1.2)
+    em-websocket (0.3.1)
+      addressable (>= 2.1.1)
+      eventmachine (>= 0.12.9)
     erubis (2.6.6)
       abstract (>= 1.0.0)
+    eventmachine (0.12.10)
     excon (0.6.5)
-    faraday (0.6.1)
-      addressable (~> 2.2.4)
+    factory_girl (2.0.2)
+    factory_girl_rails (1.1.0)
+      factory_girl (~> 2.0.0)
+      railties (>= 3.0.0)
+    faraday (0.7.4)
+      addressable (~> 2.2.6)
       multipart-post (~> 1.1.0)
-      rack (< 2, >= 1.1.0)
-    fog (0.9.0)
+      rack (>= 1.1.0, < 2)
+    ffi (1.0.9)
+    fog (0.10.0)
       builder
-      excon (~> 0.6.1)
-      formatador (>= 0.1.3)
-      json
+      excon (~> 0.6.5)
+      formatador (~> 0.2.0)
       mime-types
-      net-scp (>= 1.0.4)
-      net-ssh (>= 2.1.4)
-      nokogiri (>= 1.4.4)
+      multi_json (~> 1.0.3)
+      net-scp (~> 1.0.4)
+      net-ssh (~> 2.1.4)
+      nokogiri (~> 1.5.0)
       ruby-hmac
     formatador (0.2.0)
-    heroku (2.3.6)
+    guard (0.5.1)
+      thor (~> 0.14.6)
+    guard-livereload (0.2.1)
+      em-websocket (>= 0.2.0)
+      guard (>= 0.4.0)
+      json (>= 1.5.1)
+    guard-rspec (0.4.0)
+      guard (>= 0.4.0)
+    heroku (2.4.0)
       launchy (>= 0.3.2)
       rest-client (~> 1.6.1)
       term-ansicolor (~> 1.0.5)
     highline (1.6.2)
     i18n (0.5.0)
+    jasmine (1.0.2.1)
+      json_pure (>= 1.4.3)
+      rack (>= 1.1)
+      rspec (>= 1.3.1)
+      selenium-webdriver (>= 0.1.3)
     jquery-rails (1.0.12)
       railties (~> 3.0)
       thor (~> 0.14)
     json (1.5.3)
+    json_pure (1.5.3)
     kaminari (0.12.4)
       rails (>= 3.0.0)
-    launchy (2.0.3)
+    launchy (2.0.5)
+      addressable (~> 2.2.6)
+    libnotify (0.5.7)
     mail (2.2.19)
       activesupport (>= 2.3.6)
       i18n (>= 0.4.0)
@@ -85,9 +119,7 @@ GEM
       treetop (~> 1.4.8)
     mime-types (1.16)
     multi_json (1.0.3)
-    multi_xml (0.2.2)
-    multipart-post (1.1.2)
-    net-ldap (0.2.2)
+    multipart-post (1.1.3)
     net-scp (1.0.4)
       net-ssh (>= 1.99.1)
     net-sftp (2.0.5)
@@ -95,54 +127,36 @@ GEM
     net-ssh (2.1.4)
     net-ssh-gateway (1.1.0)
       net-ssh (>= 1.99.1)
-    nokogiri (1.4.7)
-    oa-basic (0.2.6)
-      oa-core (= 0.2.6)
-      rest-client (~> 1.6.0)
-    oa-core (0.2.6)
-    oa-enterprise (0.2.6)
-      addressable (= 2.2.4)
-      net-ldap (~> 0.2.2)
-      nokogiri (~> 1.4.2)
-      oa-core (= 0.2.6)
-      pyu-ruby-sasl (~> 0.0.3.1)
-      rubyntlm (~> 0.1.1)
-    oa-more (0.2.6)
-      multi_json (~> 1.0.0)
-      oa-core (= 0.2.6)
-      rest-client (~> 1.6.0)
-    oa-oauth (0.2.6)
-      faraday (~> 0.6.1)
-      multi_json (~> 1.0.0)
-      multi_xml (~> 0.2.2)
-      oa-core (= 0.2.6)
-      oauth (~> 0.4.0)
-      oauth2 (~> 0.4.1)
-    oa-openid (0.2.6)
-      oa-core (= 0.2.6)
-      rack-openid (~> 1.3.1)
-      ruby-openid-apps-discovery (~> 1.2.0)
+    nokogiri (1.5.0)
+    oa-core (0.0.5)
+      rack (~> 1.1)
+    oa-oauth (0.0.1)
+      json
+      nokogiri
+      oa-core (~> 0.0.0)
+      oauth
+      oauth2
+    oa-openid (0.0.5)
+      oa-core (= 0.0.5)
+      rack-openid (~> 1.1.1)
+      ruby-openid-apps-discovery
     oauth (0.4.5)
-    oauth2 (0.4.1)
-      faraday (~> 0.6.1)
-      multi_json (>= 0.0.5)
-    omniauth (0.2.6)
-      oa-basic (= 0.2.6)
-      oa-core (= 0.2.6)
-      oa-enterprise (= 0.2.6)
-      oa-more (= 0.2.6)
-      oa-oauth (= 0.2.6)
-      oa-openid (= 0.2.6)
+    oauth2 (0.5.0)
+      faraday (>= 0.6.1, < 0.8)
+      multi_json (~> 1.0.0)
+    omniauth (0.0.1)
+      oa-core (~> 0.0.0)
+      oa-oauth (~> 0.0.0)
+      oa-openid (~> 0.0.0)
     orm_adapter (0.0.5)
     pg (0.11.0)
-    polyglot (0.3.1)
-    pyu-ruby-sasl (0.0.3.3)
+    polyglot (0.3.2)
     rack (1.2.3)
     rack-mount (0.6.14)
       rack (>= 1.0.0)
-    rack-openid (1.3.1)
-      rack (>= 1.1.0)
-      ruby-openid (>= 2.1.8)
+    rack-openid (1.1.2)
+      rack (>= 0.4)
+      ruby-openid (>= 2.0.3)
     rack-test (0.5.7)
       rack (>= 1.0)
     rails (3.0.9)
@@ -160,10 +174,12 @@ GEM
       rdoc (~> 3.4)
       thor (~> 0.14.4)
     rake (0.9.2)
-    rdoc (3.8)
+    rb-inotify (0.8.6)
+      ffi (>= 0.5.0)
+    rdoc (3.9.1)
     rest-client (1.6.3)
       mime-types (>= 1.16)
-    riddle (1.3.3)
+    riddle (1.4.0)
     rmagick (2.13.1)
     rspec (2.6.0)
       rspec-core (~> 2.6.0)
@@ -182,24 +198,32 @@ GEM
     ruby-openid (2.1.8)
     ruby-openid-apps-discovery (1.2.0)
       ruby-openid (>= 2.1.7)
-    rubyntlm (0.1.1)
-    sqlite3 (1.3.3)
+    rubyzip (0.9.4)
+    selenium-webdriver (0.2.2)
+      childprocess (>= 0.1.9)
+      ffi (>= 1.0.7)
+      json_pure
+      rubyzip
+    sqlite3 (1.3.4)
     sqlite3-ruby (1.3.3)
       sqlite3 (>= 1.3.3)
-    term-ansicolor (1.0.5)
+    term-ansicolor (1.0.6)
     thinking-sphinx (2.0.5)
       activerecord (>= 3.0.3)
       riddle (>= 1.3.3)
     thor (0.14.6)
-    treetop (1.4.9)
+    treetop (1.4.10)
+      polyglot
       polyglot (>= 0.3.1)
     tzinfo (0.3.29)
-    warden (1.0.4)
+    warden (1.0.5)
       rack (>= 1.0)
     webrat (0.7.3)
       nokogiri (>= 1.2.0)
       rack (>= 1.0)
       rack-test (>= 0.5.3)
+    xpath (0.1.4)
+      nokogiri (~> 1.3)
 
 PLATFORMS
   ruby
@@ -209,17 +233,24 @@ DEPENDENCIES
   acts-as-taggable-on
   bcrypt-ruby
   capistrano
+  capybara
   carrierwave
   devise
+  factory_girl_rails
   fog
+  guard-livereload
+  guard-rspec
   heroku
+  jasmine
   jquery-rails
   json
   kaminari
+  libnotify
   omniauth
   pg
   rails
   rake
+  rb-inotify
   rmagick
   rspec-rails
   sqlite3-ruby
Guardfile
@@ -0,0 +1,28 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+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)\.scss}) { |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