2009-11-01から1ヶ月間の記事一覧

libapr-1.so.0: cannot open shared object file

以前はちゃんと動いていたのだが、久しぶりに Apache を再起動したら Phusion Passenger 関連でエラーが出て止まってしまう。 $ sudo /etc/init.d/httpd start Starting httpd: httpd: Syntax error on line 468 of /usr/local/apache2/conf/httpd.conf: Can…

複数のデータベースを扱うRailsアプリをcucumberでテスト

次のようなコードを想定しよう。 class Legacy ActiveRecord::Base establish_connection :legacy self.abstract_class = true endclass Company endclass Employee endclass Document ActiveRecord::Base endDocumentモデルはアプリケーションのメインのデ…

Spec::Mocks::Mock#to_ary should return Array

フォームビルダーの error_messages を使った ERB コードを RSpec でテストするとこのエラーが出る。回避するには、次のパッチを spec/spec_helper.rb の末尾に追加する。 module Spec module Rails module Mocks def mock_model_with_patch(model_class, op…

Nested Model Form と RSpec

RSpec で Nested Model Form を含むビューのテストを書く方法のメモ。 require 'spec_helper'class Question; end class Choice; enddescribe "questions/new" do before(:each) do @question = mock_model(Question).as_null_object.as_new_record @choices…

RSpecとbackgroundrbではまる

Railsアプリケーションを開発していて不思議な現象に遭遇。backgroundrb をプラグインとして入れたら、急に rake spec がエラーを吐くようになった。個々の spec を実行すると問題なく動くのだが。根本的な原因は不明だが、backgroundrb を外すと症状が消え…