Most voted "rspec" questions
19 questions
Sort by count of
-
6
votes2
answers967
viewsHow to create a test with Rspec to verify user feedback?
That one describe below is the default that Rspec creates. I have a hard time working with TDD (Test Driven Development) and it is difficult to understand the whole procedure. For example, I need to…
-
4
votes1
answer121
viewsHow do I get Exception Mongoid::Errors::Documentnotfound released on Mongoid
I’m trying to do a test similar to the one below to capture the Exception of a non-existent document expect(Produto.find('57e2bf76ce222fd11258cd4e')).to…
-
2
votes3
answers847
viewsCorrect model test (Rspec)
I created a test to validate my model and I want to know if it is correct. describe Article do it "object article create is valid?" do article = Article.create article.title = "Title for Test"…
-
2
votes1
answer223
viewsError running continuous integration test - Travis-CI
For learning purposes I am using the services of Travis-CI to carry out the integration tests continues on a personal project. When running the test locally all pass, no errors. However, when…
-
2
votes0
answers60
viewsHow to configure schema_search_path in the test environment?
When I run the rake spec --trace command I have the error below. It seems to me that rake does not create the schema I want in the test environment by not identifying my schema configuration in…
-
2
votes0
answers125
viewsHow to create a Mock in Ruby On Rails (Carrierwave) to simulate sending an image to a S3 (Cloudinary)
I created a project creation system with image. My images are uploaded to Cloudinary + Carrierwave. Before the Test did not break because I sent to the server, but when I integrated in Cloudinary…
-
2
votes1
answer52
viewsTesting with rspec - problems with stub and should
Hello. I am new to testing and have two tests with problems, one of helper and one of model, being: 1) TodosHelper TodosHelper#visibility(todo) when todo is public Failure/Error: before {…
-
1
votes2
answers56
viewsMatcher be_true ruby/rspec
I’m starting to study about ruby/rspec by following a book, but I’m not making progress using the matcher be_true. Follow below the error: BagOfWords#push is possible to put words on it (FAILED - 1)…
-
1
votes1
answer27
viewsHow to test custom Rails Validator
Hello I have the following custom Validator class StatusMappingValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return nil if…
-
1
votes0
answers34
viewsHow do I set up controller tests to use requests?
After creating a controller a test for the controller is automatically created. You can disable this test creation for the controller using the code below: Rails.application.config.generators do |g|…
-
1
votes1
answer95
viewsRails rspec, post error :create, params require
I’m starting rspec tests on Rubyonrails and I’m having a problem testing my controller’s create: it "creates lançamento" do post :create, params: attributes_for(:lancamento), format: :js, xhr: true…
-
1
votes1
answer21
viewsRspec - Feature test failing because elements are not rendered in test execution
I have a test Feature failing because the moment it runs some HTML elements (<li data-podcast>) not yet rendered. Does anyone know how to fix it? RSpec.describe 'Podcasts List', type: :feature…
-
0
votes2
answers183
viewsHow to test with Rspec?
Even studying TDD with Rspec I still have difficulties understanding how to perform certain test. How would I perform a test for this method that has a return of articles? OBS: I use Mongodb with…
-
0
votes2
answers1260
viewsHow to run unit tests on rspec?
When I execute rake spec it runs all tests. How do I run only unit tests.
-
0
votes1
answer61
viewsTemplate error no rspec-Rails
I’m using the rspec-Rails to test my application, however while testing a view using Ransak for filters I have the following return error: 1) admin/cities/index renders a list of admin_cities…
-
0
votes0
answers27
viewsHow to serialize an object generated by Factorygirl?
I have an object user generated by FactoryGirl like the below: FactoryGirl.define do factory :user do name { FFaker::NameBR.name } image { FFaker::Avatar.image } email { FFaker::Internet.email }…
-
0
votes1
answer95
viewsHow to mock a nonexistent class with Rspec Mock
I’m creating a lib that will use a model pattern of Rails, only that for the development of this lib I need to test without the presence of this model. So think about mocking (I’m using Gem…
-
0
votes1
answer43
viewsRspec test failing because of Databasecleaner
I was having trouble with tests about 4 days ago. At first, I had trouble with "database is locked" and in the file where the DatabaseCleaner is configured; changed two lines they used :transaction…
-
0
votes1
answer752
viewsCapybara Unable to find Visible field
When rotating the command rake cucumber i get the following error: Unable to find visible field "article[text]" that is not disabled (Capybara::ElementNotFound) But the field is visible File of…