rspec-rails 1.2.2やCucumber 0.2.0にあげるときの作業メモ
本業があるので手短に。ちょこちょこ変わっていたのではまったポイントを。
rspec-rails 1.2.2
ルーティング周りのexampleの書き方が変わっていた。routes_for(url_params)のほう
- idなんかもStringで指定する必要あり
it "should map #show in rspec-rails 1.1.x" do route_for(:controller => "blogs", :action => "show", :id => 1).should == "/blogs/1" end it "should map #show in rspec-rails 1.2.x" do route_for(:controller => "blogs", :action => "show", :id => "1").should == "/blogs/1" end
- HTTPメソッドでアクションが変わる場合なんかのexpecatinは:pathと:method指定する必要あり。Hashで。
it "should map #update in rspec-rails 1.1.x" do route_for(:controller => "blogs", :action => "update", :id => "1").should == "/blogs/1" end it "should map #update in rspec-rails 1.2.x" do route_for(:controller => "blogs", :action => "update", :id => "1"). should == {:path => "/blogs/1", :method => "PUT" } end
くわしくは http://github.com/dchelimsky/rspec-rails/blob/1.2.2/Upgrade.rdoc をご覧ませ。
これは比較的単純作業で終わったのでとっととmasterにマージしました@お仕事。
Cucumber 0.2.0
「前提シナリオ」(Given Scenario)がなくなってます。ナンテコッタイ。替わりに「背景」(Background)を使うようになってます。
なので、これまでは「前提シナリオ」として縦横無尽に参照していたのですが、フィーチャごとの前提条件(=背景)とシナリオにおける前提(=前提)に分割して考える必要が出てきました。で、前者を「背景」としてくくり出す、と。
いうのは簡単ですが、既存からのアップグレードはちょっとめんどくさくて、10分では無理っぽいです。最終形は、たしかに構造化されていてきれいになってるかも。
詳細はこちら http://wiki.github.com/aslakhellesoy/cucumber/background
こちらは別ブランチに退避してとりあえず本業をやります。