井原(@ihara2525)です。 以下のようにElasticsearchを使って検索するアクションがあり、RSpecでこのコントローラスペックを書きたい!という場合にどうしようって話です。 class PostsController < ApplicationController def search @records = Post.search(params[:query]).page(params[:page]).records end end Gemfileにelasticsearch-extensionsを追加します。バージョンは適当なもので。 このgemがデフォルトで9250ポートで立ち上がるテスト用のElasticsearchのクラスタを用意してくれるので、9200で立ち上がる開発用のクラスタとかぶりません。 Gemfile group :test do gem 'elast
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, orsimply for inspiration. Better Specs came to life at Lelylan (open source IoT cloud platform) and checking outits test suite may be of inspiration. Better Specs focus onRails testing, but ourgoal is tocreate testingguidelines covering mos
rspec-2.11 がリリースされましたね。いくつかの変更点の中に、今後は should ではなく expect を推奨し、デフォルトでは expect のみが有効化されるようになる、というものがありました。 http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax 個人的にこの変更は説得力に欠けるなーと思っていて、 expect推しにする理由が should は Kernel にはえるので Kernel を include しない BasicObject のインスタンスに対して should を呼ぶとおかしくなる 標準ライブラリ delegate は Kernel のメソッドの一部だけを include するので rspec と delegate のどちらが先にロードされるかによって should の挙動
I watch a lot of tests run in a given day. So I figured why not makeit more fun. Inspired by minitest’s pride, and um cats? I came up with a Nyan Cat inspired RSpecformatter. Update: After last week’s launch, Nyan Cat received a great response from theRuby world. Over the weekend, I released version 0.0.2.It includes a few bug fixes and some really cool enhancements. Most notably, Nyan Cat now
We released RSpec-2.8.0 today with a host of new features and improvements since 2.7. Some of the highlights are described below, but you can see the full changelogs at: http://rubydoc.info/gems/rspec-core/file/Changelog.md http://rubydoc.info/gems/rspec-expectations/file/Changelog.md http://rubydoc.info/gems/rspec-mocks/file/Changelog.md http://rubydoc.info/gems/rspec-rails/file/Changelog.md Docu
こんにちは、ほりいです。Asset Pipeline に感銘を受けている今日この頃です。 今日は社内で RSpec をこれから勉強したいんだけど検索してもよくわからない!と質問を受けたので、読むべきエントリをまとめてみました。 # 現状ぐぐると RSpec.info がまず出てくるけどもう更新されてないっぽいので優しくないんですよね…… h2. これは読んでおこう! h3. スはスペックのス * “スはスペックのス 【第 1 回】 RSpec の概要と、RSpec onRails (モデル編)”:http://jp.rubyist.net/magazine/?0021-Rspec * “スはスペックのス 【第 2 回】 RSpec onRails (コントローラとビュー編)”:http://jp.rubyist.net/magazine/?0023-Rspec 内容は若干古いのですが、

Use shared_context to define ablock that will be evaluated in the context of example groups either explicitly, using include_context, or implicitly by matching metdata. shared_context "shared stuff", :a => :b do before { @some_var = :some_value } def shared_method "it works" end let(:shared_let) { {'arbitrary' => 'object'} } subject do 'this is the subject' end end require "./shared_stuff.rb" des
February 2009 Volume 24 Number 02 .NET との相互運用性 - IronRuby と RSpec の概要 (第 1 部) Ben Hall | February 2009 この記事は、IronRuby のプレリリース版に基づいています。ここに記載されているすべての情報は、変更される場合があります。 コードは MSDN コード ギャラリーからダウンロードできます。 オンラインでのコードの参照 目次 コードで要件とサンプルを定義するRuby と Duck TypingRuby とメタプログラミングRuby と .NET FrameworkRuby と CLR IronRuby の内部 IronRuby を使用して C# アプリケーションをテストする 今後の予定 「我々がお願いしたのはこんなものじゃありません!」。おそらくほとんどの開発者が、最新のビルド

I opened up mytwitter client this afternoon and I saw "54 Messages, 28 Mentions". I tell you honestly, the first thought I had was: mytwitter account had been hacked. Then I started to comb through the messages and I found out what happened.It all started with a tweet from Joe Fiorini. We both worked together on a largeRails application. The application was a little light on tests, so I asked
Yay! Igotvim and autotest integration working. When I run autotest, if there is anerror, I can haveVim read theerrors from autotest and jump me to the right place. Here is a video of me usingit: Pleasenote that I’m not copying and pasting anything. Invim, I hit a command andVim automatically picks uperrors from autotest and jumps me to theline where theerror occurred. You too can impre
RSpec-2.0.0 has been released! This marks the end of a year-long effort that improves RSpec in a number of ways, including modularity, cleaner code, and much better integration withRails-3 than was possible before. Docs, with a little bit of relish In addition to the documentation available at all the places mentioned myearlier post, we’ve alsogot all of the Cucumber features posted toJustin K
Ruby Weekly is a weekly newsletter covering the latestRuby andRails news. 9 months in the making comes RSpec 2.0, the latest major version ofRuby's most popular behavior driven development (BDD) framework (now at a gem install rspec near you). Kudos to the 82 contributors and RSpec's team lead, David Chelimsky. What has RSpec 2.0got that RSpec 1.x doesn't? Modularity. RSpec has been split up i
The state of Test Driven Development For the latest version of this informationgo here and get the article that grew out of this post Test Driven Development (TDD) has madeit to prime time. Big companies are paying big money to have their programmers trained in how to do TDD.It’s a populartopic at conferences… agile and otherwise. My book on TDD won a Jolt award. So everything’srosy, huh? Eve
前回の続き Cucumberは巨大で多くのコンポーネントの集合体です。また構成もいくつか種類があり、試験対象のアプリケーションによって時に構成を変える必要があります。今回はCucumberの構成についてまとめ、選択肢について簡単に解説していきたいと思います。 まずはCucumberの依存関係を覗いてみましょう。アウトラインを把握するだけのためで、構成の選択肢とは関係ありません。 $ gem dependency cucumber --version 0.6.2 --remote Gem cucumber-0.6.2 term-ansicolor (>= 1.0.4, runtime) #標準出力に色をつける treetop (>= 1.4.2, runtime) #Ruby用の構文解析器生成系の一つ polyglot (>= 0.2.9, runtime)builder (>= 2.1.
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く