fixes #67

Ivan Youroff committed May 30, 2013
commit cd2ec039045c119f187213acbd70f599637c923e
Showing 3 changed files with 7 additions and 0 deletions
locomotive/wagon/liquid/drops/content_types.rb b/lib/locomotive/wagon/liquid/drops/content_types.rb +1 -0
@@ @@ -34,6 +34,7 @@ module Locomotive
end
alias :length :size
+ alias :count :size
def each(&block)
self.collection.each(&block)
spec/fixtures/default/app/views/pages/songs/template.liquid.haml +1 -0
@@ @@ -12,5 +12,6 @@ content_type: songs
#is_templatized{templatized: "{{ page.templatized? }}"}
#content_type_size{content_type_size: "{{ page.content_type.size }}"}
+ #content_type_count{content_type_count: "{{ page.content_type.count }}"}
{% endblock %}
\ No newline at end of file
spec/integration/server/liquid_spec.rb +5 -0
@@ @@ -31,4 +31,9 @@ describe Locomotive::Wagon::Server do
get '/songs/song-1'
last_response.body.should =~ /content_type_size=.8./
end
+
+ it "provides count alias on collections" do
+ get '/songs/song-1'
+ last_response.body.should =~ /content_type_count=.8./
+ end
end
\ No newline at end of file