Data dodania Pytanie
2017-10-09 14:10 Testing a method that delegates to another object »
This is a model in my project - class Subscription < ActiveRecord::Base def active? SubscriptionValidationPolicy.new(self).active? end en...
(1) odpowiedzi
2017-10-08 05:10 How to mock Dir[] with Rspec? »
Using Rspec, I can mock Dir.glob("/my/dir/*.tmp") doing this: expect(Dir).to receive(:glob).with("/my/dir/*.tmp") How would I mock Dir["/my/dir/*....
(1) odpowiedzi
2017-10-08 04:10 overwrite let inside an it method to alter params send to subject »
It's possible to overwrite a let value inside an spec? I wanted to be able to set subject and modify my params within each test, something like: su...
(1) odpowiedzi
2017-10-08 00:10 How to test that URI is called only once »
I have this method: def url @url ||= URI("#{API_BASE}/#{url_token}") end I want to test using rspec that the URI is called only once. However, as...
(1) odpowiedzi
2017-10-07 18:10 RSpec -- Tests seeming to be getting stuck »
So I have a handful of tests. These have run in the past, but now when I run rspec it seemingly just hangs. Any thoughts here or best approach to go ...
(1) odpowiedzi
2017-10-07 02:10 rails rspec and capybara testing search box input »
I'm trying to figure out how to test a search box. in rspec\capybara I'm creating 2 jobs, visiting the page where the search box is, entering a searc...
(1) odpowiedzi
2017-10-06 21:10 Rspec and FactoryGirl: SystemStackError: stack level too deep rails »
I have one spec and one factory and I am getting this error: SystemStackError: stack level too deep from gems/activerecord-4.2.1/lib/active_recor...
(2) odpowiedzi
2017-10-06 14:10 how to write test case using rspec of this method »
I want to write test case for below method. I'm new to unit testing. Please let me know the correct way to write test case for below method. def crea...
(1) odpowiedzi
2017-10-06 14:10 Capybara doesn't care about event.preventDefault »
Testing Ruby on Rails application with RSpec, Capybara and Selenium. I want to click an anchor which has an href but shouldn't lead anywhere due to ...
(1) odpowiedzi
2017-10-05 21:10 Rspec can't find ActiveAdmin controller »
I'm trying to test a custom member action in ActiveAdmin using rspec. app/admin/inactive_user.rb ActiveAdmin.register InactiveUser do member_actio...
(1) odpowiedzi
2017-10-05 02:10 Not able to run selenium with firefox, Capybara and Docker in headless mode »
I'm trying to run tests with Selenium and Firefox with Capybara. When I run a test, it does a POST request to "http://127.0.0.1:4444:/sessions", it st...
(1) odpowiedzi
2017-10-05 01:10 Writing tests for API token auth controller in Rspec »
I am following this tutorial to create token authentication: tutorial Here is the controller code from the tutorial Session controller for API: cla...
(0) odpowiedzi
2017-10-04 23:10 Rspec - archives array to match tested array »
I'm having this class method on my Post model for getting archives def self.archives Post.unscoped.select("YEAR(created_at) AS year, MONTHNAME(cr...
(2) odpowiedzi
2017-10-04 15:10 Enable diffing for RSpec array matcher »
RSpec provides a "diff"-style output when comparing multi-line strings. Is there a way to do something similar when comparing arrays (other than conv...
(1) odpowiedzi
2017-10-04 09:10 Ruby .times method returns variable instead of output »
In order to pass an rspec test, I need to get a simple string to be returned "num" amount of times. I've been googling and it seems the .times method ...
(2) odpowiedzi
2017-10-03 14:10 FactoryGirl won't create nested objects without reloading parent »
I'm trying to use rspec and FactoryGirl for my acceptance tests in Rails app. I have Program, ProgramLesson, Course, Lesson objects. Here are the mo...
(0) odpowiedzi
2017-10-03 13:10 Fuubar gem progress bar overwritten by other logs »
I included gem fuubar for rspec test progress. Probably due to this, every time Fuubar progress bar is updated, almost immediately it's overwritten ...
(0) odpowiedzi
2017-10-02 16:10 How to assert range for password_length »
User.password_length gives me 11..256, how do I assert it it do expect(User.password_length).to be_between(11, 256) end But I am getting th...
(0) odpowiedzi
2017-10-01 17:10 How to simulate user input multiple times for gets »
I based my UI on a console and case/when. I want to write some rspecs for the code. This is my piece of code: case choice when '1' #Create account ...
(1) odpowiedzi
2017-10-01 12:10 Why I still can use Capybara method inside Rails Rspec Type Request »
According to Rspec Request Specs Capybara is no longer supported in request specs as of Capybara 2.0.0. Why I still can use Capybara methods fro...
(1) odpowiedzi
2017-09-30 21:09 Why am I getting a RunTimeError in my tests and the opposite boolean than expected? »
What I don't understand is why not_stormy.stormy? is equating to true!! As you can probably tell I'm almost completely new to both Ruby and Rspec. An...
(2) odpowiedzi
2017-09-30 08:09 What is 'valid?' in RSpec? Where can I look at it? »
I've attempted to create a model, which needs to pass a series of validation tests in RSpec. However, I constantly get the error expected #<Survey...
(1) odpowiedzi
2017-09-30 07:09 Rspec can't reproduce failures not even with minimal reproduction commands from bisect »
We use Travis CI to maintain our project on git. The issue here is on Travis we have 2 processes running a random selection of specs each with differe...
(1) odpowiedzi
2017-09-29 20:09 for-loop or while-loop doesn't work on third and fourth iteration »
I'm working on a Ruby assignment that tasks you with building a small, test-driven program that translates some words and phrases into pig latin. Fir...
(1) odpowiedzi
2017-09-29 06:09 Rails + RSpec + Set the Order of Test Cases Files while running RSpec Test Suite »
For RSpec Capybara Test Case [ Selenium ], I have near about 7 to 8 spec files. Few of the test cases are dependent on each other. For example, before...
(3) odpowiedzi
2017-09-29 02:09 Run rake assets:precompile before tests that include :js tag and skip otherwise »
tl;dr -- Is it possible to run a single command (e.g. rake assets:precompile ) only when there is a :js test included in the body of tests being run?...
(1) odpowiedzi
2017-09-28 17:09 TypeError: superclass mismatch for class Task »
I have a Rails project and use RSpec for testing. Recently, I added this in my spec_helper.rb: config.before(:suite) do Rails.application.load_task...
(1) odpowiedzi
2017-09-28 16:09 Ruby Undefined method error - Using Beaker »
I'm quite new to all of this. I am trying to test out a puppet module using Beaker. I keep getting this: NoMethodError: undefined method `descri...
(0) odpowiedzi
2017-09-28 15:09 Rspec - uninitialized constant error User »
I have written tests on Rspec for my model User and get error while starting 'rspec spec' NameError: uninitialized constant User my test spec/models...
(0) odpowiedzi
2017-09-27 20:09 Rspec - NoMethodError: undefined method `cookies' for Object »
Try to add rspec tests to my App and have following error: NoMethodError: undefined method `cookies' for # Here is my simple code: get :my_ac...
(1) odpowiedzi
2017-09-27 15:09 Where is spec_helper.rb file located? »
I was trying to run the tests using rspec spec.rb But it is giving me following warning: Deprecation Warnings: Requiring `rspec/autorun` when runni...
(0) odpowiedzi
2017-09-27 12:09 Rspec expect(instance) to receive method not working as expected »
#controller file def update @payment = Payment.find_by(reference_id: params[:reference_id]) if @payment.update(update_params) @payment.do_some...
(2) odpowiedzi
2017-09-26 20:09 Passing local variable as parameter into RSpec shared_examples Always Nil »
I have a spec like this: shared_examples_for 'using the id' do |the_id| it 'should do something with the id' do # do something with the_i...
(1) odpowiedzi
2017-09-26 10:09 How to stub/mock without coupling the test to the code under test with rspec? »
Say there's a worker, whose job is to: find or create a record by a set of critaria; update an attribute of the record. Here's a sample implement...
(1) odpowiedzi
2017-09-26 06:09 Assigns usage in Rspec »
I'd like to ask why i'm always getting nil value when running rspec controller test ? I already read in this site and most of answers because plurals ...
(2) odpowiedzi