rspec Questions

4

Solved

I'm trying to test for a redirect on the homepage in my sinatra app (more specifically, a padrino app), in rspec. I've found redirect_to, however it seems to be in rspec-rails only. How do you test...
Hypnosis asked 15/9, 2011 at 0:4

2

Solved

We have an asynchronous task that performs a potentially long-running calculation for an object. The result is then cached on the object. To prevent multiple tasks from repeating the same work, we ...
Virtuosic asked 7/1, 2010 at 1:20

3

Solved

I'm using VCR gem to record http interactions and replay them in future. I want to filter-out my actual password value in the uri request. Here's sample of what the uri looks like: http://services...
Chansoo asked 22/3, 2012 at 3:43

9

Solved

How do I turn off transactional fixtures for only one spec (or Steak scenario) with RSpec 2? I tried some things found on the web without any success. This leads to an undefined method exception. ...
Rupertruperta asked 4/10, 2010 at 5:35

2

I am trying to make parallel tests using rspec and rails 6. According to their documentation, it is just required to add PARALLEL_WORKERS=15 where 15 is the number of workers. However, this works f...
Affright asked 27/7, 2021 at 17:53

3

I wish to switch between browser tabs for a feature I am testing. However I have not been able to do this. Have tried using the following: page.driver.browser.switch_to.window(page.driver.browser....
Stannwood asked 14/7, 2014 at 20:45

13

Solved

Since I've started using rspec, I've had a problem with the notion of fixtures. My primary concerns are this: I use testing to reveal surprising behavior. I'm not always clever enough to en...
Salvia asked 11/3, 2009 at 21:2

3

I'm upgrading a large, commercial (proprietary) Rails 6 application to Rails 7. We never used Webpacker, and are instead going directly from bundled gems for things like Bootstrap, to the "Rai...
Elocution asked 25/2, 2022 at 8:2

6

Solved

I tried to test my Rails 3 application on Windows with RSpec. I've wrote tests and factories, but can't solve the issues which raise when I run RSpec on command line. Here is one of the test file...
Evanesce asked 7/1, 2013 at 0:22

4

Solved

I have created a simple Rspec test to verfiy if a model created has been deleted. However, the test fails because the model still exists. Can anyone provide any assistance on how to determine if th...
Ameeameer asked 8/2, 2021 at 19:39

2

Solved

I have a problem with rspec behavior. I try to write test for service where I use session, for read some value and overwrite this value. For example what I want to test class CurrentCartService ...
Scarlet asked 7/4, 2019 at 15:17

5

Solved

I want to test a model with RSpec but I probably have stumbled on a typo that I just can't find. Can somebody please help me a bit? I've been struggling with it for a long time and just can't find ...
Luciennelucier asked 26/6, 2013 at 21:29

4

I am using Cocoon to add records. IDs look like workshop_instance_sessions_attributes_1477654140_start_time . At the moment I am traversing the DOM and grabbing the dynamically generated IDs (this ...
Synovitis asked 28/10, 2016 at 11:53

3

Solved

I am in the middle of porting part of a ruby on rails project into a gem. I have used bundle gem to create the new gem directory. For the lib and spec directories, the gem's project layout looks li...
Admittance asked 11/12, 2013 at 8:0

4

Solved

Following the Railscast on Devise and OmniAuth I have implemented an OmniauthCallbacksController < Devise::OmniauthCallbacksController which contains a single method to handle an OmniAuth callba...
Whitehall asked 8/5, 2013 at 20:15

5

So this is kind of baffling me as I can't quite figure out why it's happening. This only happens on my laptop (Ubuntu 11.04), and not elsewhere. I just seem to have something weird with the setup o...
Carrolcarroll asked 6/10, 2011 at 18:11

4

Solved

Working on a new Rails 3.2.9 app with rspec and capybara. I have the following in the Gemfile: gem 'rspec-rails' gem 'capybara' and the following in spec/spec_helper.rb: require 'rspec/rails' ...
Minh asked 6/12, 2012 at 16:0

4

If I have some test, e.g. require_relative "Line" require_relative "LineParser" describe Line do it "Can be created" do load "spec_helper.rb" @line.class.should == Line end it "Can be p...
Aliciaalick asked 15/10, 2013 at 1:57

2

Solved

I use pundit for authorization and RSpec for testing in my rails app. Due to this, I had to create specs for the policies. However, I am having a problem with rubocop throwing an error: RSpec/Multi...
Kania asked 17/4, 2021 at 19:14

3

Solved

I am writing a spec for my rails 3 application. I want to test that db transactions are really working. It would be really helpful to be able to see the sql queries being generated my app while bei...
Beneath asked 30/7, 2011 at 16:16

4

Solved

I am current developing an API endpoint in rails. I want to be sure the endpoint response with the correct error status if the data I need is invalid. I need an array of ids. One of the invalid val...
Envoi asked 18/7, 2018 at 7:36

5

Solved

I am trying to test my views with RSpec. The particular view that is causing me troubles changes its appearance depending on a url parameter: link_to "sort>name", model_path(:sort_by => 'nam...
Pigsty asked 26/11, 2009 at 10:3

4

I have several ruby scripts and test them with rspec. I put my environments in a env.rb file (for now) so I can access them locally and in production put them in the config variables. But when I ...
Clifford asked 19/12, 2014 at 6:36

4

Solved

So I'm writing a rspec test. It will test if a model is duplicated correctly. So the spec is something like this: it "should copy the data" do @model = build(:model) @another_model.copy_data(@...
Singer asked 2/10, 2013 at 18:33

6

Solved

I have been attempting to test this method for the past few days with no luck. Another thing I'd like to be able to do is rescue the error that bubbles up after the final retry attempt is made. P...

© 2022 - 2025 — McMap. All rights reserved.