Questions tagged [database-cleaner]

Database Cleaner is a set of strategies for cleaning your database in Ruby, primarily for testing purposes.

Database Cleaner is a set of strategies for cleaning your database in Ruby.

The original use case was to ensure a clean state during tests. Each strategy is a small amount of code but is code that is usually needed in any ruby app that is testing with a database.

ActiveRecord, DataMapper, Sequel, MongoMapper, Mongoid, CouchPotato, Ohm and Redis are supported.

https://github.com/DatabaseCleaner/database_cleaner

145 questions
0
votes
1 answer

About transaction using in RSpec test

I met a very strange issue when writing test using RSpec. Assume that I have 2 models: Company and Item with association company has_many items. I also set up database_cleaner with strategy transaction. My RSpec version is 2.13.0, database_cleaner…
0
votes
1 answer

What's the fastest way to run integration tests against a rails app with significant database seeds?

I've got a ruby on rails application with significant database seeds that tie into the UI elements and are thusly required for integration tests. I'm using database_cleaner to clean up after my tests, but due to the heavy js use of the application…
0
votes
1 answer

Database cleaner removes data when it shouldn't

Has anyone ran into problem like that? I have a controller, which triggers mailer delivery: def create create! do |success, failure| success.js do CandidateMailer.donation_notification(current_candidate).deliver end …
Serge Vinogradoff
  • 2,262
  • 4
  • 26
  • 42
0
votes
1 answer

Two Questions about ORMs and Database cleaning using the transaction strategy

I am writing proof of concept tests using an existing Cucumber and Ruby suite. The corporation I am doing this for has a stack that includes Java and DB2 among other things. Currently the tests that use the database degrade our test database, and…
David West
  • 2,256
  • 6
  • 32
  • 62
0
votes
1 answer

An error occurred in an after hook NoMethodError: undefined method `each' for nil:NilClass (AngularJS)

I'm using Rails 3.2.13 with postgres, rspec 2.13, capybara 2.0.3 and database_cleaner 0.9.1. I'm also using AngularJS. I have a spec with js:true which tests the submission of a form (creating a standard rails model instance). The only thing that's…
morgler
  • 1,669
  • 1
  • 18
  • 26
0
votes
0 answers

Spec sometimes pass and sometimes don't

I have request spec: describe "Matches" do describe "GET /matches" do it "works! (now write some real specs)" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get matches_path …
Hauleth
  • 22,873
  • 4
  • 61
  • 112
0
votes
1 answer

No database cleaning or empty database

I can't manage to make my test suite work. I've tried to mix and match different configurations. But the results are all the same for this view: either nothing gets cleaned between tests or either the database is empty. I get this kind of errors…
0
votes
1 answer

Rails database_cleaner wipes the entire database

I am trying to set up cleaning of my specs using database_cleaner gem. I have the following simple config in my spec_helper.rb: require 'database_cleaner' RSpec.configure do |config| config.use_transactional_fixtures = false config.before…
alexs333
  • 12,143
  • 11
  • 51
  • 89
-1
votes
1 answer

Rails + Rspec: Database cleaner gem is not working

I need some guidance on how to get database cleaner to work for my rails app. ID of records keep on increasing for each test and is not being wiped out. I've set up a test to check if database cleaner works and it…
doyz
  • 887
  • 2
  • 18
  • 43
-1
votes
1 answer

Inconsistent database using Rails, Rspec, Selenium and use_transactional_fixtures

I ran into a problem using: Rails (3.2) Rspec (2.14.1) Database Cleaner (1.2.0) This is what my Rspec configuration looked like: RSpec.configure do |config| config.include Capybara::DSL config.before(:suite) do DatabaseCleaner.strategy =…
etagwerker
  • 523
  • 4
  • 15
1 2 3
9
10