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
translations Documentation RSpec is a great tool in the behavior-driven development (BDD) process of writing human readable specifications that direct and validate the development of your application. On the web there are many resources that give complete overview of _what_ you can do with RSpec. But there are fewer resources devoted to how to create a great RSpec test suite. Better Specs tries to
はじめに 以前から何度か紹介しているRSpec本の翻訳が終了し、ついに販売を開始しました! 提供フォーマットはMOBI(Kindle)、EPUB(iBooks)、PDFで、下記のページから購入できます。 Everyday Rails - RSpecによるRailsテスト入門 - Leanpub 今回は改めてこの本の紹介を書いてみようと思います。 「Everyday Rails - RSpecによるRailsテスト入門」ってどんな本? 「Everyday Rails - RSpecによるRailsテスト入門 ~テスト駆動開発の習得に向けた実践的アプローチ~」はタイトルの通り、RSpecを使ったRailsの自動テストを説明した技術書です。 内容としては比較的易しめで、そこまで高度な話題は出てきません。なのでRSpecの未経験者~中級者かつ、Railsを使って開発している技術者がターゲット層にな
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
[Sitespec](https://github.com/r7kamura/sitespec)という静的サイト生成ツールを作り、このブログを移行した。 ## Sitespec Sitespecは、Webアプリとテストから静的サイトを生成するためのツール。 WebアプリにはRackを、テストにはRSpecを使う。 Rackを使った適当なWebアプリを用意し、 RSpecでHTTPリクエストを発行するように記述したテストを実行すると、 レスポンスの内容から静的ファイルが生成されるという仕組みになっている。 参考までに紹介しておくと、静的サイト生成ツールには他に [Middleman](http://middlemanapp.com/)や[Octopress](http://octopress.org/)、[Movable Type](http://www.movabletype.jp/) な
RSpec is a Behaviour-Driven Development tool for Ruby programmers. BDD is an approach to software development that combines Test-Driven Development, Domain Driven Design, and Acceptance Test-Driven Planning. RSpec helps you do the TDD part of that equation, focusing on the documentation and design aspects of TDD. Documentation This is the official documentation site for RSpec. Much of the document
和田 卓人(@t_wada) 作『RSpec の入門とその一歩先へ、第2イテレーション』はクリエイティブ・コモンズ 表示 - 継承 4.0 国際 ライセンスで提供されています。 #coffee.rb の写経会に招かれた(というよりは押しかけた?)ので、先日の RSpec チュートリアルの続きを記します。このエントリは写経会に参加しながらのライブ更新でした。 (更新) 第3イテレーションも書きました。続きに興味ある方はご覧下さい 前回終了時点のコードと実行結果 前回終了時点でのコードを以下に記します。 message_filter.rb class MessageFilter def initialize(word) @word = word end def detect?(text) text.include?(@word) end end message_filter_spec.rb r
このウェブサイトは販売用です! twiwt.org は、あなたがお探しの情報の全ての最新かつ最適なソースです。一般トピックからここから検索できる内容は、twiwt.orgが全てとなります。あなたがお探しの内容が見つかることを願っています!
RSpecで使う基本メソッド(describe/context/it/its/before/after/subject/let/shared_examples_for)をまとめてみる。 参考リンク RSpec - 本記事はここのほぼ抜粋です。よくまとまっています RSpec を使い始める人が読むべき N 個のドキュメント | Aiming 開発者ブログ - 参考リンクがいっぱいあります。上の記事もここで見つけた describe/context - テスト名。テスト対象自身のオブジェクト(subject代わり)でもOK before - 事前条件。example(it)の前に実行される。before :each はexample毎、before :all はdescribe毎に呼ばれる after - 事後処理。以後のテストに影響が出ないように後始末が必要な時に記述する subject -
Ruby,Rubygems,MongoDBはインストールされているものとする MongoDBのインストールについてはCentOSであれば前にちょっと書いた 過去の記事:CentOS5.5にMongoDBをインストールする - chulip.org インストール Bundlerを使用して必要なGemをインストールする。 なおMongoDBのORMとしてMongoidを使用する $ gem install bundlerGemfile source :rubygems gem 'sinatra' gem 'mongoid' gem 'bson_ext' gem 'SystemTimer' #1.8.7だけ必要だったぽい group :test do gem 'rspec' gem 'rack-test' end$ bundle install bson_extとSystemTimer bson
rspec-system provides a framework for creating system tests using the rspec testing library. The goal here is to provide facilities to aid in the launching of tests nodes, copying of test content to such nodes, and executing commands on such nodes to be tested with standard rspec assertions within the standard rspec test format. Note: This library is fairly new at the moment, so your mileage may v
ちょっと前に話題になったRSpecのスライドがステキだったよね。でもRSpecはまだまだ底知れない気がするので自分でもいろいろと調べてみようと思った次第。 まずはrspec-core(2.5.1)/features/example_groups/shared_example_group.featureを参考にshared example groupについて調べてみたよ。 例1:テストを共有できる require "set" shared_examples_for 'a collection' do subject { described_class.new [7, 2, 4] } its(:size) { should eq 3 } it { should include 7 } it { should_not include 9 } end describe Array do it_be
以前書いたものの続きです。 題名の通りsinatraでrspecを使う基本的なことがらになります。 sinatraだけの設定を考えるとtest/unitと同じです。乱暴に言うとassertがshouldになるだけだと思ってよいと思います。 サンプルコード 前回のサンプルコードをrspecで書く。 require './hello_world' require 'rspec' require 'rack/test' set :environment, :test describe 'The HelloWorld App' do include Rack::Test::Methods def app Sinatra::Application end it "says hello" do get '/' last_response.should be_ok last_response.body.
Testing Sinatra with Rack::Test All examples in the following sections assume that Test::Unit is being used in an attempt to be as general as possible. See the Test Framework Examples for information on using the test helpers in other testing environments. To use the Rack::Test library used when you require rack/test, you’ll need to install the rack-test gem:
「sinatraすげー」って今さら思い、sinatraで何か作ってみようかねーと思い、当然テストのことが気になりました。 そもそも「テスト出来るの?実はrailsと比べて大変じゃないの???」って感じのアホな不安でした。(1週間前までsinatraのことと言えば名前しかしらなかったので。。)テストについてはちゃんと公式ページで解説されています。rspecも使えます。capybaraも使えます。他のテストフレームワークも使えるようです。 参考ページは Testing Sinatra with Rack::Test です。ここの内容を理解していきます。 サンプルコード テスト対象のコード。いつものhello world。 require 'sinatra' get '/' do "Hello World #{params[:name]}".strip end テストコード require '.
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く