miga-base 0.6.0.0 → 0.6.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
- require "test_helper"
2
- require "miga/tax_index"
1
+ require 'test_helper'
2
+ require 'miga/tax_index'
3
3
 
4
4
  class TaxIndexTest < Test::Unit::TestCase
5
-
5
+
6
6
  def test_initialization
7
7
  ti = MiGA::TaxIndex.new
8
8
  assert_equal(:root, ti.root.rank)
@@ -10,19 +10,19 @@ class TaxIndexTest < Test::Unit::TestCase
10
10
 
11
11
  def test_dataset
12
12
  $tmp = Dir.mktmpdir
13
- ENV["MIGA_HOME"] = $tmp
14
- FileUtils.touch("#{ENV["MIGA_HOME"]}/.miga_rc")
15
- FileUtils.touch("#{ENV["MIGA_HOME"]}/.miga_daemon.json")
16
- p = MiGA::Project.new(File.expand_path("project1", $tmp))
17
- d = p.add_dataset("dataset1")
18
-
13
+ ENV['MIGA_HOME'] = $tmp
14
+ FileUtils.touch(File.expand_path('.miga_rc', ENV["MIGA_HOME"]))
15
+ FileUtils.touch(File.expand_path('.miga_daemon.json', ENV["MIGA_HOME"]))
16
+ p = MiGA::Project.new(File.expand_path('project1', $tmp))
17
+ d = p.add_dataset('dataset1')
18
+
19
19
  ti = MiGA::TaxIndex.new
20
20
  assert(ti.datasets.empty?)
21
21
  ti << d
22
- assert(ti.datasets.empty?, "Index should ignore datasets without tax.")
23
- d.metadata[:tax] = MiGA::Taxonomy.new("k:Fantasia g:Unicornia")
22
+ assert(ti.datasets.empty?, 'Index should ignore datasets without tax.')
23
+ d.metadata[:tax] = MiGA::Taxonomy.new('k:Fantasia g:Unicornia')
24
24
  ti << d
25
- assert_equal(1, ti.datasets.size, "Index should have one dataset.")
25
+ assert_equal(1, ti.datasets.size, 'Index should have one dataset.')
26
26
  assert_equal(1, ti.root.datasets_count)
27
27
  ensure
28
28
  FileUtils.rm_rf $tmp
@@ -31,9 +31,9 @@ class TaxIndexTest < Test::Unit::TestCase
31
31
 
32
32
  def test_to_json
33
33
  js = JSON.parse(MiGA::TaxIndex.new.to_json)
34
- assert(js.keys.include? "datasets")
34
+ assert(js.keys.include? 'datasets')
35
35
  assert_equal(2, js.keys.size)
36
- assert(js["datasets"].empty?)
36
+ assert(js['datasets'].empty?)
37
37
  end
38
38
 
39
39
  def test_to_tab
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
  require 'miga/taxonomy'
3
3
 
4
4
  class TaxonomyTest < Test::Unit::TestCase
5
-
5
+
6
6
  def test_ranks
7
7
  assert_respond_to(MiGA::Taxonomy, :KNOWN_RANKS)
8
8
  assert(MiGA::Taxonomy.KNOWN_RANKS.include? :s)
@@ -26,21 +26,22 @@ class TaxonomyTest < Test::Unit::TestCase
26
26
  assert_equal(txt, tx.to_s)
27
27
  assert_equal(
28
28
  [[:k, 'Fantasia'],[:f, 'Dragonaceae'],[:s, 'Dragonia azura']],
29
- tx.sorted_ranks)
29
+ tx.sorted_ranks
30
+ )
30
31
  assert_equal('Irrealis', tx.namespace)
31
32
  end
32
33
 
33
34
  def test_append
34
35
  tx = MiGA::Taxonomy.new ''
35
- assert_equal("", "#{tx}")
36
- tx << ["domain:Public","family:GNU"]
37
- assert_equal("GNU", tx[:f])
38
- tx << "class:ShareAlike"
39
- assert_equal("ShareAlike", tx[:c])
40
- tx << { :genus => "v3" }
41
- assert_equal("v3", tx[:g])
42
- tx << "s:v3_0"
43
- assert(tx.in? MiGA::Taxonomy.new("species:v3_0"))
36
+ assert_equal('', "#{tx}")
37
+ tx << ['domain:Public', 'family:GNU']
38
+ assert_equal('GNU', tx[:f])
39
+ tx << 'class:ShareAlike'
40
+ assert_equal('ShareAlike', tx[:c])
41
+ tx << { genus: 'v3' }
42
+ assert_equal('v3', tx[:g])
43
+ tx << 's:v3_0'
44
+ assert(tx.in? MiGA::Taxonomy.new('species:v3_0'))
44
45
  assert_raise(RuntimeError) { tx << 123 }
45
46
  end
46
47
 
data/test/test_helper.rb CHANGED
@@ -1,16 +1,16 @@
1
- require "simplecov"
1
+ require 'simplecov'
2
2
  SimpleCov.start
3
3
 
4
- require "rubygems"
5
- require "test/unit"
6
- require "miga/common"
7
- require "stringio"
4
+ require 'rubygems'
5
+ require 'test/unit'
6
+ require 'miga/common'
7
+ require 'stringio'
8
8
 
9
9
  ##
10
10
  # Kernel extensions tp capture +$stdout+ and +$stderr+ based on
11
11
  # http://thinkingdigitally.com/archive/capturing-output-from-puts-in-ruby/
12
12
  module Kernel
13
-
13
+
14
14
  def capture_stdout
15
15
  out = StringIO.new
16
16
  $stdout = out
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.0
4
+ version: 0.6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-07 00:00:00.000000000 Z
11
+ date: 2020-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons
@@ -101,6 +101,7 @@ files:
101
101
  - lib/miga/cli/action/about.rb
102
102
  - lib/miga/cli/action/add.rb
103
103
  - lib/miga/cli/action/add_result.rb
104
+ - lib/miga/cli/action/archive.rb
104
105
  - lib/miga/cli/action/classify_wf.rb
105
106
  - lib/miga/cli/action/console.rb
106
107
  - lib/miga/cli/action/daemon.rb
@@ -197,6 +198,7 @@ files:
197
198
  - test/metadata_test.rb
198
199
  - test/project_test.rb
199
200
  - test/remote_dataset_test.rb
201
+ - test/result_test.rb
200
202
  - test/tax_index_test.rb
201
203
  - test/taxonomy_test.rb
202
204
  - test/test_helper.rb