|
111 | 111 | .to include(GeneratorMessages.format_info(expected))
|
112 | 112 | end
|
113 | 113 | end
|
| 114 | + |
| 115 | + context "detect existing bin-files on *nix" do |
| 116 | + before(:all) { @install_generator = InstallGenerator.new } |
| 117 | + |
| 118 | + specify "when node is exist" do |
| 119 | + stub_const("RUBY_PLATFORM", "linux") |
| 120 | + allow(@install_generator).to receive(:`).with("which node").and_return("/path/to/bin") |
| 121 | + expect(@install_generator.send(:missing_node?)).to eq false |
| 122 | + end |
| 123 | + |
| 124 | + specify "when npm is exist" do |
| 125 | + stub_const("RUBY_PLATFORM", "linux") |
| 126 | + allow(@install_generator).to receive(:`).with("which npm").and_return("/path/to/bin") |
| 127 | + expect(@install_generator.send(:missing_npm?)).to eq false |
| 128 | + end |
| 129 | + end |
| 130 | + |
| 131 | + context "detect missing bin-files on *nix" do |
| 132 | + before(:all) { @install_generator = InstallGenerator.new } |
| 133 | + |
| 134 | + specify "when node is missing" do |
| 135 | + stub_const("RUBY_PLATFORM", "linux") |
| 136 | + allow(@install_generator).to receive(:`).with("which node").and_return("") |
| 137 | + expect(@install_generator.send(:missing_node?)).to eq true |
| 138 | + end |
| 139 | + |
| 140 | + specify "when npm is missing" do |
| 141 | + stub_const("RUBY_PLATFORM", "linux") |
| 142 | + allow(@install_generator).to receive(:`).with("which npm").and_return("") |
| 143 | + expect(@install_generator.send(:missing_npm?)).to eq true |
| 144 | + end |
| 145 | + end |
| 146 | + |
| 147 | + context "detect existing bin-files on windows" do |
| 148 | + before(:all) { @install_generator = InstallGenerator.new } |
| 149 | + |
| 150 | + specify "when node is exist" do |
| 151 | + stub_const("RUBY_PLATFORM", "mswin") |
| 152 | + allow(@install_generator).to receive(:`).with("where node").and_return("/path/to/bin") |
| 153 | + expect(@install_generator.send(:missing_node?)).to eq false |
| 154 | + end |
| 155 | + |
| 156 | + specify "when npm is exist" do |
| 157 | + stub_const("RUBY_PLATFORM", "mswin") |
| 158 | + allow(@install_generator).to receive(:`).with("where npm").and_return("/path/to/bin") |
| 159 | + expect(@install_generator.send(:missing_npm?)).to eq false |
| 160 | + end |
| 161 | + end |
| 162 | + |
| 163 | + context "detect missing bin-files on windows" do |
| 164 | + before(:all) { @install_generator = InstallGenerator.new } |
| 165 | + |
| 166 | + specify "when node is missing" do |
| 167 | + stub_const("RUBY_PLATFORM", "mswin") |
| 168 | + allow(@install_generator).to receive(:`).with("where node").and_return("") |
| 169 | + expect(@install_generator.send(:missing_node?)).to eq true |
| 170 | + end |
| 171 | + |
| 172 | + specify "when npm is missing" do |
| 173 | + stub_const("RUBY_PLATFORM", "mswin") |
| 174 | + allow(@install_generator).to receive(:`).with("where npm").and_return("") |
| 175 | + expect(@install_generator.send(:missing_npm?)).to eq true |
| 176 | + end |
| 177 | + end |
114 | 178 | end
|
0 commit comments