Skip to main content

All Questions

0 votes
1 answer
88 views

Can't pass images as params in Rspec Rails controller spec

Trying to test the create action in post_controller. All other controllers' create actions work just fine. After some debugging, the error seems to be the params. The images passed from the post ...
Usman Ahmed's user avatar
0 votes
0 answers
38 views

How to raise timeout error in unittesting

This is first time i am touching ruby, so no sure about correct terminology. I have tried searching for mulitple things, but couldn't find a solution. I have this code block domain_response = MyDomain:...
Em Ae's user avatar
  • 8,526
1 vote
2 answers
1k views

(RSpec) How do I check if an object is created?

I want to test if expected exception handling is taking place in the following Ruby code through RSpec. Through testing I realized that I cannot use the raise_error matcher to test if the exception ...
DashwoodIce9's user avatar
1 vote
1 answer
750 views

Ruby: rspec not catching exceptions?

I'm having trouble grasping how rspec handles exceptions. In this case, I'd like to ensure the exception is properly caught and returned in a formatted message. Consider the following: class Sample ...
no_onespecial's user avatar
0 votes
1 answer
510 views

Expected Exception but nothing was raised using Rspec. Trying to raise_error when variable is empty

I am trying to pass this last test, trying raise an exception I can't make it work. Is there something I'm not seeing? I've been looking at it for hours and looking for an answer, thank you in advance ...
arctich's user avatar
0 votes
1 answer
138 views

Rails Test Expects NIL

So I am writing a unit test to test whether a contact is blocked... if it is blocked then I expect the contact to be unable to send a message. Here is backend logic I am trying to test if account ...
kahuria00's user avatar
  • 357
0 votes
1 answer
2k views

test update request with RSpec failed

I have two problems when I try to test the update action with RSpec, here is the controller file: #volunteers_controller.rb module Api module V1 class VolunteersController < ...
Yingqi's user avatar
  • 1,335
3 votes
4 answers
4k views

How do I test an instance variable in a controller?

A couple of my mentors have told me to test a piece of code with controller spec even though the contents are being tested by some request specs. I am wondering if I can test whether an instance ...
airvine's user avatar
  • 700
0 votes
1 answer
409 views

Stubbing Out Instance Methods In MiniTest

I have a handful of instance methods I need to stub out before I test an assertion within the context of MiniTest. Would there be a way to accomplish this out of the box? The examples I've come ...
Drew's user avatar
  • 2,633
1 vote
2 answers
106 views

Testing methods of class when instantiation creates HTTP request

I have some tests for an object that look like as follows: let(:bot) { MyObject.new('/some/config/file.json') } The problem is, the very act of instantiating MyObject creates an HTTP request. The ...
john's user avatar
  • 11
0 votes
1 answer
261 views

Testing recursive IO prompt in rspec

I am writing a connect-four game for more OO and rspec practice. As part of my program, I would like to prompt the user to choose a column that they would like to put their game piece in. Here's that ...
Brian Monaccio's user avatar
0 votes
1 answer
53 views

RSpec: assert that mocks are correct

When writing RSpec tests, I often find myself mocking various functions in the code base. However, there doesn't seem to be anything in place to prevent me from accidentally mocking the functions ...
cjspook's user avatar
  • 89
0 votes
2 answers
530 views

Validation tests in Ruby on Rails always false

I am writing some unit tests in Ruby on Rails. Even when I expect the test to have an outcome that passes the validation, the test fails. Here is my model that I am testing: class Post < ...
Goose9192's user avatar
  • 109
-1 votes
2 answers
421 views

How to Unit Test a Ruby on Rails Application

My company recently received a new contract in which the client's technologies are Ruby and Ruby on Rails. I've finished learning those, but am really struggling to learn how to do Unit Testing. Since ...
Michael Weitzman's user avatar
1 vote
0 answers
60 views

Testing Helper Method w/ Controller Dependency

As a part of my rails application I created a helper under ApplicationHelper that checks for devise generated errors and adds them to the flash[:error] hash. def devise_flash if controller....
Adam Thompson's user avatar

15 30 50 per page
1
2 3 4 5
9