Top "Rspec-rails" questions

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

Object.any_instance should_receive vs expect() to receive

The following piece of code works as expected: Object.any_instance.should_receive(:subscribe) But when using the new rspec …

rspec rspec2 rspec-rails
RSpec: describe, context, feature, scenario?

describe, context, feature, scenario: What is the difference(s) among the four and when do I use each one?

rspec rspec2 rspec-rails
Rails 5, Rspec: Environment data not found in the schema

After upgrading a Rails app to Rails 5, running RSpec tests gives me the following error: rails aborted! ActiveRecord::NoEnvironmentInSchemaError: Environment …

ruby-on-rails rspec rspec-rails ruby-on-rails-5
factory girl passing arguments to model definition on build/create

models/message.rb class Message attr_reader :bundle_id, :order_id, :order_number, :event def initialize(message) hash = message @bundle_…

ruby-on-rails ruby factory-bot rspec-rails
How is spec/rails_helper.rb different from spec/spec_helper.rb? Do I need it?

I am doing the Rails Tutorial for the second time. When I enter this rails generate integration_test static_pages …

ruby-on-rails testing rspec rspec-rails rspec3
How can I test :inclusion validation in Rails using RSpec

I have the following validation in my ActiveRecord. validates :active, :inclusion => {:in => ['Y', 'N']} I am using the …

ruby-on-rails-3 shoulda rspec-rails
Unable to stub helper method with rspec

I am trying to stub a method on a helper that is defined in my controller. For example: class ApplicationController &…

ruby-on-rails ruby-on-rails-3 rspec rspec2 rspec-rails
Controller spec unknown keyword: id

I have simple action show def show @field = Field.find_by(params[:id]) end and i want write spec for …

ruby-on-rails ruby rspec ruby-on-rails-5 rspec-rails
How to request (GET/POST) routes in RSpec that have a wildcard

I have this (admittedly hideous) route in Rails: scope '/software' do post '/:software_id/:attachment_id/event/*event' =&…

ruby ruby-on-rails-3 rspec rspec-rails
`require': cannot load such file -- spec_helper (LoadError)

I am creating bundler gem --test=rspec MyGem. in which I'm getting the repository structure. When I try to run …

ruby rspec rspec2 rspec-rails rspec3