File: platforms_test.rb

package info (click to toggle)
ruby-train 3.13.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,208 kB
  • sloc: ruby: 10,002; sh: 17; makefile: 8
file content (48 lines) | stat: -rw-r--r-- 1,536 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require "helper"

describe "platforms" do

  it "create platform" do
    Train::Platforms.list["mock"] = nil
    plat = Train::Platforms.name("mock")
    Train::Platforms.name("mock").in_family("test")
    Train::Platforms.name("mock").detect { true }
    _(plat.title).must_equal("Mock")
    _(plat.detect.call).must_equal(true)
    _(plat.families.keys[0].name).must_equal("test")
  end

  it "create family" do
    Train::Platforms.families["mock"] = nil
    fam = Train::Platforms.family("mock")
    Train::Platforms.family("mock").in_family("test")
    Train::Platforms.family("mock").detect { true }
    _(fam.title).must_equal("Mock Family")
    _(fam.detect.call).must_equal(true)
    _(fam.families.keys[0].name).must_equal("test")
  end

  it "return top platforms empty" do
    Train::Platforms.stubs(:list).returns({})
    Train::Platforms.stubs(:families).returns({})
    top = Train::Platforms.top_platforms
    _(top.count).must_equal(0)
  end

  it "return top platforms with data" do
    plat = Train::Platforms.name("linux")
    plat.stubs(:families).returns({})
    Train::Platforms.stubs(:list).returns({ "linux" => plat })
    Train::Platforms.stubs(:families).returns({})
    top = Train::Platforms.top_platforms
    _(top.count).must_equal(1)
  end

  it "return platforms export with data" do
    export = Train::Platforms.export
    _(export.size).must_be :>, 10
    _(export[0][:name]).must_equal "aix"
    expected_families = %w{aix unix os}
    _(export[0][:families]).must_equal expected_families
  end
end