|
3 | 3 | require "react_on_rails/dev" |
4 | 4 |
|
5 | 5 | RSpec.describe "bin/dev script" do |
6 | | - let(:script_path) { "lib/generators/react_on_rails/bin/dev" } |
| 6 | + let(:script_path) { "lib/generators/react_on_rails/templates/base/base/bin/dev" } |
7 | 7 |
|
8 | 8 | # To suppress stdout during tests |
9 | 9 | original_stderr = $stderr |
@@ -40,36 +40,20 @@ def setup_script_execution_for_tool_tests |
40 | 40 | expect(script_content).to include("require \"react_on_rails/dev\"") |
41 | 41 | end |
42 | 42 |
|
43 | | - it "supports static development mode" do |
| 43 | + it "delegates to ServerManager command line interface" do |
44 | 44 | script_content = File.read(script_path) |
45 | | - expect(script_content).to include("ReactOnRails::Dev::ServerManager.start(:static") |
46 | | - end |
47 | | - |
48 | | - it "supports production-like mode" do |
49 | | - script_content = File.read(script_path) |
50 | | - expect(script_content).to include("ReactOnRails::Dev::ServerManager.start(:production_like") |
51 | | - end |
52 | | - |
53 | | - it "supports help command" do |
54 | | - script_content = File.read(script_path) |
55 | | - expect(script_content).to include('when "help", "--help", "-h"') |
56 | | - expect(script_content).to include("ReactOnRails::Dev::ServerManager.show_help") |
57 | | - end |
58 | | - |
59 | | - it "supports kill command" do |
60 | | - script_content = File.read(script_path) |
61 | | - expect(script_content).to include("ReactOnRails::Dev::ServerManager.kill_processes") |
| 45 | + expect(script_content).to include("ReactOnRails::Dev::ServerManager.run_from_command_line") |
62 | 46 | end |
63 | 47 |
|
64 | 48 | it "with ReactOnRails::Dev loaded, delegates to ServerManager" do |
65 | 49 | setup_script_execution_for_tool_tests |
66 | | - allow(ReactOnRails::Dev::ServerManager).to receive(:start) |
| 50 | + allow(ReactOnRails::Dev::ServerManager).to receive(:run_from_command_line) |
67 | 51 |
|
68 | 52 | # Mock the require to succeed |
69 | 53 | allow_any_instance_of(Kernel).to receive(:require).with("bundler/setup").and_return(true) |
70 | 54 | allow_any_instance_of(Kernel).to receive(:require).with("react_on_rails/dev").and_return(true) |
71 | 55 |
|
72 | | - expect(ReactOnRails::Dev::ServerManager).to receive(:start).with(:development, "Procfile.dev") |
| 56 | + expect(ReactOnRails::Dev::ServerManager).to receive(:run_from_command_line).with(ARGV) |
73 | 57 |
|
74 | 58 | load script_path |
75 | 59 | end |
|
0 commit comments