This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/capybara.rb | |
require 'capybara/rails' | |
require 'capybara/poltergeist' | |
Capybara.javascript_driver = :poltergeist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/concerns/followable.rb | |
module Followable | |
extend ActiveSupport::Concern | |
included do | |
has_many :reverse_relationships, :class_name => 'Relationship', | |
:as => :following, | |
:dependent => :destroy | |
has_many :followers, :through => :reverse_relationships, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'carrierwave' | |
run_bundle | |
append_file 'spec/spec_helper.rb', <<-RUBY | |
CarrierWave.configure do |config| | |
config.root = Rails.root.join("tmp") | |
config.storage = :file | |
end | |
RUBY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'devise' | |
run_bundle | |
generate 'devise:install' | |
generate 'devise:views' | |
application <<-CODE, env: 'development' | |
config.action_mailer.default_url_options = { host: 'localhost:3000' } | |
CODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'angularjs-rails' | |
run_bundle | |
inside 'config/environments' do | |
gsub_file 'production.rb', | |
/config.assets.js_compressor = :uglifier/, | |
"config.assets.js_compressor = Uglifier.new(mangle: false)" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
インストールしたあと | |
1. rails generate controller home index | |
2. home#index を root_path に設定する | |
3. shared/omniauth_links を home/index に設置する | |
4. secrets.yml に秘密鍵を設定する | |
ついでに | |
* github でもログインしたい | |
* linkedin はアカウント持ってない | |
* provider/uid のインデックスつくろ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/api/base_controller.rb | |
class Api::BaseController < ApplicationController | |
after_action :set_csrf_cookie_for_ng | |
respond_to :json | |
def set_csrf_cookie_for_ng | |
cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git :init | |
git :add => "--all" | |
git :commit => "-qm 'Initial commit'" | |
comment_lines "Gemfile", /gem 'spring'/ | |
gem_group :development do | |
gem 'spring' | |
gem 'spring-commands-rspec' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/database_rewinder.rb | |
RSpec.configure do |config| | |
config.before :suite do | |
DatabaseRewinder.clean_all | |
end | |
config.after :each do | |
DatabaseRewinder.clean | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/database_cleaner.rb | |
RSpec.configure do |config| | |
config.before(:suite) do | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before(:each) do | |
DatabaseCleaner.strategy = :transaction | |
end |
OlderNewer