File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,10 @@ def install
29
29
write_build_info_file
30
30
run_post_build_hooks
31
31
32
- generate_bin
32
+ SharedHelpers . filesystem_access ( bin_dir , :write ) do
33
+ generate_bin
34
+ end
35
+
33
36
generate_plugins
34
37
35
38
write_spec
Original file line number Diff line number Diff line change @@ -871,6 +871,36 @@ def run
871
871
end
872
872
end
873
873
874
+ describe "when bundle bin dir does not have write access" , :permissions do
875
+ let ( :bin_dir ) { bundled_app ( "vendor/#{ Bundler . ruby_scope } /bin" ) }
876
+
877
+ before do
878
+ FileUtils . mkdir_p ( bin_dir )
879
+ gemfile <<-G
880
+ source "#{ file_uri_for ( gem_repo1 ) } "
881
+ gem 'rack'
882
+ G
883
+ end
884
+
885
+ it "should display a proper message to explain the problem" do
886
+ FileUtils . chmod ( "-x" , bin_dir )
887
+ bundle "config set --local path vendor"
888
+
889
+ begin
890
+ bundle :install , raise_on_error : false
891
+ ensure
892
+ FileUtils . chmod ( "+x" , bin_dir )
893
+ end
894
+
895
+ expect ( err ) . not_to include ( "ERROR REPORT TEMPLATE" )
896
+
897
+ expect ( err ) . to include (
898
+ "There was an error while trying to write to `#{ bin_dir } `. " \
899
+ "It is likely that you need to grant write permissions for that path."
900
+ )
901
+ end
902
+ end
903
+
874
904
describe "when bundle extensions path does not have write access" , :permissions do
875
905
let ( :extensions_path ) { bundled_app ( "vendor/#{ Bundler . ruby_scope } /extensions/#{ Gem ::Platform . local } /#{ Gem . extension_api_version } " ) }
876
906
You can’t perform that action at this time.
0 commit comments