fix the liquid unit specs

did committed Mar 10, 2015
commit 76f137bce37f91e7dd006be97f46612ea5240438
Showing 4 changed files with 3 additions and 87 deletions
Rakefile +0 -1
@@ @@ -36,7 +36,6 @@ end
RSpec::Core::RakeTask.new('spec:unit') do |spec|
spec.pattern = 'spec/unit/**/*_spec.rb'
- # spec.pattern = 'spec/unit/{services,core_ext,middlewares,decorators,adapters,entities,models,repositories}/**/*_spec.rb'
end
task default: ['mongodb:test:seed', :spec]
spec/unit/liquid/tags/extends_spec.rb +2 -2
@@ @@ -6,8 +6,8 @@ describe Locomotive::Steam::Liquid::Tags::Extends do
let(:page) { instance_double('Page', title: 'About us') }
let(:site) { instance_double('Site', default_locale: :en) }
let(:listener) { Liquid::SimpleEventsListener.new }
- let(:finder) { Locomotive::Steam::Services::ParentFinder.new(instance_double('PageRepository', site: site, current_locale: :en)) }
- let(:parser) { Locomotive::Steam::Services::LiquidParser.new }
+ let(:finder) { Locomotive::Steam::ParentFinderService.new(instance_double('PageRepository', site: site, locale: :en)) }
+ let(:parser) { Locomotive::Steam::LiquidParserService.new }
let(:options) { { events_listener: listener, parent_finder: finder, page: page, parser: parser } }
before do
spec/unit/liquid/tags/inherited_block_spec.rb +1 -1
@@ @@ -9,7 +9,7 @@ describe Locomotive::Steam::Liquid::Tags::InheritedBlock do
let(:listener) { Liquid::SimpleEventsListener.new }
let(:finder) { instance_double('Finder', find: parent) }
- let(:options) { { page: page, events_listener: listener, parent_finder: finder, parser: Locomotive::Steam::Services::LiquidParser.new } }
+ let(:options) { { page: page, events_listener: listener, parent_finder: finder, parser: Locomotive::Steam::LiquidParserService.new } }
let!(:template) { parse_template(source, options) }
spec/unit/liquid/tags/paginate_spec.rb +0 -83
@@ @@ -128,87 +128,4 @@ EOF
end
end
-
- # it 'keeps the original GET parameters' do
- # context = liquid_context(fullpath: '/products?foo=1&bar=1&baz=1')
- # template = Liquid::Template.parse(default_template)
- # text = template.render!(context)
- # expect(text).to match /\/products\?foo=1&bar=1&baz=1&page=2/
- # end
-
- # it 'does not include twice the page parameter' do
- # context = liquid_context(fullpath: '/products?page=1')
- # template = Liquid::Template.parse(default_template)
- # text = template.render!(context)
- # expect(text).to match /\/products\?page=2/
- # end
-
- # # ___ helpers methods ___ #
-
- # def liquid_context(options = {})
- # ::Liquid::Context.new(
- # {},
- # {
- # 'projects' => options.has_key?(:collection) ? options[:collection] : PaginatedCollection.new(['Ruby on Rails', 'jQuery', 'mongodb', 'Liquid', 'sqlite3']),
- # 'current_page' => options[:page] || 1,
- # 'path' => '/',
- # 'fullpath' => options[:fullpath] || '/'
- # }, {
- # page: FactoryGirl.build(:page)
- # }, true)
- # end
-
- # def default_template
- # "{% paginate projects by 2 %}
- # {% for project in paginate.collection %}
- # !{{ project }}!
- # {% endfor %}
- # {{ paginate.next.url }}
- # {% endpaginate %}"
- # end
-
- # def default_pagination_template(options='')
- # "{% paginate projects by 2 #{options} %}
- # {% for project in paginate.collection %}
- # !{{ project }}!
- # {% endfor %}
- # {{ paginate.next.url }}
- # {{ paginate | default_pagination }}
- # {% endpaginate %}"
- # end
-
- # class PaginatedCollection
-
- # def initialize(collection)
- # @collection = collection || []
- # end
-
- # def paginate(options = {})
- # total_pages = (@collection.size.to_f / options[:per_page].to_f).to_f.ceil + 1
- # offset = (options[:page] - 1) * options[:per_page]
-
- # {
- # collection: @collection[offset..(offset + options[:per_page]) - 1],
- # current_page: options[:page],
- # previous_page: options[:page] == 1 ? 1 : options[:page] - 1,
- # next_page: options[:page] == total_pages ? total_pages : options[:page] + 1,
- # total_entries: @collection.size,
- # total_pages: total_pages,
- # per_page: options[:per_page]
- # }
- # end
-
- # def each(&block)
- # @collection.each(&block)
- # end
-
- # def method_missing(method, *args)
- # @collection.send(method, *args)
- # end
-
- # def to_liquid
- # self
- # end
- # end
-
end