38. ⑤失敗・教訓(充実してきた頃) カバレッジは万能じゃない -「レガシーコード=テストの無いコード」なので意 味はあるが・・・ -Reekを取るようにした(お手軽/ReekViewer) https://github.com/Shinya131/reekviewer FactoryGirlがパンクした -factory.rbに全てぶっ込むのではなく、 factoriesフォルダ以下にファイル分割配置 -リレーション指定やりすぎると破綻(メンテ不能)に
38. ⑤失敗・教訓(充実してきた頃) カバレッジは万能じゃない -「レガシーコード=テストの無いコード」なので意 味はあるが・・・ -Reekを取るようにした(お手軽/ReekViewer) https://github.com/Shinya131/reekviewer FactoryGirlがパンクした -factory.rbに全てぶっ込むのではなく、 factoriesフォルダ以下にファイル分割配置 -リレーション指定やりすぎると破綻(メンテ不能)に
Railsエンジニアになってから1年半くらいが経ち、社内のRailsのプロジェクトを全部で5つくらい触って、今やってるAbilie*1でようやく人並みにテストを書いてる気がしてきたので、現時点でやってるテストの方法をまとめておく。 テストのルール的なの rspecでは必ずモデルのテストは書くようにしてる。ヘルパーも大体書いてるけど、コントローラやルーティングのテストはあまり書いてない。 というのも、コントローラーのコードを極力短くしてモデルを太らせているのでコントローラのテストはあんまり意味が無い気がしていて、その代わりにCapybaraでテストを書いておけば十分なんじゃないかなと思ってきたから。Capybaraは書いてるので、そういう意味では書いてるとも言える。 社内の管理者だけが使える管理画面も作ってるけど、そっちはテストあんまり書いてない。ここは動かなくなっても一般ユーザーには影響が
こんにちは、ほりいです。Asset Pipeline に感銘を受けている今日この頃です。 今日は社内で RSpec をこれから勉強したいんだけど検索してもよくわからない!と質問を受けたので、読むべきエントリをまとめてみました。 # 現状ぐぐると RSpec.info がまず出てくるけどもう更新されてないっぽいので優しくないんですよね…… h2. これは読んでおこう! h3. スはスペックのス * “スはスペックのス 【第 1 回】 RSpec の概要と、RSpec on Rails (モデル編)”:http://jp.rubyist.net/magazine/?0021-Rspec * “スはスペックのス 【第 2 回】 RSpec on Rails (コントローラとビュー編)”:http://jp.rubyist.net/magazine/?0023-Rspec 内容は若干古いのですが、
Maven3 を使ったプロジェクトでの BDD(振舞駆動開発)の実施方法をまとめてみました。 今回試した BDD ツールは以下の通りです。 Specs Specs2 RSpec Easyb(Maven2) spock 結果として、この中では Specs/Specs2 か spock あたりを使うのが良さそうです。(RSpec と Easyb は問題あり) なお、実行環境は以下の通りです。 Java SE 6 Update 24 Maven 3.0.3(Easyb のみ Maven 2.2.1) サンプルのソースは http://github.com/fits/try_samples/tree/master/blog/20110321/ Specs の場合 Scala による BDD ツールの Specs を使用する場合、pom.xml を以下のように設定します。 なお、surefire プ
今流行りつつある話題のCucumberとWebratをRailsで使ってみました。 CucumberとWebratなんぞやという人はid:moroさんの「 Cucumberがアツい」が参考になります。 今回やったこと RailsにCucumberを入れてみた Featureの予約語を日本語にして動かしてみた Cucumberをautotestでも動くようにしてみた autotestの結果をGrowlに通知するようにしてみた 参考サイト 上記のCucumberがアツい Cucumberのgithub 必要なパッケージのインストール 以下のgemが必要みたいなので、まだインストールしていない場合はインストールします。 rspec rspec-rails cucumber webrat term-ansicolor treetop diff-lcs nokogiri ZenTest(autote
I keep a text file open as I work, and when I learn something, or fix a bug, I make a note of that in the text file. I call it my journal. It’s pretty low-tech, but text search turns out to be a sufficient way to look up past experiences when I find myself thinking “this problem seems so familiar”. There’s another benefit too: I find keeping simple notes about what I’m doing—what problems I’m solv
9月からやる仕事がめでたく、Rails3.0 + Ruby1.9.2のお仕事なので色々と環境構築。とりあえず自動テストまわりやりました。 一応、環境を他と切り分けるために、rvmでアプリ用にgemsetを用意。アプリごとに簡単に環境を構築できるrvmマジ便利。 gem install bundler --pre gem install rails まずは、bundlerとrailsをインストール。次は適当なアプリを作って必要なgemのインストールなどを行う。テストはRSpecで書くので、-TをつけてTest/Unitは使わないようにする。 rails new demo -T 次に必要なgemをGemfileに記述。rspecとかを「テストだけだから」と思って、gropu :testにしたら、モデルを作成したときにTest/Unitのテストコードが作られたりしたので注意。githubのWik
『るびま』は、Ruby に関する技術記事はもちろんのこと、Rubyist へのインタビューやエッセイ、その他をお届けするウェブ雑誌です。 Rubyist Magazine について 『Rubyist Magazine』、略して『るびま』は、日本 Ruby の会の有志による Rubyist の Rubyist による、Rubyist とそうでない人のためのウェブ雑誌です。 最新号 Rubyist Magazine 0058 号 バックナンバー Rubyist Magazine 0058 号 RubyKaigi 2018 直前特集号 Rubyist Magazine 0057 号 RubyKaigi 2017 直前特集号 Rubyist Magazine 0056 号 Rubyist Magazine 0055 号 Rubyist Magazine 0054 号 東京 Ruby 会議 11 直
『るびま』は、Ruby に関する技術記事はもちろんのこと、Rubyist へのインタビューやエッセイ、その他をお届けするウェブ雑誌です。 Rubyist Magazine について 『Rubyist Magazine』、略して『るびま』は、日本 Ruby の会の有志による Rubyist の Rubyist による、Rubyist とそうでない人のためのウェブ雑誌です。 最新号 Rubyist Magazine 0058 号 バックナンバー Rubyist Magazine 0058 号 RubyKaigi 2018 直前特集号 Rubyist Magazine 0057 号 RubyKaigi 2017 直前特集号 Rubyist Magazine 0056 号 Rubyist Magazine 0055 号 Rubyist Magazine 0054 号 東京 Ruby 会議 11 直
本日大江戸*1で行われた大江戸Ruby会議01で、高速なテストサイクルを回すにはという内容で発表してきました。 大江戸Ruby会議01 高速なテストサイクルを回すには View more presentations from hotchpotch テストを速くするには二パターンあり、一つは単体実行時の速度・フィードバックの高速化、もう一つはすべてのテスト実行時の高速化があると思っていて、それらについての話です。ぎゅっとまとめると、前半の単体実行時の速度・フィードバック高速化には spork / prefetch-rspec / autotest / watchr を使おうという話と、後半は REE / parallel_tests による高速化・並列実行、remote spec によるリモートマシンでの分散テストについての話です。 特にオレオレプロジェクトの prefetch-rspec
■1 第6回 Rubyビジネスセミナー:「ふつうのRuby on Railsのテスティング環境」 昨日告知したやつを無事終えました。ご来場いただいた皆さま、ありがとうございました。一方的に講演するだけじゃなくて、質問をたくさんしていただけて救われました。メイシーの中の人たち :)と会えたのがよかった。チャリで来てた。いいな。オレも大江戸Ruby会議01はチャリで行こう。 当日の背景画像集です: Testing Environment of Ruby on RailsView more presentations from Shintaro Kakutani. 話す内容はもっと削らないといけなかった。引き続き精進を重ねていきたい。ブレインストーミングにお付き合いいただいた、@:haru01,Asakusa.rbメンバーの皆さんありがとうございました。 以下、講演でアナウンスしたことこちらでも
和田 卓人(@t_wada) 作『RSpec の入門とその一歩先へ』はクリエイティブ・コモンズ 表示 - 継承 4.0 国際 ライセンスで提供されています。 東京 Ruby 会議 03 の RSpec ワークショップの資料です。このワークショップでは参加者の方に「写経」(コードを書き写すこと)をして貰い、TDD/BDD と RSpec を同時に学べるように都度説明を入れるかたちで行いました。 第2イテレーションも書きました。続きに興味ある方はご覧下さい (更新) 第3イテレーションも書きました。続きに興味ある方はご覧下さい 1st iteration favotter の みたいな NG ワードのフィルタリング機能を RSpec で作りましょう。まずは NG ワードの検出機能を作成します。 このイテレーションでは最初ベタな形のテストコードと実装を書き、だんだんとそのコードを洗練させてゆきま
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く