fix broken tests + get rid of warnings in cucumber

This commit is contained in:
dinedine 2010-10-29 17:40:58 +02:00
parent aa764ee185
commit 89f106405d
4 changed files with 12 additions and 6 deletions

View File

@ -12,7 +12,7 @@
= yield :head = yield :head
%body{ :class => @controller.controller_name } %body{ :class => controller.controller_name }
#wrapper #wrapper
#light.container #light.container
#panel.container #panel.container

View File

@ -37,7 +37,7 @@ module Locomotive
end end
def build_content_type(data) def build_content_type(data)
attributes = { :order_by => '_position_in_list', :group_by_field_name => data.delete('group_by') }.merge(data) attributes = { :group_by_field_name => data.delete('group_by') }.merge(data)
attributes.delete_if { |name, value| %w{fields contents}.include?(name) } attributes.delete_if { |name, value| %w{fields contents}.include?(name) }
@ -93,6 +93,8 @@ module Locomotive
end end
def set_order_by_value(content_type) def set_order_by_value(content_type)
self.log "order by #{content_type.order_by}"
order_by = (case content_type.order_by order_by = (case content_type.order_by
when 'manually', '_position_in_list' then '_position_in_list' when 'manually', '_position_in_list' then '_position_in_list'
when 'date', 'updated_at' then 'updated_at' when 'date', 'updated_at' then 'updated_at'
@ -100,6 +102,8 @@ module Locomotive
content_type.content_custom_fields.detect { |f| f._alias == content_type.order_by }._name rescue nil content_type.content_custom_fields.detect { |f| f._alias == content_type.order_by }._name rescue nil
end) end)
self.log "order by (after) #{order_by}"
content_type.order_by = order_by || '_position_in_list' content_type.order_by = order_by || '_position_in_list'
end end

View File

@ -45,12 +45,12 @@ describe Locomotive::Liquid::Filters::Html do
javascript_tag('/trash/main').should == result javascript_tag('/trash/main').should == result
end end
it 'should return an image tag without paramaters' do it 'should return an image tag without parameters' do
image_tag('foo.jpg').should == "<img src=\"/foo.jpg\" />" image_tag('foo.jpg').should == "<img src=\"foo.jpg\" />"
end end
it 'should return an image tag with size' do it 'should return an image tag with size' do
image_tag('foo.jpg', 'width:100', 'height:50').should == "<img src=\"/foo.jpg\" height=\"50\" width=\"100\" />" image_tag('foo.jpg', 'width:100', 'height:50').should == "<img src=\"foo.jpg\" height=\"50\" width=\"100\" />"
end end
it 'should return a flash tag without parameters' do it 'should return a flash tag without parameters' do

View File

@ -53,7 +53,9 @@ describe Locomotive::Liquid::Tags::Paginate do
{ {
'projects' => options.has_key?(:collection) ? options[:collection] : PaginatedCollection.new(['Ruby on Rails', 'jQuery', 'mongodb', 'Liquid', 'sqlite3']), 'projects' => options.has_key?(:collection) ? options[:collection] : PaginatedCollection.new(['Ruby on Rails', 'jQuery', 'mongodb', 'Liquid', 'sqlite3']),
'current_page' => options[:page] || 1 'current_page' => options[:page] || 1
}, {}, true) }, {
:page => Factory.build(:page)
}, true)
end end
def default_template def default_template