You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Ruby on Railsプログラマーのための「RSpec/Capybara入門」を連載します。Railsを学習中の初心者がテスト駆動開発(TDD)あるいはビヘイビア駆動開発(BDD)を実践するための基礎的な知識や考え方を説明していきます。 メインテーマはRSpecとCapybaraですが、factory_girl、Database Cleaner、Zeusなどの関連するGemパッケージも途中で紹介していく予定です。また、CSSセレクタやXPathについても簡単に解説することになるでしょう。 いちおうRubyとRailsの基礎知識を話の前提としますが、初心者を念頭に置いて丁寧な説明を心がけます。 できるかぎり具体的にコーディングと操作手順を示すつもりです。実際に手を動かしながら読み進めると、より理解が深まるでしょう。 記事一覧 イントロダクション (2013/08/14) RSpec/Ca
はじめに RSpecは難しい、よくわからない、といったコメントをときどき見かけます。 確かにちょっと独特な構文を持っていますし、機能も結構多いので「難しそう」と感じてしまう気持ちもわかります。 (構文については僕も最初見たときに「うげっ、なんか気持ちわるっ」と思った記憶がありますw) しかし、RSpecに限らずどんなフレームワークでも同じですが、慣れてしまえばスラスラ書けますし、実際僕自身は「RSpecって便利だな-」と思いながらテストコードを書いています。 そこでこの記事では、僕が考える「最低限ここだけを押さえていれば大丈夫!!」なRSpecの構文や、僕が普段よく使う便利な機能をまとめてみます。 具体的には以下のような構文や機能です。 describe / it / expect の役割 ネストした describe context の使い方 before の使い方 let / let!
Ruby on Rails Tutorialのエッセンスを自分なりに整理8 [Rails] RSpecのリファクタリング http://qiita.com/kidachi_/items/ec184deb106e4e5c90c3 の続き。 Ruby on Rails Tutorial(chapter6) http://railstutorial.jp/chapters/modeling-users?version=4.0#top 概要 認証機能をもつユーザ管理用のModelをテスト駆動で実装していく。 RSpecの導入方法はこちら [Rails] RSpecによるBDD(振舞駆動開発)の基本 [SporkとGuardも] http://qiita.com/kidachi_/items/cb8910eb74e924456df9 データモデルの定義 column type
Rails4時代の高速テスト環境 Rspec+Guard+FactoryGirl+Spring[NEW!]RailsRSpecGuardFactoryGirlspring Railsのテスト環境の定番といえば Rspec Guard FactoryGirl Spork このへんの組み合わせが定番だったんではないでしょうか。 Sporkでテスト環境をプリロードして、Guardでファイルを監視してガンガンテストを回してと。 今回はこのSporkを最近メキメキと頭角を現してきているSpringに置き換えて よりモダンな高速テスト環境の作り方を説明します。 Springのいいところ このSpringなにがいいって、設定がすごく簡単。 おまけにGuard+Rspec以外にもrails generateやrake routesなど他のコマンドも高速化してくれます。 一度体験したらもう戻れません。 必要
はてなグループの終了日を2020年1月31日(金)に決定しました 以下のエントリの通り、今年末を目処にはてなグループを終了予定である旨をお知らせしておりました。 2019年末を目処に、はてなグループの提供を終了する予定です - はてなグループ日記 このたび、正式に終了日を決定いたしましたので、以下の通りご確認ください。 終了日: 2020年1月31日(金) エクスポート希望申請期限:2020年1月31日(金) 終了日以降は、はてなグループの閲覧および投稿は行えません。日記のエクスポートが必要な方は以下の記事にしたがって手続きをしてください。 はてなグループに投稿された日記データのエクスポートについて - はてなグループ日記 ご利用のみなさまにはご迷惑をおかけいたしますが、どうぞよろしくお願いいたします。 2020-06-25 追記 はてなグループ日記のエクスポートデータは2020年2月28
先日RSpec on Rails0.7(0.7.1も)が出ました。 まだまだ枯れていないので実際のプロジェクトで採用するのは難しい面もありますが、isoration from Databaseを支えるmock/stub frameworkや、isoration from viewsは強力なので、それほど影響の無い作成済みの社内アプリにRSpec on Railsを適用してみました。 maihaさんがやっておられるように、自作で作るのもすごく楽しそうなのですがとりあえずは使ってみます。mock/stub frameworkの実装の詳細をあとでみる。 BBDでは、Behaviourを書いてからコードの実装を行うのですが、今回は以前にうみがめで作った社内用情報共有ツールBasecamp(某signalsのパクリ)にBehaviourを書いていくことになります。 BasecampのSpec 社内で
29 August 2006 Developing a Rails model using BDD and RSpec, Part 1 Writing Rails testing articles seems to be quite popular at the moment; seeing as I’m often quite vocal about testing on the #caboose and #rubyonrails IRC rooms I felt it was about time I posted one of my own. I have a large series of articles on testing with Rails in the pipeline, but until that is done, here is a nice and simple
RSpec on Railsのさわりだけ。 おそばせながら今頃、BDD(Behaviour Driven Development)を知りました。。。 これからはきちんとBDD or TDDで開発を進めます。 BDDはテスト駆動開発と言葉の言い回しが大きく異なっている。 「ベヒイビアを書いて仕様を設計する。」これが大きなポリシー。 BDDでは必ず仕様コード(spec)を書いてから実際のコーディングを行う。 Rubyには、RSpecというツールがありこれを利用する。 gemパッケージが用意されているので簡単。 $ gem install rspec 次にRSpec on Railsプラグインをインストール。 REL_X_Y_Zの部分をrspecのバージョンとあわせる必要がある。 $ cd RAILS_ROOT $ ruby script/plugin install svn://rubyfor
最近Macの再インストールしてから開発環境が中途半端だったので、Railsのテスト環境を改めて整備、のメモ 1) Rails開発環境は入っている 2) RSpec入れる % sudo gem install rspec 3) ZenTest入れる % sudo gem install ZenTest 3) diff-lcs入れる % sudo gem install diff-lcs 4) 自分のRailsアプリのディレクトリへ移動 % cd /RAILS_ROOT/ 5) rspec on rails入れる % sudo ruby script/plugin install svn://rubyforge.org/var/svn/rspec/tags/REL_1_0_5/rspec_on_rails 6) RSpec関係ファイルのセットアップ % ruby script/gen
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く