_ko1 @_ko1 やっぱり spec の書き方がわからない、のは理解が足りていないからだと思うんだが、書籍でも読むといいんだろか 2014-04-17 15:24:18

What is Better Specs Better Specs is a collection of best practices developers learned while testing apps that you can use to improve your coding skills, or simply for inspiration. Better Specs came to life at Lelylan (open source IoT cloud platform) and checking out its test suite may be of inspiration. Better Specs focus on Rails testing, but our goal is to create testing guidelines covering mos
DRY原則に従おうとするほど、テストコードがどんどん読みづらくなる。 The RSpec Bookに答えがあるかと思って読んでみたものの、「あるある」と一言述べているだけだった。辛い。 テストコードが読みづらくなる例を示すために、1つRubyのライブラリをつくった。 値とパターンを与えてValidationを行う機能を提供するライブラリ。 実装60行、テスト120行なので、詳しく見たければすぐ読めると思う。 最近不本意ながらキラキラネームの命名力が上がってきたと思う。 avalon - A validator implementation for Ruby https://github.com/r7kamura/avalon 冗長だが読みやすい例 letもsubjectもローカル変数も何も用いずに率直に書いたテストコード例がこちら。 冗長だが読みやすく、テストコードを見ればライブラリの使い
Ruby on Railsで、RSpec を使ってコントローラのテストをしたテストコードの例を載せておきます。 環境は、Ruby on Rails3、Ruby1.9.2 を使っています。RSpec の使い方の参考になれば幸いです。 RSpec で Controller のテストを書いてみた Ruby on Rails3, Ruby1.9.2 で Controller クラスの RSpec を書いてみました。 Controller でテストしたのは次の3点です。 ルーティングが合っているか 処理が通って 200 OK を返すか 処理が通って期待通りの結果(Blog が保存されることによって count がひとつ増える)になっているか # coding: UTF-8 require 'spec_helper' describe BlogsController do describe "GET
INSTALL ======= INSTALL rspec ============= $ sudo gem install rspec OR $ ./script/plugin install git://github.com/dchelimsky/rspec.git INSTALL rspec_on_rails plugin ============================= $ ./script/plugin install git://github.com/dchelimsky/rspec-rails.git BOOTSTRAP THE APP ================= $ ./script/generate rspec create spec create spec/spec_helper.rb create spec/spec.
There are a few things motivating this new syntax, and I wanted to blog about it to spread awareness. Delegation Issues Between method_missing, BasicObject and the standard library’s delegate, ruby has very rich tools for building delegate or proxy objects. Unfortunately, RSpec’s should syntax, as elegantly as it reads, is prone to producing weird, confusing failures when testing delegate/proxy ob
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く