From 00eb839aec809f6a4a6c2f09b2e11175a3dc2437 Mon Sep 17 00:00:00 2001 From: Alex Soulim Date: Tue, 29 Mar 2011 10:54:52 +0400 Subject: [PATCH] All factories have been moved to spec/factories directory --- Gemfile | 2 +- Gemfile.lock | 52 ++++++++++++++++++-------------- spec/factories/authentication.rb | 5 +++ spec/factories/comment.rb | 5 +++ spec/factories/item.rb | 5 +++ spec/factories/user.rb | 13 ++++++++ spec/spec_helper.rb | 2 +- spec/support/factories.rb | 31 ------------------- 8 files changed, 60 insertions(+), 55 deletions(-) create mode 100644 spec/factories/authentication.rb create mode 100644 spec/factories/comment.rb create mode 100644 spec/factories/item.rb create mode 100644 spec/factories/user.rb delete mode 100644 spec/support/factories.rb diff --git a/Gemfile b/Gemfile index c8fd7c4..f9227c5 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ end group :test do gem 'rspec' - gem 'factory_girl' + gem 'factory_girl_rails' end group :staging, :production do diff --git a/Gemfile.lock b/Gemfile.lock index 20cd99a..f86119b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,11 +37,14 @@ GEM addressable (2.2.4) arel (2.0.9) builder (2.1.2) - cancan (1.5.1) + cancan (1.6.3) diff-lcs (1.1.2) erubis (2.6.6) abstract (>= 1.0.0) factory_girl (1.3.3) + factory_girl_rails (1.0.1) + factory_girl (~> 1.3) + railties (>= 3.0.0) faraday (0.5.7) addressable (~> 2.2.4) multipart-post (~> 1.1.0) @@ -58,46 +61,51 @@ GEM mime-types (1.16) multi_json (0.0.5) multipart-post (1.1.0) - mysql2 (0.2.6) + mysql2 (0.2.7) net-ldap (0.1.1) nokogiri (1.4.4) - oa-basic (0.1.6) + oa-basic (0.2.0) multi_json (~> 0.0.2) nokogiri (~> 1.4.2) - oa-core (= 0.1.6) + oa-core (= 0.2.0) rest-client (~> 1.6.0) - oa-core (0.1.6) + oa-core (0.2.0) rack (~> 1.1) - oa-enterprise (0.1.6) + oa-enterprise (0.2.0) net-ldap (~> 0.1.1) nokogiri (~> 1.4.2) - oa-core (= 0.1.6) + oa-core (= 0.2.0) pyu-ruby-sasl (~> 0.0.3.1) rubyntlm (~> 0.1.1) - oa-oauth (0.1.6) + oa-more (0.2.0) + multi_json (~> 0.0.2) + oa-core (= 0.2.0) + rest-client (~> 1.6.0) + oa-oauth (0.2.0) multi_json (~> 0.0.2) nokogiri (~> 1.4.2) - oa-core (= 0.1.6) + oa-core (= 0.2.0) oauth (~> 0.4.0) - oauth2 (~> 0.1.0) - oa-openid (0.1.6) - oa-core (= 0.1.6) + oauth2 (~> 0.1.1) + oa-openid (0.2.0) + oa-core (= 0.2.0) rack-openid (~> 1.2.0) ruby-openid-apps-discovery oauth (0.4.4) oauth2 (0.1.1) faraday (~> 0.5.0) multi_json (~> 0.0.4) - omniauth (0.1.6) - oa-basic (= 0.1.6) - oa-core (= 0.1.6) - oa-enterprise (= 0.1.6) - oa-oauth (= 0.1.6) - oa-openid (= 0.1.6) + omniauth (0.2.0) + oa-basic (= 0.2.0) + oa-core (= 0.2.0) + oa-enterprise (= 0.2.0) + oa-more (= 0.2.0) + oa-oauth (= 0.2.0) + oa-openid (= 0.2.0) polyglot (0.3.1) pyu-ruby-sasl (0.0.3.2) - rack (1.2.1) - rack-mount (0.6.13) + rack (1.2.2) + rack-mount (0.6.14) rack (>= 1.0.0) rack-openid (1.2.0) rack (>= 1.1.0) @@ -148,7 +156,7 @@ GEM thor (0.14.6) treetop (1.4.9) polyglot (>= 0.3.1) - tzinfo (0.3.24) + tzinfo (0.3.25) will_paginate (3.0.pre2) PLATFORMS @@ -157,7 +165,7 @@ PLATFORMS DEPENDENCIES cancan exception_notification! - factory_girl + factory_girl_rails jquery-rails mysql2 omniauth diff --git a/spec/factories/authentication.rb b/spec/factories/authentication.rb new file mode 100644 index 0000000..27d5c58 --- /dev/null +++ b/spec/factories/authentication.rb @@ -0,0 +1,5 @@ +Factory.define :authentication do |f| + f.sequence(:uid) { |n| "foo-#{n}" } + f.provider "foo" + f.association :user +end \ No newline at end of file diff --git a/spec/factories/comment.rb b/spec/factories/comment.rb new file mode 100644 index 0000000..692ce66 --- /dev/null +++ b/spec/factories/comment.rb @@ -0,0 +1,5 @@ +Factory.define :comment do |f| + f.markdown "**bar**" + f.association :item + f.association :user +end \ No newline at end of file diff --git a/spec/factories/item.rb b/spec/factories/item.rb new file mode 100644 index 0000000..365340e --- /dev/null +++ b/spec/factories/item.rb @@ -0,0 +1,5 @@ +Factory.define :item do |f| + f.title "foo" + f.markdown "**bar**" + f.association :user +end \ No newline at end of file diff --git a/spec/factories/user.rb b/spec/factories/user.rb new file mode 100644 index 0000000..a9b405e --- /dev/null +++ b/spec/factories/user.rb @@ -0,0 +1,13 @@ +Factory.define :user do |f| + f.name "John 'user' Doe" + f.email "user@example.com" + f.avatar_url "" + f.role 0 +end + +Factory.define :admin do |f| + f.name "John 'admin' Doe" + f.email "admin@example.com" + f.avatar_url "" + f.role 1 +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 892a79b..671e6d1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,7 +18,7 @@ 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 diff --git a/spec/support/factories.rb b/spec/support/factories.rb deleted file mode 100644 index a985436..0000000 --- a/spec/support/factories.rb +++ /dev/null @@ -1,31 +0,0 @@ -Factory.define :user do |f| - f.name "John 'user' Doe" - f.email "user@example.com" - f.avatar_url "" - f.role 0 -end - -Factory.define :admin do |f| - f.name "John 'admin' Doe" - f.email "admin@example.com" - f.avatar_url "" - f.role 1 -end - -Factory.define :authentication do |f| - f.sequence(:uid) { |n| "foo-#{n}" } - f.provider "foo" - f.association :user -end - -Factory.define :item do |f| - f.title "foo" - f.markdown "**bar**" - f.association :user -end - -Factory.define :comment do |f| - f.markdown "**bar**" - f.association :item - f.association :user -end \ No newline at end of file