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
Take very small stepsDon’t rush ahead with more code. Instead, add another example and let it guide you to what you have to do next. And don’t forget to take time to refactor your code before it gets messy. You should keep your code clean at every step of the way. View Documentation The BookEffective Testing with RSpec 3: Build Ruby Apps with ConfidenceThis definitive guide from RSpec’s lead devel
When we introduced a default setup for system tests in Rails 5.1 back in 2016, I had high hopes. In theory, system tests, which drive a headless browser through your actual interface, offer greater confidence that the entire machine is working as it ought. And because it runs in a black-box fashion, it should be more resilient to implementation changes. But I'm sad to report that I have not found
改めて RSpec Mocks のドキュメントを拾い読みして、改めて勉強になったところをまとめました。 基本的なところは飛ばしています。 $ rspec -v RSpec 3.6 - rspec-core 3.6.0 - rspec-expectations 3.6.0 - rspec-mocks 3.6.0 - rspec-support 3.6.0 describe "Test Doubles" do let(:item) { double("item", foo: 3, bar: 4) } it '定義methodが値を返すこと' do expect(item.foo).to eq(3) expect(item.bar).to eq(4) end it '定義されていないmethodは呼び出せないこと' do expect{ item.hoge }.to raise_error(/r
関連: system specでNet::ReadTimeoutになったら - おもしろwebサービス開発日記チラシの裏 やっぱりタイムアウトの時間を伸ばすのではなく、テスト側でバリデーションの条件を緩和してあげたほうがトータルのテスト実行時間が短くなっていいんじゃないか、と思って次のようにした (設定はpalkan/anyway_config: Configuration library for Ruby gems and applicationsを使っています) class DailyReport < ApplicationRecord validates :body, presence: true, length: { maximum: -> { ValidationConfig.daily_report[:body][:maximum] } } end around do |exa
Railsで cookie sessionを使っている 非同期でAPIをよく叩いている という条件下で、例えば日報を投稿したあとに"投稿しました!"というflashメッセージを表示しているはずなのになぜか"投稿しました!"が表示されないという現象が時々起こっていました。 これは次のようなことが原因だと推測しています。 非同期API(例: 日報のプレビューを表示する)が実行される 日報投稿ボタンを押す 投稿が成功して日報詳細ページへのリダイレクト用のレスポンスが返される SetCookiesでflashメッセージを含んだcookie sessionが返される 非同期APIのレスポンスが返る SetCookiesでflashメッセージを含まないcookie sessionが返される 日報詳細ページへのリクエストが実行される このとき送信するCookieにはflashメッセージが含まれていないの
I am trying to create a logic where a user gets an invitation from a group. If they signup via that invitation, the group id will be stored in the session and when they signup, they will be automatically added to the group as a member. I am using Devise for authentication. So I customized it like this: class Users::RegistrationsController < Devise::RegistrationsController def create super if @user
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く