diff options
author | Chris Schlaeger <chris@linux.com> | 2015-04-12 20:22:01 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2015-04-12 20:22:01 +0200 |
commit | a3bc76ca40be53a47e530ed91819e9b8483de7bb (patch) | |
tree | f4641cc5c8fc105f5e7ffda4b85f890acfee9961 /spec | |
parent | 51b6bae05765a3f012b0793588644387fda06a63 (diff) | |
download | postrunner-a3bc76ca40be53a47e530ed91819e9b8483de7bb.zip |
New: Adding a personal record view including yearly records.v0.0.7
Diffstat (limited to 'spec')
-rw-r--r-- | spec/View_spec.rb | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/View_spec.rb b/spec/View_spec.rb new file mode 100644 index 0000000..7a90a01 --- /dev/null +++ b/spec/View_spec.rb @@ -0,0 +1,61 @@ +#!/usr/bin/env ruby -w +# encoding: UTF-8 +# +# = View_spec.rb -- PostRunner - Manage the data from your Garmin sport devices. +# +# Copyright (c) 2015 by Chris Schlaeger <cs@taskjuggler.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# + +require 'postrunner/View' +require 'postrunner/ViewButtons' +require 'postrunner/PagingButtons' + +module PostRunner + + describe PostRunner::View do + + before(:all) do + @view_names = %w( activities record ) + delete_files + end + + after(:all) do + delete_files + end + + def delete_files + @view_names.each do |vn| + page_files(vn).each do |pf| + File.delete(pf) if File.exists?(pf) + end + end + end + + def page_files(vn) + 1.upto(vn == 'record' ? 5 : 3).map { |i| "#{vn}-page#{i}.html" } + end + + it 'should generate view files with multiple pages' do + views = ViewButtons.new( + @view_names.map{ |vn| NavButtonDef. + new("#{vn}.png", "#{vn}-page1.html") } + ) + @view_names.each do |vn| + views.current_page = vn + '-page1.html' + pages = PagingButtons.new(page_files(vn)) + page_files(vn).each do |file| + pages.current_page = file + PostRunner::View.new("Test File: #{file}", views, pages).body. + write(file) + File.exists?(file).should be true + end + end + end + + end + +end |