rspec2.99でinclude_examplesを使用しています。 spechoge.rb describe 'hoge_type' do before do end include_examples 'toarutesuto' end spec/support/lib/kyouyuu.rb require 'spec_helper' describe "テストを共有" do before do end shared_examples 'toarutesuto' do before do end it'' do end テストを実行すると、以下ワーニングが出ます。 Deprecation Warnings: -------------------------------------------------------------------------------- Accessing
Yes, I know, that testing private methods it's not a good idea (and I read this thread - http://www.ruby-forum.com/topic/197346 - and some others) But how can I test the following code? I use xmpp4r. In my public method #listen I start receive jabber messages like so: def listen @client.add_message_callback do |m| do_things_with_message(m) end end private def do_things_with_message(m) # end #add_m
Pagination のテストのために、最初は以下のようなコードを書いていたのですが、一つのページ内に複数のPagination を表示するページなので、一番上のブロックのみを確認することにしました。 find("//*[@class='pagination']//a[text()='2']").click expect(page.status_code).to eq(200) これに、以下のように *[@class='pagination'] の末尾に [1] を追加したのですが Capybara::ElementNotFound になってしまいます。 find("//*[@class='pagination'][1]//a[text()='2']").click expect(page.status_code).to eq(200) Test 環境ではなく Development 環境
Using rails, devise, rspec & factorygirl: Trying to create some tests for my site. I'm using the confirmable model for devise so when I create a user using FactoryGirl, the user isn't confirmed. This is my factories.rb: FactoryGirl.define do factory :user do full_name "Aren Admin" email "aren@example.com" password "arenaren" password_confirmation "arenaren" role_id ADMIN end end And this is my rsp
On Rails 4.0.0.rc1, Ruby 2.0.0, after I run a migration, I see the following error when I try to run a test through rspec: /Users/peeja/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/migration.rb:376:in `check_pending!': Migrations are pending; run 'rake db:migrate RAILS_ENV=test' to resolve this issue. (ActiveRecord::PendingMigrationError) That doesn't
I'm working on a reset_password method in a Rails API app. When this endpoint is hit, an ActiveJob is queued that will fire off a request to Mandrill (our transactional email client). I'm currently trying to write the tests to ensure that that the ActiveJob is queued correctly when the controller endpoint is hit. def reset_password @user = User.find_by(email: params[:user][:email]) @user.send_rese
When writing a request spec, how do you set sessions and/or stub controller methods? I'm trying to stub out authentication in my integration tests - rspec/requests Here's an example of a test require File.dirname(__FILE__) + '/../spec_helper' require File.dirname(__FILE__) + '/authentication_helpers' describe "Messages" do include AuthenticationHelpers describe "GET admin/messages" do before(:each
It's my understanding that Rails' testing environment is torn down and rebuilt before each test...so how do I test a controller that requires that a user be logged in and that user can't be created without Device's confirmable module getting in the way? Devise's recommended method (below) creates a new user which is then sent an email by Devise's confirmable module. How do I get around this so I'm
I tend to use before blocks to set instance variables. I then use those variables across my examples. I recently came upon let(). According to RSpec docs, it is used to ... to define a memoized helper method. The value will be cached across multiple calls in the same example but not across examples. How is this different from using instance variables in before blocks? And also when should you use
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く