cucumberのバージョンを0.1.99.21に上げてみた
Macのportでは0.1.16までしかないけど、githubでは1.9までバージョンが上がっていたのでインストールしてみたらいろいろはまったのでメモ。
まずgemsを最新版にする。
$ sudo gem install rubygems-update $ update_rubygems
最新版は本日時点で1.3.1だった。
次にcucumberの最新版をgithubからcloneしてインストール
git clone git://github.com/aslakhellesoy/cucumber.git cd cucumber sudo rake install_gem
以下の2つが最新版ではなくて怒られました。
- polyglot
- builder
なのでまずこいつらをインストール
$ sudo gem install polyglot $ sudo gem install builder
そしてもう一度cucumberをインストール
$ sudo rake install_gem
今度はうまくいった。
つぎに既存のRailsプロジェクトで動作確認。
案の定うまく動かない。
とりあえず。webratをアップーデート
$ sudo gem update webrat
あとcucumberのwikiみたら色々入れろとかいてあったので入れてみる
$ sudo gem install term-ansicolor treetop diff-lcs
で、Railsの設定ファイルを更新する。
ruby script/generate cucumber
この更新でfeatures/support/env.rbが上書きされたのでもう一度設定し直す。
# Sets up the Rails environment for Cucumber ENV["RAILS_ENV"] ||= "test" require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') require 'cucumber/rails/world' require 'cucumber/formatters/unicode' # Comment out this line if you don't want Cucumber Unicode support Cucumber::Rails.use_transactional_fixtures #Seed the DB Fixtures.reset_cache fixtures_folder = File.join(RAILS_ROOT, 'spec', 'fixtures') fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') } Fixtures.create_fixtures(fixtures_folder, fixtures) require 'webrat' Webrat.configure do |config| config.mode = :rails end # Comment out the next two lines if you're not using RSpec's matchers (should / should_not) in your steps. require 'cucumber/rails/rspec' require 'webrat/core/matchers'
一応動くようにはなったけど、autospecで動かすと色がつかなかったり、warningが出まくっている。
cucumber単体だと色も付くし、warningもでないからautotestとかのせいかもしれない。