タグ

関連タグで絞り込む (0)

  • 関連タグはありません

タグの絞り込みを解除

Rubyとrubyとrspecに関するat_homeのブックマーク (6)

  • Ruby on Rails with OIAX

    【最新刊】 Elixir実践ガイド[機能拡張編] impress top gearシリーズ 2020年5月22日発売! 『Ruby on Rails 6実践ガイド』の続編です。 ▶ 読者サポートページ 【最新刊】 Elixir実践ガイド impress top gearシリーズ 2021年2月5日発売!Elixir 1.11対応! 書の主要なテーマは、モジュール、関数、データ型、パターンマッチングなどです。 ▶ 読者サポートページ Elixir/Phoenix 初級④: バリデーション (OIAX BOOKS) Kindle書は、『Elixir/Phoenix初級』シリーズの第4巻です。Phoenix 1.4に対応しています。webpackの設定、whereマクロの使い方、真偽値と日付のあ使い方、Gettextモジュールによる国際化、バリデーション、エラーメッセージの日語化、など

  • 同じexampleを複数のテストで共有する - うなの日記

    RSpec documentationの「Shared Example Groups」に説明がありますが、「shared_examples_for」を使用して同じexampleを複数のテストで共有することが可能です。 「shared_examples_for <共有exampleグループ名>」で共有するexampleのグループ(「Shared Example Groups」と呼ばれるらしい。)を作成し、 共有したいテスト内で「it_should_behave_like <共有exampleグループ名>」としてexampleを取り込めばOK モジュールをincludeする感じですな。 exampleだけでなく、beforeやafterも共有できます。 # shared_examples_for で 共通のexampleを定義。 shared_examples_for "shared" do

    同じexampleを複数のテストで共有する - うなの日記
  • [RSpec] Mock API

    Mock Object Mock Objectの作成 my_mock = mock(<name>) my_mock = mock(<name>, <options>) person = mock('person', :null_object => true) Mockは名前を引数に取る。仕様の検証が終わった際に全てのMockが検証される。 option引数をハッシュで与えることでMockの振る舞いを調整できる。現在、:null_objectのみがサポートされている。:null_object => trueを引数に渡すとMockに対する全てのメソッドがMock自身を返すようになる。 Mockに対してスタブメソッドを定義する person.should_receive(:name) # person.name => nil person.should_not_receive(:name) #

  • Testing views that use CanCan and Devise with RSpec

    I was trying to test a simple index view, which has following code inside: - if can? :destroy, MyModel %th Options MyModelsController has following options (Inherited Resources + CanCan + Devise): class MyModelsController < ApplicationController inherit_resources nested_belongs_to :mymodel before_filter :authenticate_user! load_and_authorize_resource :project load_and_authorize_resource :mymodel,

    Testing views that use CanCan and Devise with RSpec
  • Turnip: A Tasty Cucumber Alternative?

    We’ve used Cucumber heavily and successfully on client work, internal projects, and open source. We also love RSpec, so when we heard that Turnip would give the ability to run Gherkin based integration tests in our RSpec suite it was a no-brainer for us to try it out on a project. Highlights of Turnip Integrates directly into your RSpec test suite Features and Step definitions live in the spec dir

    Turnip: A Tasty Cucumber Alternative?
  • bundle exec を省略する - おもしろwebサービス開発日記

    Railsアプリの開発に bundler を使うようになって、gem 関連でハマることは少なくなったような気がします。ただ、その代わりに、なにかコマンドを叩くときに bundle exec をつけ忘れてエラーになることが時々あって、そんな時に少々めんどくさく感じます。bundle exec を省略できたらどんなに幸せでしょうか。 そんなわけで、 bundle exec を省略する方法をまとめたので紹介したいと思います。 rvm の gemset をアプリ毎に作って切り替える方法 下記のエントリに詳しくまとまっています。これの通りにやれば bundle exec から解放されるのは間違いないのですが、個人的にはアプリ毎に gemset を作るのは大げさな感じがします。 rvmのgemsetを使ってbundlerと賢く付き合う方法 - Hello, world! - s21g bundler-

    bundle exec を省略する - おもしろwebサービス開発日記
  • 1