File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ def invoke!
59
59
if File . exist? ( destination )
60
60
replace! ( /#{ flag } / , content , config [ :force ] )
61
61
else
62
- raise MalformattedArgumentError , "The file #{ destination } does not appear to exist"
62
+ raise Thor :: Error , "The file #{ destination } does not appear to exist"
63
63
end
64
64
end
65
65
Original file line number Diff line number Diff line change @@ -71,18 +71,19 @@ def file
71
71
end
72
72
73
73
it "does not attempt to change the file if it doesn't exist" do
74
- expect_any_instance_of ( Thor ::Actions ::InjectIntoFile ) . not_to receive ( :replace! )
75
74
invoker . inject_into_file "idontexist" , :before => "something" do
76
75
"any content"
77
76
end rescue nil
77
+
78
+ expect ( File . exist? ( "idontexist" ) ) . to be_falsey
78
79
end
79
80
80
- it "raises a malformatted argument error including filename if file doesn't exist" do
81
+ it "raises a Thor error including filename if file doesn't exist" do
81
82
expect do
82
- invoker . inject_into_file "idontexist" , :before => "something" do
83
+ invoke! "idontexist" , :before => "something" do
83
84
"any content"
84
85
end
85
- end . to raise_error ( Thor ::MalformattedArgumentError , /does not appear to exist/ )
86
+ end . to raise_error ( Thor ::Error , /does not appear to exist/ )
86
87
end
87
88
88
89
it "does change the file if already includes content and :force is true" do
You can’t perform that action at this time.
0 commit comments