Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 ruby, 4 defaultGemConfig, 5 test, 6 should, 7}: 8let 9 testConfigs = { 10 inherit lib; 11 gemConfig = defaultGemConfig; 12 }; 13 functions = (import ./functions.nix testConfigs); 14in 15builtins.concatLists [ 16 (test.run "All set, no gemdir" 17 (functions.bundlerFiles { 18 gemfile = test/Gemfile; 19 lockfile = test/Gemfile.lock; 20 gemset = test/gemset.nix; 21 }) 22 { 23 gemfile = should.equal test/Gemfile; 24 lockfile = should.equal test/Gemfile.lock; 25 gemset = should.equal test/gemset.nix; 26 } 27 ) 28 29 (test.run "Just gemdir" 30 (functions.bundlerFiles { 31 gemdir = test/.; 32 }) 33 { 34 gemfile = should.equal test/Gemfile; 35 lockfile = should.equal test/Gemfile.lock; 36 gemset = should.equal test/gemset.nix; 37 } 38 ) 39 40 (test.run "Gemset and dir" 41 (functions.bundlerFiles { 42 gemdir = test/.; 43 gemset = test/extraGemset.nix; 44 }) 45 { 46 gemfile = should.equal test/Gemfile; 47 lockfile = should.equal test/Gemfile.lock; 48 gemset = should.equal test/extraGemset.nix; 49 } 50 ) 51 52 (test.run "Filter empty gemset" { } ( 53 set: 54 functions.filterGemset { 55 inherit ruby; 56 groups = [ "default" ]; 57 } set == { } 58 )) 59 ( 60 let 61 gemSet = { 62 test = { 63 groups = [ 64 "x" 65 "y" 66 ]; 67 }; 68 }; 69 in 70 test.run "Filter matches a group" gemSet ( 71 set: 72 functions.filterGemset { 73 inherit ruby; 74 groups = [ 75 "y" 76 "z" 77 ]; 78 } set == gemSet 79 ) 80 ) 81 ( 82 let 83 gemSet = { 84 test = { 85 platforms = [ ]; 86 }; 87 }; 88 in 89 test.run "Filter matches empty platforms list" gemSet ( 90 set: 91 functions.filterGemset { 92 inherit ruby; 93 groups = [ ]; 94 } set == gemSet 95 ) 96 ) 97 ( 98 let 99 gemSet = { 100 test = { 101 platforms = [ 102 { 103 engine = ruby.rubyEngine; 104 version = ruby.version.majMin; 105 } 106 ]; 107 }; 108 }; 109 in 110 test.run "Filter matches on platform" gemSet ( 111 set: 112 functions.filterGemset { 113 inherit ruby; 114 groups = [ ]; 115 } set == gemSet 116 ) 117 ) 118 ( 119 let 120 gemSet = { 121 test = { 122 groups = [ 123 "x" 124 "y" 125 ]; 126 }; 127 }; 128 in 129 test.run "Filter excludes based on groups" gemSet ( 130 set: 131 functions.filterGemset { 132 inherit ruby; 133 groups = [ 134 "a" 135 "b" 136 ]; 137 } set == { } 138 ) 139 ) 140]