Sha256: 38804dab4b5a5d0df6d24e62bb7ed2308d4357ed91475e49ba9a32f985fa2f4a

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

require "test_helper"

module PushType
  describe TagListQuery do

    before do
      Page.instance_variable_set '@fields', ActiveSupport::OrderedHash.new
      TestPage.instance_variable_set '@fields', ActiveSupport::OrderedHash.new
      Page.field :tags, :tag_list
      TestPage.field :tags, :tag_list
      Page.create FactoryGirl.attributes_for(:node, tags: ['foo', 'bar'])
      Page.create FactoryGirl.attributes_for(:node, tags: ['baz'])
      TestPage.create FactoryGirl.attributes_for(:node, tags: ['foo', 'bang'])
    end

    after do
      Page.instance_variable_set '@fields', ActiveSupport::OrderedHash.new
      TestPage.instance_variable_set '@fields', ActiveSupport::OrderedHash.new
    end

    let(:query) { TagListQuery.new('tags', 'page') }

    describe '.all' do
      it 'should return the subjects tags' do
        query.all.must_equal ['bar', 'baz', 'foo']
      end
      it 'should return all node types tags' do
        query.all(type: :all).must_equal ['bang', 'bar', 'baz', 'foo']
      end
      it 'should return TestPage tags' do
        query.all(type: :test_page).must_equal ['bang', 'foo']
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
push_type_core-0.5.0 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.5.0.alpha.5 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.5.0.alpha.4 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.5.0.alpha.3 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.5.0.alpha.2 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.5.0.alpha.1 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.4.0 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.4.0.beta.3 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.3.3 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.3.1 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.2.1 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.2.0 test/lib/push_type/tag_list_query_test.rb
push_type_core-0.2.0.beta2 test/lib/push_type/tag_list_query_test.rb