I Can’t Get No Satisfaction (From Fixtures) Here at thoughtbot, we’ve had it with fixtures. Is Susie an admin? Which user owns the Exciting Test post? Are there any categories without posts, or should I add that fixture for this test? How did this post end up in the future? Do you like asking these questions when writing tests? I don’t. I also don’t like tests that don’t tell you anything about th
part1は以下をご覧ください。 Rails: ActiveModelSerializersでAPIを作る–Part 1(翻訳) 概要 原著者の許諾を得て翻訳・公開いたします。 英語記事: Rails API with Active Model Serializers – Part 2 著者: Piotr Jaworski サイト: https://www.nopio.com/ -- RailsやWordPressの開発を請負っているポーランドの会社です。 チュートリアルリポジトリ: nopio/rails_api_tutorial_part2 ※元記事はRails 5.0.1以降を使っています。 本シリーズの前回の記事では、Rails 5でソリッドなAPIを構築する手順について解説しました。今回は、構築したAPIのテストと、RSpecで読みやすいクリーンなテストを書く方法について解説いた
common_test で spec を使う 誰でも一度は作るというMySQLクライアントですが、いざ作ってみると困るのがテストです。本家のオプションを網羅する気はもちろんないですが、バージョン毎の分岐はやらないわけにはいきません。とりあえず 5.[5-7] で、それぞれ機能単位のテストを、一度に済ます、を目標としました、が、 さて、どうしたものかと。 ここは "多機能で大抵できる"、"覚えたら便利" という噂のcommon_testを使うトコ、ですよね? まぁ、きっかけはともかく、状況としてはよくある話でしょうし、覚えているうちに書き留めておこうと思います。 ※ ただし erlang-17.4 では動きません。orz 流れとしては、まず前提として appで変数の初期値を設定し、 configでそれらを上書く ようアプリを作ります。その上で テスト毎にct_configを作り、 それをsp
On a recent project, a client’s test suite had slowed down to a painful 15 minutes even when running with parallelization. It was great to see that the team maintained a balanced testing pyramid, but we were surprised by the completion times of even the simplest unit specs. # spec/models/user_spec.rb describe "associations" do subject(:user) { User.new } it { should have_many(:orders) } # 12 addit
System Testing¶ ↑ System tests let you test applications in the browser. Because system tests use a real browser experience, you can test all of your JavaScript easily from your test suite. To create a system test in your application, extend your test class from ApplicationSystemTestCase. System tests use Capybara as a base and allow you to configure the settings through your application_system_te
Rails プラグイン Gem を作る方法の紹介です。現在の Rails では、プラグインを Gem としてビルドします。通常の Ruby Gem と異なるのは、Rails プラグイン Gem は Rails のコアフレームワーク自体を拡張することができる点です。Rails 自身を拡張して機能を追加したい場合は、Rails プラグインとして Gem を作成すると良いでしょう。 通常の Ruby Gem の作り方は、以下を参照お願いいたします。 Gemの作り方(Ruby Gem) | EasyRamble また、Rails でライブラリとして組み込むことができる gem には、通常の Ruby Gem、Rails プラグイン、Rails エンジンの3種類があります。それぞれの違いについては、以下の解説がとても分かりやすいです。 Gem、Railtieプラグイン、Engine(full/mou
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く