Commits

Josh Hubbard committed 97f6cd2

Updated factory girl to 4.2 (current latest). Updated some of the factories.

Comments (0)

Files changed (5)

 group :test do
   gem 'rspec', '2.10.0'
   gem 'capybara', '1.1.2'
-  gem 'factory_girl_rails', '1.4.0'
-  gem 'ladle'
+  gem 'factory_girl_rails', '4.2.0'
+  gem 'ladle', '0.2.0'
   gem 'spork', '0.9.0'
   gem 'guard-spork', '0.3.2'
   gem 'rb-fsevent', '0.4.3.1', require: false
+  gem 'rb-inotify', '~> 0.9'
 end
 
 
     diff-lcs (1.1.3)
     erubis (2.6.6)
       abstract (>= 1.0.0)
-    factory_girl (2.3.2)
-      activesupport
-    factory_girl_rails (1.4.0)
-      factory_girl (~> 2.3.0)
+    factory_girl (4.2.0)
+      activesupport (>= 3.0.0)
+    factory_girl_rails (4.2.1)
+      factory_girl (~> 4.2.0)
       railties (>= 3.0.0)
     faraday (0.6.1)
       addressable (~> 2.2.4)
       thor (~> 0.14.4)
     rake (10.0.4)
     rb-fsevent (0.4.3.1)
+    rb-inotify (0.9.0)
+      ffi (>= 0.5.0)
     rdoc (3.12.2)
       json (~> 1.4)
     recaptcha (0.3.5)
 DEPENDENCIES
   annotate (= 2.4.0)
   capybara (= 1.1.2)
-  factory_girl_rails (= 1.4.0)
+  factory_girl_rails
   gravatar_image_tag (= 1.0.0.pre2)
   guard-spork (= 0.3.2)
   htmlentities
   omniauth (~> 0.2.6)
   rails (= 3.0.20)
   rb-fsevent (= 0.4.3.1)
+  rb-inotify (~> 0.9)
   recaptcha
   rspec (= 2.10.0)
   rspec-rails (= 2.10.0)

spec/controllers/users_controller_spec.rb

   describe "GET 'show'" do
     
     before (:each) do
-      @user = Factory(:user)
+      @user = FactoryGirl.create(:user)
     end
   
     it "should be successful" do
 # and the plans models
 
 FactoryGirl.define do
+  factory :non_partner_institution, class: Institution do
+    sequence(:name) { |n| "nonPartnerInstitution" }
+    initialize_with { Institution.find_or_create_by_name(name) }
+  end
+
+  factory :institution do
+    sequence(:name) { |n| "University of California - Campus #{n}" }
+    sequence(:nickname) { |n| "UC#{n}" }
+    contact_email 'uc3@ucop.edu'
+    contact_info 'CDL/UC3'
+    url 'dmptool.org'
+    sequence(:url_text) { |n| "University of California - Campus #{n} Website" }
+  end
 
   factory :user do
-    first_name "Test"
-    last_name "User"
-    nonPartnerInstitution "CDL"
+    sequence(:first_name) { |n| "First Name #{n}"}
+    sequence(:last_name) { |n| "Last Name #{n}"}
+    sequence(:email) { |n| "thisisatestemail#{n}@ucop.edu" }
+    nonPartnerInstitution 'CDL'
+    association :institution, factory: :non_partner_institution
   end
 
-
   sequence :email do
     "person#{n}@example.com"
   end
 
   factory :plan do
-    name "Test User NSF Plan"
-    solicitation_no "123"
-    desc "this is a test plan for user test user"
-    association :user
+    sequence(:name) { |n| "Test User NSF Plan #{n}" }
+    sequence(:solicitation_no) { |n| "123#{n}" }
+    desc 'This is a test plan for user test user.'
+    :user
   end
-
 end
 Spork.each_run do
   # This code will be run each time you run your specs.
   DmpTool::Application.reload_routes!
+  FactoryGirl.reload
   Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
 end
 
   # examples within a transaction, remove the following line or assign false
   # instead of true.
   config.use_transactional_fixtures = true
+
+  config.infer_base_class_for_anonymous_controllers = false
 end