@@ -71,32 +71,34 @@ module ReactOnRails
7171 end
7272 end
7373
74- describe ".source_path_is_not_defined_and_custom_node_modules?" do
75- it "returns false if node_modules is blank" do
76- allow ( ReactOnRails ) . to receive_message_chain ( "configuration.node_modules_location" )
77- . and_return ( "" )
78- allow ( Webpacker ) . to receive_message_chain ( "config.send" ) . with ( :data )
79- . and_return ( { } )
80-
81- expect ( ReactOnRails ::Utils . source_path_is_not_defined_and_custom_node_modules? ) . to eq ( false )
82- end
74+ if ReactOnRails ::WebpackerUtils . using_webpacker?
75+ describe ".source_path_is_not_defined_and_custom_node_modules?" do
76+ it "returns false if node_modules is blank" do
77+ allow ( ReactOnRails ) . to receive_message_chain ( "configuration.node_modules_location" )
78+ . and_return ( "" )
79+ allow ( Webpacker ) . to receive_message_chain ( "config.send" ) . with ( :data )
80+ . and_return ( { } )
8381
84- it "returns false if source_path is defined in the config/webpacker.yml and node_modules defined" do
85- allow ( ReactOnRails ) . to receive_message_chain ( "configuration.node_modules_location" )
86- . and_return ( "client" )
87- allow ( Webpacker ) . to receive_message_chain ( "config.send" ) . with ( :data )
88- . and_return ( source_path : "client/app" )
82+ expect ( ReactOnRails ::Utils . using_webpacker_source_path_is_not_defined_and_custom_node_modules? ) . to eq ( false )
83+ end
8984
90- expect ( ReactOnRails ::Utils . source_path_is_not_defined_and_custom_node_modules? ) . to eq ( false )
91- end
85+ it "returns false if source_path is defined in the config/webpacker.yml and node_modules defined" do
86+ allow ( ReactOnRails ) . to receive_message_chain ( "configuration.node_modules_location" )
87+ . and_return ( "client" )
88+ allow ( Webpacker ) . to receive_message_chain ( "config.send" ) . with ( :data )
89+ . and_return ( source_path : "client/app" )
9290
93- it "returns true if node_modules is not blank and the source_path is not defined in config/webpacker.yml" do
94- allow ( ReactOnRails ) . to receive_message_chain ( "configuration.node_modules_location" )
95- . and_return ( "node_modules" )
96- allow ( Webpacker ) . to receive_message_chain ( "config.send" ) . with ( :data )
97- . and_return ( { } )
91+ expect ( ReactOnRails ::Utils . using_webpacker_source_path_is_not_defined_and_custom_node_modules? ) . to eq ( false )
92+ end
93+
94+ it "returns true if node_modules is not blank and the source_path is not defined in config/webpacker.yml" do
95+ allow ( ReactOnRails ) . to receive_message_chain ( "configuration.node_modules_location" )
96+ . and_return ( "node_modules" )
97+ allow ( Webpacker ) . to receive_message_chain ( "config.send" ) . with ( :data )
98+ . and_return ( { } )
9899
99- expect ( ReactOnRails ::Utils . source_path_is_not_defined_and_custom_node_modules? ) . to eq ( true )
100+ expect ( ReactOnRails ::Utils . using_webpacker_source_path_is_not_defined_and_custom_node_modules? ) . to eq ( true )
101+ end
100102 end
101103 end
102104
0 commit comments