[Groonga-commit] ranguba/groonga-client-rails at ffc6c06 [master] Use Factory Girl in controller tests

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Mar 21 11:29:13 JST 2016


Kouhei Sutou	2016-03-21 11:29:13 +0900 (Mon, 21 Mar 2016)

  New Revision: ffc6c0601f4a1fa7ffaf31c33260160bf1b555a6
  https://github.com/ranguba/groonga-client-rails/commit/ffc6c0601f4a1fa7ffaf31c33260160bf1b555a6

  Message:
    Use Factory Girl in controller tests

  Added files:
    test/fixtures/rails4-mongoid/test/factories/posts.rb
  Removed files:
    test/fixtures/rails4-mongoid/test/fixtures/.keep
    test/fixtures/rails4-mongoid/test/fixtures/posts.yml
  Modified files:
    test/fixtures/rails4-mongoid/test/controllers/posts_controller_test.rb
    test/fixtures/rails4-mongoid/test/test_helper.rb

  Modified: test/fixtures/rails4-mongoid/test/controllers/posts_controller_test.rb (+1 -1)
===================================================================
--- test/fixtures/rails4-mongoid/test/controllers/posts_controller_test.rb    2016-03-21 11:26:39 +0900 (e8efadf)
+++ test/fixtures/rails4-mongoid/test/controllers/posts_controller_test.rb    2016-03-21 11:29:13 +0900 (a8fbf2a)
@@ -2,7 +2,7 @@ require 'test_helper'
 
 class PostsControllerTest < ActionController::TestCase
   setup do
-    @post = posts(:one)
+    @post = create(:post)
   end
 
   test "should get index" do

  Added: test/fixtures/rails4-mongoid/test/factories/posts.rb (+6 -0) 100644
===================================================================
--- /dev/null
+++ test/fixtures/rails4-mongoid/test/factories/posts.rb    2016-03-21 11:29:13 +0900 (28b7437)
@@ -0,0 +1,6 @@
+FactoryGirl.define do
+  factory :post do
+    title "MyString"
+    body "MyText"
+  end
+end

  Deleted: test/fixtures/rails4-mongoid/test/fixtures/.keep (+0 -0) 100644
===================================================================
--- test/fixtures/rails4-mongoid/test/fixtures/.keep    2016-03-21 11:26:39 +0900 (e69de29)
+++ /dev/null

  Deleted: test/fixtures/rails4-mongoid/test/fixtures/posts.yml (+0 -9) 100644
===================================================================
--- test/fixtures/rails4-mongoid/test/fixtures/posts.yml    2016-03-21 11:26:39 +0900 (e192dee)
+++ /dev/null
@@ -1,9 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-
-one:
-  title: MyString
-  body: MyText
-
-two:
-  title: MyString
-  body: MyText

  Modified: test/fixtures/rails4-mongoid/test/test_helper.rb (+1 -0)
===================================================================
--- test/fixtures/rails4-mongoid/test/test_helper.rb    2016-03-21 11:26:39 +0900 (3acf9ae)
+++ test/fixtures/rails4-mongoid/test/test_helper.rb    2016-03-21 11:29:13 +0900 (2d79611)
@@ -4,4 +4,5 @@ require 'rails/test_help'
 
 class ActiveSupport::TestCase
   # Add more helper methods to be used by all tests here...
+  include FactoryGirl::Syntax::Methods
 end
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index