スポンサーリンク

railsでrspec

テスト駆動開発???

『実践Ruby on Rails 4』

を読んでいるのだが、その通りにやることがどうしてもできず、わざわざ、四苦八苦しながら、またつまづいている。

p63の、RSpecの初期設定の、

spec/spec_helper.rb

の記載が、自分のものや、公式サイトからダウンロードできるものと違うように私には思える。

http://whiskers.nukos.kitchen/2014/10/26/rspec_rails.html

を参考にして、spec/spec_helper.rb の内容は、

—————–

RSpec.configure do |config|
  ENV["RAILS_ENV"] ||= ‘test’
  require File.expand_path("../../config/environment", __FILE__)
  require ‘rspec/rails’
 
  config.include Capybara::DSL
end

—————–

にして、なおかつ、

http://www.oiax.jp/jissen_rails (公式ページ)

にあるように、

——————–

各 spec ファイルの第1行目の記述を次のように修正

(修正前) require 'spec_helper'

(修正後) require 'rails_helper'

——————–

とやったら、やっとうまくいった。

image

 

●git
git init
そのあと、BitBucketの言うとおりにコマンドをコピペ。

git add -A
git commit -m "○回目のコミット"
git push origin master

(初回だけ)
git config –global user.name "(ユーザー名)"
git config –global user.email xxxxx@xxxxx.xx

https://git-scm.com/book/ja/v1/Git-%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC-SSH-%E5%85%AC%E9%96%8B%E9%8D%B5%E3%81%AE%E4%BD%9C%E6%88%90

SSH公開鍵を作成して、BitBucketに保存。

そのあと、
git push origin master

●CentOSでheroku

http://d.hatena.ne.jp/yk5656/20140902/1410750272

Gemfileに、

group :production do
  gem ‘pg’,             ‘0.17.1’
  gem ‘rails_12factor’, ‘0.0.2’
end

を加えて、bundle installすると、pg 0.17.1がインストールできないと以下のエラー。エラーにしたがって、gem install pg -v ‘0.17.1’ しても、エラー。

image

http://qiita.com/miyohide/items/17906dce3c7fd306a7a5

http://blog.naichilab.com/entry/2015/12/13/220026

●PostreSQLをインストール

http://kajuhome.com/postgresql.shtml

あきらめた。。。

スポンサーリンク