Top "Rspec-rails" questions

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

Why is my RSpec not loading Devise::Test::ControllerHelpers?

I'm using Rails 5, and Devise 3.5.1. Going through a nice (older) book about creating/testing an API, which uses Devise authentication. …

ruby-on-rails devise rspec-rails warden
How to include a support file for rspec

I'm building a rails 4 app. I created a support file to simulate a login. Here are the files spec/support/…

ruby-on-rails rspec rspec-rails
Capybara tests with :js=>true... Routing Error: No route matches [GET] "/assets"

I'm getting a similar error in a number of tests when I add ":js => true" to them. eg: An …

ruby-on-rails-3 capybara rspec-rails
How to complete the rspec put controller test from scaffold

I'm using scaffolding to generate rspec controller tests. By default, it creates the test as: let(:valid_attributes) { skip("Add …

ruby-on-rails rspec factory-bot rspec-rails scaffolding
How can I use RSpec to test the response code on a CanCan failed authorization?

I'm working on a rails project in which I use CanCan to authorize my resources. When a user is not …

rspec controller cancan rspec-rails
Rspec validate uniqueness with scope

I have this in my Line model validates :home_team, :uniqueness => { :scope => [:visiting_team, :event_datetime], :message => "** …

ruby-on-rails rspec rspec-rails
Testing Rails 3.1 mountable engine with Rspec

I started making a Rails 3.1 engine, and I'm having a hard time testing it using rspec. First of all, if …

ruby-on-rails rspec ruby-on-rails-3.1 rspec-rails rails-engines
mock Rails.env.development? using rspec

I am writing a unit test using rspec. I would like to mock Rails.env.develepment? to return true. How …

rspec rspec2 rspec-rails
Rails Phantomjs, poltergeist, and Capybara not playing well together

Working in a rails 3.1.2 project (mac OS X), I have PhantomJS properly installed (I can run code like the following …

ruby-on-rails-3 capybara rspec-rails phantomjs poltergeist
Appending headers to Rspec controller tests

I'm trying to write out tests for a controller of mine that takes in requests from external services. So far …

ruby-on-rails ruby ruby-on-rails-3 rspec rspec-rails