Sha256: c41053330cd788989f91c5424658323d38fdb754c6800c79139f43034e587071

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

class SandboxTest < ActiveSupport::TestCase

    context '#sandbox' do
        setup do
            @post = FactoryGirl.create :post
            @purchase = FactoryGirl.create :purchase
            $sandbox = true
            @book = FactoryGirl.create :book
            @receipt = FactoryGirl.create :receipt
        end

        context 'desandbox' do
            should 'return all records' do
                assert_equal Some.unscope(:joins, :where).all, Some.desandbox
            end
        end

        context '#live' do
            setup do
                $sandbox = false
            end

            should 'return all live records' do
                assert_equal Some.all, Some.live
            end
        end

        context '#sandboxed' do
            setup do
                $sandbox = true
            end

            should 'return all sandboxed records' do
                assert_equal Some.all, Some.sandboxed
            end
        end
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sandboxy-1.0.0 test/sandbox_test.rb