est 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.coveralls.yml +2 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +2 -0
- data/.rultor.yml +20 -0
- data/.simplecov +34 -0
- data/.travis.yml +12 -0
- data/Gemfile +25 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +71 -0
- data/assets/est.xsd +49 -0
- data/assets/est.xsl +67 -0
- data/bin/est +84 -0
- data/cucumber.yml +3 -0
- data/est.gemspec +59 -0
- data/features/cli.feature +51 -0
- data/features/gem_package.feature +22 -0
- data/features/step_definitions/steps.rb +110 -0
- data/features/support/env.rb +25 -0
- data/lib/est.rb +123 -0
- data/lib/est/estimate.rb +65 -0
- data/lib/est/estimates.rb +57 -0
- data/lib/est/methods/champions.rb +50 -0
- data/lib/est/version.rb +30 -0
- data/test/test__helper.rb +26 -0
- data/test/test_champions.rb +61 -0
- data/test/test_est.rb +92 -0
- data/test/test_estimate.rb +71 -0
- data/test/test_estimates.rb +68 -0
- metadata +263 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2014 TechnoPark Corp.
|
4
|
+
# Copyright (c) 2014 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'est/estimate'
|
25
|
+
require 'nokogiri'
|
26
|
+
require 'logger'
|
27
|
+
require 'time'
|
28
|
+
|
29
|
+
# Est main module.
|
30
|
+
# Author:: Yegor Bugayenko (yegor@teamed.io)
|
31
|
+
# Copyright:: Copyright (c) 2014 Yegor Bugayenko
|
32
|
+
# License:: MIT
|
33
|
+
module Est
|
34
|
+
# Estimates.
|
35
|
+
class Estimates
|
36
|
+
# Ctor.
|
37
|
+
# +dir+:: Directory with estimates
|
38
|
+
def initialize(dir)
|
39
|
+
@dir = dir
|
40
|
+
end
|
41
|
+
|
42
|
+
# Get total estimate.
|
43
|
+
def total
|
44
|
+
estimates = iterate
|
45
|
+
fail 'not enough estimates' if estimates.empty?
|
46
|
+
estimates.reduce(0) { |a, e| a + e.total } / estimates.size
|
47
|
+
end
|
48
|
+
|
49
|
+
# Iterate them all
|
50
|
+
def iterate
|
51
|
+
Dir.entries(@dir)
|
52
|
+
.reject { |f| f.index('.') == 0 }
|
53
|
+
.select { |f| f =~ /^.*\.est$/ }
|
54
|
+
.map { |f| Estimate.new(File.join(@dir, f)) }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2014 TechnoPark Corp.
|
4
|
+
# Copyright (c) 2014 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'est/version'
|
25
|
+
require 'logger'
|
26
|
+
require 'yaml'
|
27
|
+
|
28
|
+
# Single estimate.
|
29
|
+
# Author:: Yegor Bugayenko (yegor@teamed.io)
|
30
|
+
# Copyright:: Copyright (c) 2014 Yegor Bugayenko
|
31
|
+
# License:: MIT
|
32
|
+
module Est
|
33
|
+
# Scope Champions.
|
34
|
+
class Champions
|
35
|
+
# Ctor.
|
36
|
+
# +yaml+:: YAML config
|
37
|
+
def initialize(yaml)
|
38
|
+
@yaml = yaml
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get total estimate.
|
42
|
+
def total
|
43
|
+
reqs = @yaml['scope']
|
44
|
+
champs = @yaml['champions']
|
45
|
+
(champs.map do |_, e|
|
46
|
+
(e['best-case'].to_i + e['worst'].to_i + e['most-likely'].to_i * 4) / 6
|
47
|
+
end.reduce(&:+) * 0.54 * (reqs.size / champs.size)).to_i
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/est/version.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2014 TechnoPark Corp.
|
4
|
+
# Copyright (c) 2014 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
# Est main module.
|
25
|
+
# Author:: Yegor Bugayenko (yegor@teamed.io)
|
26
|
+
# Copyright:: Copyright (c) 2014 Yegor Bugayenko
|
27
|
+
# License:: MIT
|
28
|
+
module Est
|
29
|
+
VERSION = '0.1'
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2014 TechnoPark Corp.
|
4
|
+
# Copyright (c) 2014 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'simplecov'
|
25
|
+
require 'est'
|
26
|
+
require 'minitest/autorun'
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2014 TechnoPark Corp.
|
4
|
+
# Copyright (c) 2014 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'minitest/autorun'
|
25
|
+
require 'est/methods/champions'
|
26
|
+
require 'yaml'
|
27
|
+
|
28
|
+
# Est main module test.
|
29
|
+
# Author:: Yegor Bugayenko (yegor@teamed.io)
|
30
|
+
# Copyright:: Copyright (c) 2014 Yegor Bugayenko
|
31
|
+
# License:: MIT
|
32
|
+
class TestChampions < Minitest::Test
|
33
|
+
def test_basic_calculation
|
34
|
+
method = Est::Champions.new(
|
35
|
+
YAML.load(
|
36
|
+
'''
|
37
|
+
scope:
|
38
|
+
1: basic Sinatra scaffolding
|
39
|
+
2: front-end HAML files
|
40
|
+
3: SASS stylesheet
|
41
|
+
4: five model classes with unit tests
|
42
|
+
5: PostgreSQL migrations
|
43
|
+
6: Cucumber tests for PostgreSQL
|
44
|
+
7: Capybara tests for HTML front
|
45
|
+
8: CasperJS tests
|
46
|
+
9: achieve 80% test coverage
|
47
|
+
champions:
|
48
|
+
7:
|
49
|
+
worst-case: 40
|
50
|
+
best-case: 10
|
51
|
+
most-likely: 18
|
52
|
+
4:
|
53
|
+
worst-case: 30
|
54
|
+
best-case: 8
|
55
|
+
most-likely: 16
|
56
|
+
'''
|
57
|
+
)
|
58
|
+
)
|
59
|
+
assert_equal 54, method.total
|
60
|
+
end
|
61
|
+
end
|
data/test/test_est.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2014 TechnoPark Corp.
|
4
|
+
# Copyright (c) 2014 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'minitest/autorun'
|
25
|
+
require 'nokogiri'
|
26
|
+
require 'est'
|
27
|
+
require 'tmpdir'
|
28
|
+
require 'slop'
|
29
|
+
|
30
|
+
# Est main module test.
|
31
|
+
# Author:: Yegor Bugayenko (yegor@teamed.io)
|
32
|
+
# Copyright:: Copyright (c) 2014 Yegor Bugayenko
|
33
|
+
# License:: MIT
|
34
|
+
class TestEst < Minitest::Test
|
35
|
+
def test_basic
|
36
|
+
Dir.mktmpdir 'test' do |dir|
|
37
|
+
opts = opts(['-v', '-d', dir])
|
38
|
+
File.write(
|
39
|
+
File.join(dir, 'sample.est'),
|
40
|
+
'''
|
41
|
+
id: 5
|
42
|
+
date: 12-07-2014
|
43
|
+
author: Yegor Bugayenko
|
44
|
+
method: champions.pert
|
45
|
+
scope:
|
46
|
+
1: basic Sinatra scaffolding
|
47
|
+
2: front-end HAML files
|
48
|
+
3: SASS stylesheet
|
49
|
+
4: five model classes with unit tests
|
50
|
+
5: PostgreSQL migrations
|
51
|
+
6: Cucumber tests for PostgreSQL
|
52
|
+
7: Capybara tests for HTML front
|
53
|
+
8: CasperJS tests
|
54
|
+
9: achieve 80% test coverage
|
55
|
+
champions:
|
56
|
+
7:
|
57
|
+
worst-case: 40
|
58
|
+
best-case: 10
|
59
|
+
most-likely: 18
|
60
|
+
4:
|
61
|
+
worst-case: 30
|
62
|
+
best-case: 8
|
63
|
+
most-likely: 16
|
64
|
+
'''
|
65
|
+
)
|
66
|
+
matches(
|
67
|
+
Nokogiri::XML(Est::Base.new(opts).xml),
|
68
|
+
[
|
69
|
+
'/processing-instruction("xml-stylesheet")[contains(.,".xsl")]',
|
70
|
+
'/estimate/@version',
|
71
|
+
'/estimate/@date',
|
72
|
+
'/estimate[total="54"]',
|
73
|
+
'/estimate/ests[count(est)=1]',
|
74
|
+
'/estimate/ests/est[@id="5"]'
|
75
|
+
]
|
76
|
+
)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def opts(args)
|
81
|
+
Slop.parse args do
|
82
|
+
on 'v', 'verbose'
|
83
|
+
on 'd', 'dir', argument: :required
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def matches(xml, xpaths)
|
88
|
+
xpaths.each do |xpath|
|
89
|
+
fail "doesn't match '#{xpath}': #{xml}" unless xml.xpath(xpath).size == 1
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2014 TechnoPark Corp.
|
4
|
+
# Copyright (c) 2014 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'minitest/autorun'
|
25
|
+
require 'nokogiri'
|
26
|
+
require 'est/estimates'
|
27
|
+
require 'tmpdir'
|
28
|
+
require 'slop'
|
29
|
+
|
30
|
+
# Est main module test.
|
31
|
+
# Author:: Yegor Bugayenko (yegor@teamed.io)
|
32
|
+
# Copyright:: Copyright (c) 2014 Yegor Bugayenko
|
33
|
+
# License:: MIT
|
34
|
+
class TestEstimate < Minitest::Test
|
35
|
+
def test_basic_calculation
|
36
|
+
Dir.mktmpdir 'test' do |dir|
|
37
|
+
file = File.join(dir, 'first.est')
|
38
|
+
File.write(
|
39
|
+
file,
|
40
|
+
'''
|
41
|
+
date: 18-12-2014
|
42
|
+
author: Jeff Lebowski
|
43
|
+
method: champions.pert
|
44
|
+
scope:
|
45
|
+
1: basic Sinatra scaffolding
|
46
|
+
2: front-end HAML files
|
47
|
+
3: SASS stylesheet
|
48
|
+
4: five model classes with unit tests
|
49
|
+
5: PostgreSQL migrations
|
50
|
+
6: Cucumber tests for PostgreSQL
|
51
|
+
7: Capybara tests for HTML front
|
52
|
+
8: CasperJS tests
|
53
|
+
9: achieve 80% test coverage
|
54
|
+
champions:
|
55
|
+
7:
|
56
|
+
worst-case: 40
|
57
|
+
best-case: 10
|
58
|
+
most-likely: 18
|
59
|
+
4:
|
60
|
+
worst-case: 30
|
61
|
+
best-case: 8
|
62
|
+
most-likely: 16
|
63
|
+
'''
|
64
|
+
)
|
65
|
+
estimate = Est::Estimate.new(file)
|
66
|
+
assert_equal Date.parse('18-12-2014'), estimate.date
|
67
|
+
assert_equal 'Jeff Lebowski', estimate.author
|
68
|
+
assert_equal 54, estimate.total
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2014 TechnoPark Corp.
|
4
|
+
# Copyright (c) 2014 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'minitest/autorun'
|
25
|
+
require 'nokogiri'
|
26
|
+
require 'est/estimates'
|
27
|
+
require 'tmpdir'
|
28
|
+
require 'slop'
|
29
|
+
|
30
|
+
# Est main module test.
|
31
|
+
# Author:: Yegor Bugayenko (yegor@teamed.io)
|
32
|
+
# Copyright:: Copyright (c) 2014 Yegor Bugayenko
|
33
|
+
# License:: MIT
|
34
|
+
class TestEstimates < Minitest::Test
|
35
|
+
def test_basic_calculation
|
36
|
+
Dir.mktmpdir 'test' do |dir|
|
37
|
+
File.write(
|
38
|
+
File.join(dir, 'first.est'),
|
39
|
+
'''
|
40
|
+
date: 12-08-2014
|
41
|
+
author: Yegor Bugayenko
|
42
|
+
method: champions.pert
|
43
|
+
scope:
|
44
|
+
1: basic Sinatra scaffolding
|
45
|
+
2: front-end HAML files
|
46
|
+
3: SASS stylesheet
|
47
|
+
4: five model classes with unit tests
|
48
|
+
5: PostgreSQL migrations
|
49
|
+
6: Cucumber tests for PostgreSQL
|
50
|
+
7: Capybara tests for HTML front
|
51
|
+
8: CasperJS tests
|
52
|
+
9: achieve 80% test coverage
|
53
|
+
champions:
|
54
|
+
7:
|
55
|
+
worst-case: 40
|
56
|
+
best-case: 10
|
57
|
+
most-likely: 18
|
58
|
+
4:
|
59
|
+
worst-case: 30
|
60
|
+
best-case: 8
|
61
|
+
most-likely: 16
|
62
|
+
'''
|
63
|
+
)
|
64
|
+
estimates = Est::Estimates.new(dir)
|
65
|
+
assert_equal 54, estimates.total
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|