spec added to confirm content_type Date problem & patch. Also 1.8.7 compatibility with syck init.
This commit is contained in:
parent
282e2486b6
commit
82a61b1d2d
@ -2,7 +2,7 @@ require 'rubygems'
|
|||||||
|
|
||||||
# Need to explicitly use syck for yaml
|
# Need to explicitly use syck for yaml
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
YAML::ENGINE.yamler = 'syck'
|
YAML::ENGINE.yamler = 'syck' if defined?(YAML::ENGINE)
|
||||||
|
|
||||||
# Set up gems listed in the Gemfile.
|
# Set up gems listed in the Gemfile.
|
||||||
if File.exist?(File.expand_path('../../Gemfile', __FILE__))
|
if File.exist?(File.expand_path('../../Gemfile', __FILE__))
|
||||||
|
@ -90,6 +90,20 @@ describe ContentType do
|
|||||||
@content_type.ordered_contents.collect(&:name).should == %w(Sacha Did)
|
@content_type.ordered_contents.collect(&:name).should == %w(Sacha Did)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'returns a list of contents ordered by a Date column when first instance is missing the value' do
|
||||||
|
@content_type = FactoryGirl.build(:content_type, :order_by => 'created_at')
|
||||||
|
@content_type.content_custom_fields.build :label => 'Active at', :name => 'active_at', :kind => 'Date'
|
||||||
|
e = Date.parse('01/01/2001')
|
||||||
|
l = Date.parse('02/02/2002')
|
||||||
|
[nil,e,l].each { |d| @content_type.contents << @content_type.content_klass.new(:active_at => d) }
|
||||||
|
@content_type.order_by = 'active_at'
|
||||||
|
@content_type.order_direction = 'asc'
|
||||||
|
lambda { @content_type.ordered_contents }.should_not raise_error(ArgumentError)
|
||||||
|
@content_type.ordered_contents.map(&:active_at).should == [nil,e,l]
|
||||||
|
@content_type.order_direction = 'desc'
|
||||||
|
@content_type.ordered_contents.map(&:active_at).should == [l,e,nil]
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'custom fields' do
|
describe 'custom fields' do
|
||||||
|
Loading…
Reference in New Issue
Block a user