Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

:heart: Guard, fixed specs to work with latest factory girl.

  • Loading branch information...
commit 5606ea4cccf75a7c780944fccf1048255966324c 1 parent 6978925
@jrgifford jrgifford authored
View
4 Gemfile
@@ -5,6 +5,8 @@ gem 'rails', '3.2.11'
group :development, :test do
gem 'sqlite3'
+ gem 'guard'
+ gem 'guard-rspec'
end
# Database adapters
gem 'pg', '0.12.2'
@@ -45,6 +47,6 @@ end
group :test do
gem 'rspec-rails'
gem 'shoulda-matchers'
- gem 'factory_girl_rails'
+ gem 'factory_girl_rails', '~> 3.0'
gem 'jasmine', :git => "https://github.com/pivotal/jasmine-gem.git", :branch => "1.2.rc1", :group => [:development, :test]
end
View
27 Gemfile.lock
@@ -78,6 +78,7 @@ GEM
cocaine (>= 0.0.2)
mime-types
cocaine (0.2.1)
+ coderay (1.0.8)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
@@ -109,12 +110,20 @@ GEM
eventmachine (0.12.10)
execjs (1.3.0)
multi_json (~> 1.0)
- factory_girl (4.1.0)
+ factory_girl (3.1.0)
activesupport (>= 3.0.0)
- factory_girl_rails (4.1.0)
- factory_girl (~> 4.1.0)
+ factory_girl_rails (3.1.0)
+ factory_girl (~> 3.1.0)
railties (>= 3.0.0)
ffi (1.3.0)
+ guard (1.6.1)
+ listen (>= 0.6.0)
+ lumberjack (>= 1.0.2)
+ pry (>= 0.9.10)
+ thor (>= 0.14.6)
+ guard-rspec (2.3.3)
+ guard (>= 1.1)
+ rspec (~> 2.11)
highline (1.6.11)
hike (1.2.1)
httparty (0.8.1)
@@ -134,11 +143,14 @@ GEM
libwebsocket (0.1.7.1)
addressable
websocket
+ listen (0.7.1)
+ lumberjack (1.0.2)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
+ method_source (0.8.1)
mime-types (1.19)
mocha (0.10.5)
metaclass (~> 0.0.1)
@@ -148,6 +160,10 @@ GEM
orm_adapter (0.0.6)
pg (0.12.2)
polyglot (0.3.3)
+ pry (0.9.10)
+ coderay (~> 1.0.5)
+ method_source (~> 0.8)
+ slop (~> 3.3.1)
rack (1.4.3)
rack-cache (1.2)
rack (>= 0.4)
@@ -207,6 +223,7 @@ GEM
shoulda-matchers (1.4.2)
activesupport (>= 3.0.0)
bourne (~> 1.1.2)
+ slop (3.3.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
@@ -247,7 +264,9 @@ DEPENDENCIES
devise_cloudfuji_authenticatable
eco
execjs
- factory_girl_rails
+ factory_girl_rails (~> 3.0)
+ guard
+ guard-rspec
jasmine!
jquery-rails
kaminari
View
37 Guardfile
@@ -0,0 +1,37 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+
+guard 'rspec' 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
+
+
+guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } 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 }
+ watch('test/test_helper.rb') { :test_unit }
+ watch(%r{features/support/}) { :cucumber }
+end
View
5 spec/factories.rb
@@ -7,6 +7,10 @@
"email#{n}@example.com"
end
+ sequence :password do |n|
+ "#{rand(11111111...99999999)}"
+ end
+
factory :channel do |f|
f.name "Test channel"
end
@@ -14,6 +18,7 @@
factory :user do |f|
f.first_name "Test"
f.last_name "User"
+ f.password { Factory.next(:password)}
f.email { Factory.next(:email) }
f.ido_id { Factory.next(:ido_id) }
end
View
6 spec/models/user_spec.rb
@@ -8,12 +8,12 @@
end
it "should have authentication token on creation" do
- @user = Factory :user
+ @user = FactoryGirl.create(:user)
@user.authentication_token.should_not be_nil
end
it "should have gravatar hash on creation" do
- @user = Factory :user
+ @user = FactoryGirl.create(:user)
@user.gravatar_hash.should_not be_nil
end
-end
+end
View
2  spec/spec_helper.rb
@@ -4,7 +4,7 @@
require 'rspec/rails'
require 'rspec/autorun'
require "#{Rails.root}/lib/active_users.rb"
-
+require 'factory_girl'
# 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}
Please sign in to comment.
Something went wrong with that request. Please try again.