File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ def uninstall!
7171 end
7272
7373 if current?
74- FileUtils . rm ( Evm :: EVM_EMACS_PATH )
74+ disuse!
7575 end
7676 end
7777
Original file line number Diff line number Diff line change 200200 @foo . uninstall!
201201 end
202202
203- it 'should remove binary symlink if current' do
204- expect ( FileUtils ) . to receive ( :rm ) . with ( Evm ::EVM_EMACS_PATH )
205-
203+ it 'should remove shims and unset current if current' do
206204 allow ( @foo ) . to receive ( :current? ) . and_return ( true )
205+ allow ( config ) . to receive ( :[] ) . with ( :path ) . and_return ( @foo . path )
206+ allow ( Evm ) . to receive ( :config ) . and_return ( config )
207+
208+ expect ( file_class ) . to receive ( :exists? ) . with ( Evm ::EMACS_PATH ) . and_return ( true )
209+ expect ( file_class ) . to receive ( :exists? ) . with ( Evm ::EVM_EMACS_PATH ) . and_return ( true )
210+ expect ( file_class ) . to receive ( :delete ) . with ( Evm ::EVM_EMACS_PATH )
211+ expect ( file_class ) . to receive ( :delete ) . with ( Evm ::EMACS_PATH )
212+ expect ( config ) . to receive ( :[]= ) . with ( :current , nil )
207213
208214 @foo . uninstall!
209215 end
210216
211- it 'should not remove binary symlink file if not current' do
212- expect ( FileUtils ) . not_to receive ( :rm ) . with ( Evm ::EVM_EMACS_PATH )
213-
217+ it 'should not remove shims or unset current if not current' do
214218 allow ( @foo ) . to receive ( :current? ) . and_return ( false )
219+ allow ( config ) . to receive ( :[] ) . with ( :path ) . and_return ( @foo . path )
220+ allow ( Evm ) . to receive ( :config ) . and_return ( config )
221+
222+ expect ( file_class ) . not_to receive ( :delete ) . with ( Evm ::EVM_EMACS_PATH )
223+ expect ( file_class ) . not_to receive ( :delete ) . with ( Evm ::EMACS_PATH )
224+ expect ( config ) . not_to receive ( :[]= )
215225
216226 @foo . uninstall!
217227 end
You can’t perform that action at this time.
0 commit comments