[from now] 2014/11/26 18:39:39

diff --git a/Gemfile b/Gemfile
index 01b6209..6aa1b5a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -71,7 +71,8 @@ end

 group :test do
   gem 'coveralls', require: false
-  gem "codeclimate-test-reporter", require: false
+  gem 'codeclimate-test-reporter', require: false
+  gem 'factory_girl_rails'
 end

 group :doc do
[from now] 2014/11/26 19:01:47

diff --git a/Gemfile.lock b/Gemfile.lock
index 904680a..0cecec7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -102,6 +102,11 @@ GEM
     docile (1.1.5)
     erubis (2.7.0)
     execjs (2.2.2)
+    factory_girl (4.5.0)
+      activesupport (>= 3.0.0)
+    factory_girl_rails (4.5.0)
+      factory_girl (~> 4.5.0)
+      railties (>= 3.0.0)
     feedbag (0.9.5)
       nokogiri (~> 1.0)
     feedjira (1.5.0)
@@ -307,6 +312,7 @@ DEPENDENCIES
   compass-rails
   coveralls
   devise
+  factory_girl_rails
   feedbag
   feedjira
   groundworkcss
diff --git a/app/models/article.rb b/app/models/article.rb
index 5532ce2..b6d58de 100644
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -7,16 +7,16 @@
 # Name                          | Type               | Attributes
 # ----------------------------- | ------------------ | ---------------------------
 # **`id`**                      | `integer`          | `not null, primary key`
-# **`feed_id`**                 | `integer`          |
+# **`feed_id`**                 | `integer`          | `indexed`
 # **`title`**                   | `string(255)`      |
 # **`url`**                     | `string(255)`      |
 # **`body`**                    | `text`             |
 # **`comment`**                 | `text`             |
 # **`kind`**                    | `integer`          |
 # **`published`**               | `datetime`         |
-# **`keyword_id`**              | `integer`          |
-# **`article_has_keyword_id`**  | `integer`          |
-# **`user_id`**                 | `integer`          |
+# **`keyword_id`**              | `integer`          | `indexed`
+# **`article_has_keyword_id`**  | `integer`          | `indexed`
+# **`user_id`**                 | `integer`          | `indexed`
 # **`misc`**                    | `text`             |
 # **`created_at`**              | `datetime`         |
 # **`updated_at`**              | `datetime`         |
diff --git a/app/models/article_has_keyword.rb b/app/models/article_has_keyword.rb
index ec5901a..88c71c4 100644
--- a/app/models/article_has_keyword.rb
+++ b/app/models/article_has_keyword.rb
@@ -7,8 +7,8 @@
 # Name              | Type               | Attributes
 # ----------------- | ------------------ | ---------------------------
 # **`id`**          | `integer`          | `not null, primary key`
-# **`article_id`**  | `integer`          |
-# **`keyword_id`**  | `integer`          |
+# **`article_id`**  | `integer`          | `indexed`
+# **`keyword_id`**  | `integer`          | `indexed`
 # **`created_at`**  | `datetime`         |
 # **`updated_at`**  | `datetime`         |
 #
diff --git a/app/models/category.rb b/app/models/category.rb
index f87ed8d..74a8224 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -8,7 +8,7 @@
 # ----------------- | ------------------ | ---------------------------
 # **`id`**          | `integer`          | `not null, primary key`
 # **`name`**        | `string(255)`      |
-# **`user_id`**     | `integer`          |
+# **`user_id`**     | `integer`          | `indexed`
 # **`misc`**        | `text`             |
 # **`created_at`**  | `datetime`         |
 # **`updated_at`**  | `datetime`         |
diff --git a/app/models/feed.rb b/app/models/feed.rb
index 87b903d..7721c38 100644
--- a/app/models/feed.rb
+++ b/app/models/feed.rb
@@ -13,8 +13,8 @@
 # **`etag`**           | `string(255)`      |
 # **`last_modified`**  | `datetime`         |
 # **`fetched_at`**     | `datetime`         |
-# **`category_id`**    | `integer`          |
-# **`user_id`**        | `integer`          |
+# **`category_id`**    | `integer`          | `indexed`
+# **`user_id`**        | `integer`          | `indexed`
 # **`misc`**           | `text`             |
 # **`created_at`**     | `datetime`         |
 # **`updated_at`**     | `datetime`         |
diff --git a/app/models/keyword.rb b/app/models/keyword.rb
index 5b8c886..30eac5b 100644
--- a/app/models/keyword.rb
+++ b/app/models/keyword.rb
@@ -8,12 +8,12 @@
 # ----------------------------- | ------------------ | ---------------------------
 # **`id`**                      | `integer`          | `not null, primary key`
 # **`name`**                    | `string(255)`      |
-# **`article_id`**              | `integer`          |
+# **`article_id`**              | `integer`          | `indexed`
 # **`value_present`**           | `float`            |
 # **`value_last_week`**         | `float`            |
 # **`value_last_month`**        | `float`            |
-# **`user_id`**                 | `integer`          |
-# **`article_has_keyword_id`**  | `integer`          |
+# **`user_id`**                 | `integer`          | `indexed`
+# **`article_has_keyword_id`**  | `integer`          | `indexed`
 # **`created_at`**              | `datetime`         |
 # **`updated_at`**              | `datetime`         |
 #
diff --git a/app/models/user.rb b/app/models/user.rb
index 93d4e7c..8b1c4b4 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -7,9 +7,9 @@
 # Name                          | Type               | Attributes
 # ----------------------------- | ------------------ | ---------------------------
 # **`id`**                      | `integer`          | `not null, primary key`
-# **`email`**                   | `string(255)`      | `default(""), not null`
+# **`email`**                   | `string(255)`      | `default(""), not null, indexed`
 # **`encrypted_password`**      | `string(255)`      | `default(""), not null`
-# **`reset_password_token`**    | `string(255)`      |
+# **`reset_password_token`**    | `string(255)`      | `indexed`
 # **`reset_password_sent_at`**  | `datetime`         |
 # **`remember_created_at`**     | `datetime`         |
 # **`sign_in_count`**           | `integer`          | `default(0), not null`
diff --git a/config/application.rb b/config/application.rb
index 635a76d..9c25fad 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -20,5 +20,10 @@ module Mensagg

     # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
     # config.i18n.default_locale = :ja
+
+    config.generators do |g|
+      g.test_framework :rspec, fixture: true
+      g.fixture_replacement :factory_girl, dir: "spec/factories"
+    end
   end
 end
diff --git a/spec/factories/categories.rb b/spec/factories/categories.rb
new file mode 100644
index 0000000..edbea5a
--- /dev/null
+++ b/spec/factories/categories.rb
@@ -0,0 +1,6 @@
+FactoryGirl.define do
+  factory :category do
+
+  end
+
+end
diff --git a/spec/models/article_has_keyword_spec.rb b/spec/models/article_has_keyword_spec.rb
index b60fe07..6d4f241 100644
--- a/spec/models/article_has_keyword_spec.rb
+++ b/spec/models/article_has_keyword_spec.rb
@@ -7,8 +7,8 @@
 # Name              | Type               | Attributes
 # ----------------- | ------------------ | ---------------------------
 # **`id`**          | `integer`          | `not null, primary key`
-# **`article_id`**  | `integer`          |
-# **`keyword_id`**  | `integer`          |
+# **`article_id`**  | `integer`          | `indexed`
+# **`keyword_id`**  | `integer`          | `indexed`
 # **`created_at`**  | `datetime`         |
 # **`updated_at`**  | `datetime`         |
 #
diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb
index 07933a8..80881ef 100644
--- a/spec/models/article_spec.rb
+++ b/spec/models/article_spec.rb
@@ -7,16 +7,16 @@
 # Name                          | Type               | Attributes
 # ----------------------------- | ------------------ | ---------------------------
 # **`id`**                      | `integer`          | `not null, primary key`
-# **`feed_id`**                 | `integer`          |
+# **`feed_id`**                 | `integer`          | `indexed`
 # **`title`**                   | `string(255)`      |
 # **`url`**                     | `string(255)`      |
 # **`body`**                    | `text`             |
 # **`comment`**                 | `text`             |
 # **`kind`**                    | `integer`          |
 # **`published`**               | `datetime`         |
-# **`keyword_id`**              | `integer`          |
-# **`article_has_keyword_id`**  | `integer`          |
-# **`user_id`**                 | `integer`          |
+# **`keyword_id`**              | `integer`          | `indexed`
+# **`article_has_keyword_id`**  | `integer`          | `indexed`
+# **`user_id`**                 | `integer`          | `indexed`
 # **`misc`**                    | `text`             |
 # **`created_at`**              | `datetime`         |
 # **`updated_at`**              | `datetime`         |
diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb
index 3c2f278..4477627 100644
--- a/spec/models/category_spec.rb
+++ b/spec/models/category_spec.rb
@@ -8,7 +8,7 @@
 # ----------------- | ------------------ | ---------------------------
 # **`id`**          | `integer`          | `not null, primary key`
 # **`name`**        | `string(255)`      |
-# **`user_id`**     | `integer`          |
+# **`user_id`**     | `integer`          | `indexed`
 # **`misc`**        | `text`             |
 # **`created_at`**  | `datetime`         |
 # **`updated_at`**  | `datetime`         |
diff --git a/spec/models/feed_spec.rb b/spec/models/feed_spec.rb
index ac0d617..b6c64e5 100644
--- a/spec/models/feed_spec.rb
+++ b/spec/models/feed_spec.rb
@@ -13,8 +13,8 @@
 # **`etag`**           | `string(255)`      |
 # **`last_modified`**  | `datetime`         |
 # **`fetched_at`**     | `datetime`         |
-# **`category_id`**    | `integer`          |
-# **`user_id`**        | `integer`          |
+# **`category_id`**    | `integer`          | `indexed`
+# **`user_id`**        | `integer`          | `indexed`
 # **`misc`**           | `text`             |
 # **`created_at`**     | `datetime`         |
 # **`updated_at`**     | `datetime`         |
diff --git a/spec/models/keyword_spec.rb b/spec/models/keyword_spec.rb
index 5b03d39..da897cc 100644
--- a/spec/models/keyword_spec.rb
+++ b/spec/models/keyword_spec.rb
@@ -8,12 +8,12 @@
 # ----------------------------- | ------------------ | ---------------------------
 # **`id`**                      | `integer`          | `not null, primary key`
 # **`name`**                    | `string(255)`      |
-# **`article_id`**              | `integer`          |
+# **`article_id`**              | `integer`          | `indexed`
 # **`value_present`**           | `float`            |
 # **`value_last_week`**         | `float`            |
 # **`value_last_month`**        | `float`            |
-# **`user_id`**                 | `integer`          |
-# **`article_has_keyword_id`**  | `integer`          |
+# **`user_id`**                 | `integer`          | `indexed`
+# **`article_has_keyword_id`**  | `integer`          | `indexed`
 # **`created_at`**              | `datetime`         |
 # **`updated_at`**              | `datetime`         |
 #
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 176e657..849a2e2 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -32,6 +32,12 @@ CodeClimate::TestReporter.start
 ActiveRecord::Migration.maintain_test_schema!

 RSpec.configure do |config|
+  # Factory Girl Rails
+  config.include FactoryGirl::Syntax::Methods
+  config.before do
+    FactoryGirl.reload
+  end
+
   # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
   config.fixture_path = "#{::Rails.root}/spec/fixtures"

@@ -40,19 +46,6 @@ RSpec.configure do |config|
   # instead of true.
   config.use_transactional_fixtures = true

-  # RSpec Rails can automatically mix in different behaviours to your tests
-  # based on their file location, for example enabling you to call `get` and
-  # `post` in specs under `spec/controllers`.
-  #
-  # You can disable this behaviour by removing the line below, and instead
-  # explicitly tag your specs with their type, e.g.:
-  #
-  #     RSpec.describe UsersController, :type => :controller do
-  #       # ...
-  #     end
-  #
-  # The different available types are documented in the features, such as in
-  # https://relishapp.com/rspec/rspec-rails/docs
   config.infer_spec_type_from_file_location!

   config.include Devise::TestHelpers, :type => :controller
[from now] 2014/11/27 10:53:44

diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 849a2e2..a4c3549 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -1,14 +1,18 @@
 # This file is copied to spec/ when you run 'rails generate rspec:install'
 ENV["RAILS_ENV"] ||= 'test'
-require 'spec_helper'
 require File.expand_path("../../config/environment", __FILE__)
 require 'rspec/rails'
+require 'spec_helper'
+
 # Add additional requires below this line. Rails is not loaded until this point!
 require 'devise'

 require 'coveralls'
 Coveralls.wear!

+require 'simplecov'
+SimpleCov.start 'rails'
+
 require 'codeclimate-test-reporter'
 CodeClimate::TestReporter.start

diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 3eb2dfd..275ba49 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,6 +1,3 @@
-require 'simplecov'
-SimpleCov.start 'rails'
-
 # This file was generated by the `rails generate rspec:install` command. Conventionally, all
 # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
 # The generated `.rspec` file contains `--require spec_helper` which will cause this