Top "Rspec-rails" questions

rspec-rails is an extension of the RSpec testing framework that provides support for testing Ruby on Rails applications.

Show runtime for each rspec example

currently I'm running more than 1k examples and it's taking a long time to complete (more than 20 minutes!!!). I'd like …

ruby-on-rails tdd rspec rspec-rails
Rspec : PG::ConnectionBad: PQsocket() can't get socket descriptor

I run my rspec and most of the test were failed. I got the same error for them, which is: …

ruby-on-rails rspec rspec-rails
Rspec 3.6, Rails 5 error: wrong number of arguments (given 2, expected 1) for `post` request

I just started a new project in Rails 5, (my first, though I have several projects in Rails 4.x.) and am …

ruby-on-rails rspec ruby-on-rails-5 rspec-rails
how to test rspec shoulda for custom validation in rails?

I have a Private methods in my model like the following: validate :record_uniq private def record_uniq if record_…

ruby-on-rails ruby-on-rails-3 rspec rspec-rails shoulda
before hook in rspec same as before :all?

I am wondering whether the before (as seen below) is the same as before :all in RSpec. Sometimes neither :each …

rspec rspec2 rspec-rails
devise and rspec-rails - How to sign-in user in Request type specs (specs tagged with type: :request)?

Environment Rails 4.2.0 ruby-2.2.1 [ x86_64 ] devise 3.4.1 rspec-core 3.2.2 rspec-rails 3.2.1 In my /spec/rails_helper.rb I have included Devise helpers for spec …

devise rspec-rails ruby-on-rails-4.2
Testing Default scope in RSpec

I am trying to test my default scope line in a model. My test is as follows: it 'orders by …

ruby-on-rails testing rspec rspec-rails
Capybara 2.1 Error uninitialized constant Rails (NameError)

I just upgraded my Capybara Gem from version 1 to 2.1.0 (latest). Based on Capybara Readme, I added this following lines to …

rspec ruby-on-rails-3.2 capybara rspec-rails
How do you test your Config/Initializer Scripts with Rspec in Rails?

So I was searching online for a solution, but there seems to be scarce information about testing initializers created in …

ruby-on-rails rspec config rspec-rails initializer
Rails / Rspec - writing spec for delegate method (allow_nil option)

Given the code below: (1) How would you go about writing a spec to test the :allow_nil => false option? (2) …

delegation rspec-rails