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
みなさん、 timecop 使ってますか?timecop は、テストで時間を扱う時に必須と言えるライブラリです。テスト中の時間を止めたり(Timecop.freeze)時間を移動させたり(Timecop.travel)できます。似たようなライブラリとして delorean があります。RailsCasts でも紹介されています。 さて、timecop の README には下記のようなコード例が書いてあります。 t = Time.local(2008, 9, 1, 10, 5, 0) Timecop.travel(t) 僕はこれまで上記のように書くしか方法が無いと思っていたのですが、今日下記のようにも書けることに気づきました。 Timecop.travel(2008, 9, 1, 10, 5, 0) また、ブロックを使うこともできます。 Timecop.travel(2008, 9, 1,
I’ve noticed a handful of what I’d consider Factory Bot anti-patterns, either through pull requests, GitHub issues, or questions spread across Stack Overflow, Google Groups, etc. The more common they are, the more I realize that it will benefit plenty of other developers down the road if a list of anti-patterns can be identified and what to do instead. The one I’d like to outline today is based of
Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news. Despite RSpec's awesomeness, Test::Unit remains the most popular Ruby testing tool out there outside of Rails apps. I've recently been code walking through a lot of Ruby libraries for my Ruby Reloaded course and the typical arrangement is Test::Unit, sometimes coupled with Shoulda or Contest for some extra syntactic sweetn
本日大江戸*1で行われた大江戸Ruby会議01で、高速なテストサイクルを回すにはという内容で発表してきました。 大江戸Ruby会議01 高速なテストサイクルを回すには View more presentations from hotchpotch テストを速くするには二パターンあり、一つは単体実行時の速度・フィードバックの高速化、もう一つはすべてのテスト実行時の高速化があると思っていて、それらについての話です。ぎゅっとまとめると、前半の単体実行時の速度・フィードバック高速化には spork / prefetch-rspec / autotest / watchr を使おうという話と、後半は REE / parallel_tests による高速化・並列実行、remote spec によるリモートマシンでの分散テストについての話です。 特にオレオレプロジェクトの prefetch-rspec
Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news. As an outspoken and opinionated guy, David Heinemeier Hansson (a.k.a. DHH), creator of Rails, is no stranger to a little bit of controversy. He frequently sets off interesting debates on Twitter from his @dhh account. The latest is, perhaps, the most involved yet and has been rattling on for a couple of hours today. So wha
以前 Ruby on Railsの達人 @a_matsuda に 薦められた テストツール Steak を現在開発中のプロジェクトで使ってみようと思い、勉強してみました。 Steakとは Steak は Cucumber 同様に Ruby on RailsなどのWebアプリの受け入れテストや総合テストのツールです。Cucumberは仕様(テスト)を自然言語で記述できるのが大きな特徴でしたが、SteakではRSpec+専用DSLで記述しまます。 Cucumberは仕様(テスト)を自然言語で書けるので、ユーザーに仕様を確認してもらうとか作ってもらえるのが最大のメリットです。しかしその分、feature(仕様)とStep(仕様をプログラムをつなぐコード)の2つを記述する必要あり開発の手間が取られます。 それに比べ、 Steak は RSpec (= Rubyのコード) なので、プログラマーに取っ
Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news. Infinity Test is a new library by Tomas D'Stefano that pitches itself as a "flexible alternative to Autotest." If you want your project's tests (both RSpec or Test::Unit are supported) to be automatically run when changes are made, this is a great place to start. The big benefit of Infinity Test is the support for testing
Releases, Offers & More Be the first to hear about our newest content, best promotions and upcoming events. Plus get 25% off your next purchase. Newsletter Sign Up Download Accounts Your email address is your account identifier. You can create a password, or just download from the links sent via email. My Orders (Resend order emails) How We're Different Hands-on instructions Solutions to real-worl
前回(第35回)はwwを使ってWebのダブルとなるサーバを作り、スパイ機能を使ってクライアントからのリクエストの状況を目視確認する方法を説明しました。 今回は、ミニブログへのメッセージ投稿を通じて、wwを自動化テストに組み込む方法を説明します。 RSpecの自動テストの中からサーバを起動停止する wwは、単一のサーバプロセスとして起動させるほかに、自動化テストの中で定義・起動・停止するためのAPIを備えています。前回作ったダブルサーバを、RSpecから起動・停止するテストコードは次のようになります。 # spec/miniblog_client_spec.rb $:.unshift File.expand_path("../lib", File.dirname(__FILE__)) require 'miniblog_client' require 'ww' describe Minibl
はじめに Web APIを使って様々なサービスと連携するというアーキテクチャはすっかり定着した感があります。みなさんも、Web APIを使ってデータをやりとりするアプリケーションを書く機会も増えているのではないでしょうか。 Web APIを使うアプリケーションの開発では、テストやデバッグをする際のAPIアクセスが悩みどころとなります。本物のサーバを使ったのではテストデータの初期化などに手間がかかりますし、逆にHTTPアクセス自体をスタブやモックを使って間接化してしまうとそれが本当に有効なテストなのか不安が残ってしまいます。 筆者も、仕事やプライベートでのコーディングでこのような悩みに何度も遭遇しました。これらを解決するために開発したのがwwです(wwと書いて'double-web'と読みます)。 ダミーWebサーバ作成ライブラリww(Double Web) wwは、Webサービスの簡単
Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news. Harmony, from Martin Aumont, is a new Ruby DSL for executing JavaScript and DOM-using code from within Ruby apps. Why's that cool? Well, it enables you to build your own Ruby-level unit tests for JavaScript code within your Web applications - everything can be under one set of test suites! Harmony sounds like a significant
What Faker, a port of Data::Faker from Perl, is used to easily generate fake data: names, addresses, phone numbers, etc. The port was motivated by a need for a bunch of fake data to make good-looking screenshots for Catch the Best. :) Installing sudo gem install faker Usage Faker::Name.name => “Bob Hope” Read the docs Forum http://groups.google.com/group/ruby-faker How to submit patches Read the 8
ご無沙汰しています。KBMJのプログラマのx5rです。 最近、私が携わるプロジェクトでは、外部APIを利用したい、一部の機能を外出しにしてサービス間で連携したいという要望が徐々に増えつつあります。 ただし、その外部システム(サービス、API)と連携する機能を実装はするものの、その機能をテストする場合、テストケース毎に毎回外部連携する訳にはいかないので、どうすればいいのかわかりませんでした。 仮に、毎回そのシステムにリクエストを投げてテストするとしても、その外部システムも並行している開発する場合、そのシステムが出来上がるまで待っていなければなりません。 みなさんこういった外部連携のテストをどうやって行っているのか調べていたところ、FakeWebというWebリクエストを偽装するgemライブラリがあることを知りました。 そこで、今回はこのFakeWebというgemライブラリについて紹介
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く