Skip to content

Commit

Permalink
#141 tested
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Sep 26, 2024
1 parent fc25c6b commit 1061273
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 13 deletions.
46 changes: 46 additions & 0 deletions test/pages/test_eva_summary.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true

# MIT License
#
# Copyright (c) 2024 Zerocracy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

require 'minitest/autorun'
require_relative '../test__helper'

# Test.
# Author:: Yegor Bugayenko ([email protected])
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
# License:: MIT
class TestEvaSummary < Minitest::Test
def test_template
xml = xslt(
'<xsl:apply-templates select="/fb/f"/>',
'
<fb>
<f>
<what>earned-value</what>
</f>
</fb>
'
)
assert(xml.xpath('/p/text()').to_s.start_with?('Not enough data'), xml)
end
end
13 changes: 0 additions & 13 deletions xsl/vitals.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,4 @@ SOFTWARE.
</body>
</html>
</xsl:template>
<xsl:template match="f[what='earned-value']">
<xsl:text>AC: </xsl:text>
<xsl:value-of select="format-number(ac, '0')"/>
<xsl:text>, EV: </xsl:text>
<xsl:value-of select="format-number(ev, '0')"/>
<xsl:text>, PV: </xsl:text>
<xsl:value-of select="format-number(pv, '0')"/>
<xsl:text>, CPI: </xsl:text>
<xsl:copy-of select="z:index(ev div ac)"/>
<xsl:text>, SPI: </xsl:text>
<xsl:copy-of select="z:index(ev div pv)"/>
<xsl:text>.</xsl:text>
</xsl:template>
</xsl:stylesheet>

0 comments on commit 1061273

Please sign in to comment.