File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 59
59
expect ( result ) . to be false
60
60
end
61
61
end
62
+
63
+ context "when danger-gitlab is not installed" do
64
+ it "gracefully handles missing gitlab gem without raising LoadError" do
65
+ # danger is already required in spec_helper.rb so we have to launch a new process.
66
+ script = <<~RUBY
67
+ # Emulate the environment that does not have gitlab gem.
68
+ module Kernel
69
+ alias original_require require
70
+
71
+ def require(name)
72
+ raise LoadError, "cannot load such file -- gitlab" if name == "gitlab"
73
+
74
+ original_require(name)
75
+ end
76
+ end
77
+
78
+ require "danger"
79
+
80
+ Danger::Runner.run([])
81
+ RUBY
82
+ expect { system ( RbConfig . ruby , "-e" , script ) } . not_to output ( /LoadError/ ) . to_stderr_from_any_process
83
+ end
84
+ end
62
85
end
You can’t perform that action at this time.
0 commit comments