about summary refs log tree commit diff
path: root/pkgs/development/ruby-modules/with-packages/test.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ruby-modules/with-packages/test.nix')
-rw-r--r--pkgs/development/ruby-modules/with-packages/test.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/pkgs/development/ruby-modules/with-packages/test.nix b/pkgs/development/ruby-modules/with-packages/test.nix
index ca2934b6f61c9..be652747c4699 100644
--- a/pkgs/development/ruby-modules/with-packages/test.nix
+++ b/pkgs/development/ruby-modules/with-packages/test.nix
@@ -15,6 +15,22 @@ let
       pkgs.ruby.gems) //
     (import ./require_exceptions.nix);
 
+  testWrapper = ruby: stdenv.mkDerivation {
+    name = "test-wrappedRuby-${ruby.name}";
+    buildInputs = [ ((ruby.withPackages (ps: [ ])).wrappedRuby) ];
+    buildCommand = ''
+      cat <<'EOF' > test-ruby
+      #!/usr/bin/env ruby
+      puts RUBY_VERSION
+      EOF
+
+      chmod +x test-ruby
+      patchShebangs test-ruby
+      [[ $(./test-ruby) = $(${ruby}/bin/ruby test-ruby) ]]
+      touch $out
+    '';
+  };
+
   tests = ruby:
     lib.mapAttrs (name: gem:
       let
@@ -39,7 +55,7 @@ let
 in
   stdenv.mkDerivation {
     name = "test-all-ruby-gems";
-    buildInputs = builtins.foldl' (sum: ruby: sum ++ ( builtins.attrValues (tests ruby) )) [] rubyVersions;
+    buildInputs = builtins.foldl' (sum: ruby: sum ++ [ (testWrapper ruby) ] ++ ( builtins.attrValues (tests ruby) )) [] rubyVersions;
     buildCommand = ''
       touch $out
     '';