Puppet マニフェストをリファクタリングするからテスト書くぞ、ってことで、 puppet-lxc-test-box に書いたように、テストするためのシステムコンテナを簡単に作る仕組みをつくったので、今度は実際にテストコードを書くためのベースをつくってみた。 rspec-lxc... 続きを読む
Myron’s blog post does a fantastic job explaining why this is better. To summarize: RSpec does not own every object in the system, so it cannot add the should and should_not methods to every object. This can lead to some really confusing err... 続きを読む
Rubyの試行錯誤支援・テスト支援ツール。「# =>」という注釈記号を入れた行に式の値を注釈したり、Test::UnitのassertionやRSpecのexpectationを自動で入れてくれる便利なツール。rcodetoolsパッケージに入っていて、RubyGemsパッケージがあるので、「gem insta... 続きを読む
最近話題のRSpecのプレゼンとは RSpec を指しています。私が知らなかったことを列挙します。「x/75」の表記はプレゼンのページ番号です。 3/75: 簡潔で可読性の高い記述 describe Stack do context "when new" do it { should be_empty } it { should have(0).i... 続きを読む
■ rspec-rails と capybara のまとめ rspec-rails と capybara をアップデートしたら request spec で click_link が使えなくなったという声を隣席のぱーらー氏方面から聞こえてきたので、ちゃんとコードを読んで新人's に展開しました。 ぶっちゃけ spec_help... 続きを読む
RSpecはRubyのためのビヘイビア駆動開発(BDD)フレームワークで、Capybaraはブラウザの動きをシミュレートするRubyライブラリで、どちらもRubyGemsパッケージとして配布されています。Railsアプリケーションのテストを書く場合の定番の組み合わせといっていいで... 続きを読む
giant robots smashing into other giant robots Written by thoughtbot. We make web & mobile apps for startups. twitter newsletter rss feed October 17, 2012 Tagged: ruby ruby on rails capybara rspec integration testing Comments (View) End-to-end... 続きを読む
Better Specs tries to fill the miss of testing guidelines by collecting most of the best practices developers has been learning the hard way through years of experienceAffiliate books RSpec is a great tool in the behavior driven design proces... 続きを読む
スライドを SpeakerDeck に上げました。 続きを読む
Tutorial Details Technologies: Ruby, Sinatra, rspec Difficulty: Moderate Format: 11 Minute Screencast In today’s video tutorial, I’m going to teach you how to use rspec within a Sinatra application. Along the way, we’ll also arrange for au... 続きを読む
TDD, Ruby, Rspec私がRSpec使ってテスト書く時はこんな感じで書いてるよ〜ってのを書いてみた。*1 テストを書く順番についてTDDでコードを書く場合、先にテストを書く事になります。そして、そのテストを書く順番ですが、私は下記のような順番で書くように意識... 続きを読む
Download: source codeProject Files in Zip (131 KB)mp4Full Size H.264 Video (22.3 MB)m4vSmaller H.264 Video (14.8 MB)webmFull Size VP8 Video (39.1 MB)ogvFull Size Theora Video (31.3 MB) ハイレベルテストは、Railsアプリケーションをテストする優れ... 続きを読む
前回はインテグレーションテストとしてCucumberでテストを作成しました。今回はユニットテストとして、RSpecを使ってコントローラのテストを作成します。 前回はインテグレーションテストとしてCucumberでテストを作成しました。今回はユニットテストとしてRSpe... 続きを読む
In the 2.11 release, rspec-mocks is gaining a significant new capability that, as far as I know, isn’t provided by any other ruby mocking library: constant stubbing1. Let’s look at the API, and then talk a bit about some of the use cases fo... 続きを読む
RSpec has featured a readable english-like syntax for setting expectations for a long time: some_spec.rb 1 2 foo.should eq(bar) foo.should_not eq(bar) RSpec 2.11 will include a new variant to this syntax: some_spec.rb 1 2 expect(foo).to eq(ba... 続きを読む
rspec-2.11 がリリースされましたね。いくつかの変更点の中に、今後は should ではなく expect を推奨し、デフォルトでは expect のみが有効化されるようになる、というものがありました。http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-synta... 続きを読む
Everyday Rails Testing with RSpec A practical approach to test-driven development by Aaron Sumner or Download a sample PDF When you buy this book, you get it in PDF, EPUB and MOBI formats, so you can read it on your computer, iPad, Kindle or ... 続きを読む
RSpec の DSL には、 example と言うメソッドがあり、そこを経由して現在実行中の example の情報を得ることができる。 def add(*args) args.inject(:+) end describe "add" do before do p example.class #=> RSpec::Core::Example end subject { add(*args) }... 続きを読む
最近、新人のテストコードを見る機会があり、ユニットテストの書き方について考える機会があった。ユニットテストはテンプレートみたいなものがあるので、それさえ押さえれば、誰でも簡単に書くことができる。 ここでは、その方法について紹介したい。サンプル... 続きを読む
257: request specとCapybara (view original Railscast) Other translations: Other formats: Written by Naomi Fujimoto ハイレベルテストは、Railsアプリケーションをテストする優れた方法です。この種のテストでよく用いられるCucumberについて、エピソー... 続きを読む