Skip to content

Instantly share code, notes, and snippets.

@derekkraan
Last active December 21, 2015 04:29

Revisions

  1. derekkraan revised this gist Aug 16, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,8 @@ def test_with_cleaner(example)
    $truncate = false
    end

    if example.metadata[:js].blank? DatabaseCleaner.start
    if example.metadata[:js].blank?
    DatabaseCleaner.start
    end

    example.run
  2. derekkraan created this gist Aug 16, 2013.
    18 changes: 18 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    def test_with_cleaner(example)
    if $truncate
    DatabaseCleaner.clean_with :truncation
    $truncate = false
    end

    if example.metadata[:js].blank? DatabaseCleaner.start
    end

    example.run
    ensure
    if example.metadata[:js]
    # queue truncation
    $truncate = true
    else
    DatabaseCleaner.clean
    end
    end