Questions tagged as 'rspec'

0
answers

How do I configure controllers to use requests?

After creating a controller a test for the controller is automatically created. You can disable this creation of the test for the controller using the code below: Rails.application.config.generators do |g| g.test_framework :rspec, controller...
asked by 10.03.2017 / 21:28
1
answer

How 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 can_move_to?(record.class::STATUS_MAP, record.status, value) record.e...
asked by 05.07.2016 / 14:45
2
answers

How to run unit tests on rspec?

When I run rake spec it runs all tests. How do I run only the unit tests.     
asked by 21.11.2014 / 13:21
1
answer

Testing in RSpec failing because of DatabaseCleaner

I was having trouble with tests about 4 days ago. At first I had a problem with "database is locked" and the file where DatabaseCleaner is configured; I changed two lines that used :transaction to :truncation and solved th...
asked by 21.08.2017 / 15:30
2
answers

How to perform test with RSpec?

Even studying TDD with RSpec I still have difficulties understanding how to perform certain tests. How would I do to perform a test for this method that has an article return? NOTE: I use MongoDB with ORM mongoID. In this case, is it...
asked by 03.02.2014 / 12:55
1
answer

How to mock a non-existent class with Rspec Mock

I am creating a lib that will use a model of Rails , but for the development of this lib I need to test without the presence of this model . Then think of mockar (I'm using the gem rspec-mock ), so I tried:...
asked by 20.03.2017 / 20:00
0
answers

How to apply serializer to an object generated by FactoryGirl?

I have an object user generated by FactoryGirl like the one below: FactoryGirl.define do factory :user do name { FFaker::NameBR.name } image { FFaker::Avatar.image } email { FFaker::Internet.email } pa...
asked by 22.11.2016 / 13:07
1
answer

Template error no rspec-rails

I'm using rspec-rails to test my application, however when testing a view that uses Ransak for filters I get the following return error: 1) admin/cities/index renders a list of admin_cities Failure/Error: render ActionView::Template:...
asked by 23.04.2015 / 20:25