Sha256: 4c01d1c809cbdf1eb021c13f338ae6f7aa0489bc049a211d519428c1ecfd24d5

Contents?: true

Size: 944 Bytes

Versions: 5

Compression:

Stored size: 944 Bytes

Contents

require "test_helper"

module PushType
  class UnexposableTest < ActiveSupport::TestCase

    describe '.exposed' do
      let(:new_node!) { TestPage.create! FactoryGirl.attributes_for(:node) }
      it 'it should scope all exposed nodes' do
        PushType.stub :unexposed_nodes, [] do
          proc { new_node! }.must_change 'PushType::Node.exposed.count', 1
        end
      end
      it 'it should omit any unexposed nodes' do
        PushType.stub :unexposed_nodes, ['TestPage'] do
          proc { new_node! }.wont_change 'PushType::Node.exposed.count', 1 
        end
      end
    end

    describe 'exposed?' do
      describe 'when exposed' do
        it { TestPage.must_be :exposed? }
        it { TestPage.new.must_be :exposed? }
      end
      describe 'when unexposed' do
        before { TestPage.unexpose! }
        it { TestPage.wont_be :exposed? }
        it { TestPage.new.wont_be :exposed? }
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
push_type_core-0.3.3 test/models/concerns/push_type/unexposable_test.rb
push_type_core-0.3.1 test/models/concerns/push_type/unexposable_test.rb
push_type_core-0.2.1 test/models/concerns/push_type/unexposable_test.rb
push_type_core-0.2.0 test/models/concerns/push_type/unexposable_test.rb
push_type_core-0.2.0.beta2 test/models/concerns/push_type/unexposable_test.rb