Sha256: 8431f3cf2d933d8c313ca3dd42e67607d95f040c6231cd48cb3953bd443d168e

Contents?: true

Size: 1.99 KB

Versions: 14

Compression:

Stored size: 1.99 KB

Contents

require 'test_helper'

module PushType
  class PushTypeTest < ActiveSupport::TestCase

    describe '.version' do
      subject { PushType.version }
      it { subject.must_equal PushType::VERSION }
    end

    describe '.config' do
      subject { PushType.config }
      it { subject.must_respond_to :root_nodes }
      it { subject.must_respond_to :home_slug }
      it { subject.must_respond_to :unexposed_nodes }
      it { subject.must_respond_to :media_styles }
      it { subject.must_respond_to :mailer_sender }
      it { subject.must_respond_to :home_slug }
      it { subject.must_respond_to :dragonfly_datastore }
      it { subject.must_respond_to :dragonfly_datastore_options }
      it { subject.must_respond_to :dragonfly_secret }
    end

    describe '.root_nodes' do
      let(:config) { MiniTest::Mock.new }
      it 'should return all nodes by default' do
        config.expect :root_nodes, :all
        PushType.stub :config, config do
          PushType.root_nodes.size.must_be :>=, 2
        end
        assert config.verify
      end
    end

    describe '.unexposed_nodes' do
      let(:config) { MiniTest::Mock.new }
      it 'should return empty array by default' do
        config.expect :unexposed_nodes, []
        PushType.stub :config, config do
          PushType.unexposed_nodes.must_be_empty
        end
        assert config.verify
      end
    end

    describe '.subclasses_from_list' do
      subject { PushType.subclasses_from_list scope, list }
      describe 'scoped by :node' do
        let(:scope) { :node }
        describe 'searching for :all' do
          let(:list) { :all }
          it { subject.size.must_be :>=, 2 }
        end
        describe 'searching for single type' do
          let(:list) { :page }
          it { subject.must_equal ['page'] }
        end
        describe 'searching for array with nonexisting types' do
          let(:list) { [:page, :test_page, :foo, :bar] }
          it { subject.must_equal ['page', 'test_page'] }
        end
      end
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
push_type_core-0.9.5 test/lib/push_type/core_test.rb
push_type_core-0.9.3 test/lib/push_type/core_test.rb
push_type_core-0.9.2 test/lib/push_type/core_test.rb
push_type_core-0.9.1 test/lib/push_type/core_test.rb
push_type_core-0.9.0 test/lib/push_type/core_test.rb
push_type_core-0.9.0.beta.4 test/lib/push_type/core_test.rb
push_type_core-0.9.0.beta.3 test/lib/push_type/core_test.rb
push_type_core-0.9.0.beta.2 test/lib/push_type/core_test.rb
push_type_core-0.8.2 test/lib/push_type/core_test.rb
push_type_core-0.8.1 test/lib/push_type/core_test.rb
push_type_core-0.8.0 test/lib/push_type/core_test.rb
push_type_core-0.8.0.beta.3 test/lib/push_type/core_test.rb
push_type_core-0.8.0.beta.2 test/lib/push_type/core_test.rb
push_type_core-0.8.0.beta.1 test/lib/push_type/core_test.rb