Skip to content

Commit 4529298

Browse files
committed
fix specs
1 parent cf8257d commit 4529298

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

spec/approvals/cli/generate/wrap-script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# This script was generated by bashly ... (https://bashly.dannyb.co)
33
# Modifying it manually is not recommended
44

5-
# :script.wrapper
5+
# :wrapper.wrapper
66
function() {
7+
# :command.master_script
78

89
# :command.version_command
910
version_command() {
1011
echo "$version"
11-
}

spec/approvals/script/wrapper/code

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# This script was generated by bashly ... (https://bashly.dannyb.co)
33
# Modifying it manually is not recommended
44

5-
# :script.bash3_bouncer
5+
# :wrapper.bash3_bouncer
66
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
77
printf "bash version 4 or higher is required\n"
88
exit 1
99
fi
1010

11+
# :command.master_script
1112
# :command.root_command
1213
root_command() {
13-
# :spec/tmp/src/root_command.sh
14+
# spec/tmp/src/root_command.sh

spec/approvals/script/wrapper/code-wrapped

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
# This script was generated by bashly ... (https://bashly.dannyb.co)
33
# Modifying it manually is not recommended
44

5-
# :script.wrapper
5+
# :wrapper.wrapper
66
my_super_function() {
7+
# :command.master_script
78
# :command.root_command
89
root_command() {
9-
# :spec/tmp/src/root_command.sh
10+
# spec/tmp/src/root_command.sh
1011
echo "error: cannot load file"
1112
}
1213

spec/bashly/script/command_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,12 @@
211211
end
212212

213213
it "returns the contents of a file in ./src along with a header " do
214-
expect(subject.load_user_file 'test.sh').to eq "# :spec/tmp/src/test.sh\nhello Command#load_user_file"
214+
expect(subject.load_user_file 'test.sh').to eq "# spec/tmp/src/test.sh\nhello Command#load_user_file"
215215
end
216216

217217
context "when the file is not found" do
218218
it "returns a string containing a friendly error message" do
219-
expect(subject.load_user_file 'notfound.sh').to eq "# :spec/tmp/src/notfound.sh\necho \"error: cannot load file\""
219+
expect(subject.load_user_file 'notfound.sh').to eq "# spec/tmp/src/notfound.sh\necho \"error: cannot load file\""
220220
end
221221
end
222222
end

spec/bashly/script/wrapper_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
context "without function name" do
1111
it "returns the complete script" do
1212
lines = subject.code.split "\n"
13-
expect(lines[0..12].join("\n")).to match_approval('script/wrapper/code').except(/\d+\.\d+\.\d+/)
13+
expect(lines[0..13].join("\n")).to match_approval('script/wrapper/code').except(/\d+\.\d+\.\d+/)
1414
expect(lines[-1]).to eq 'run "$@"'
1515
end
1616
end
@@ -20,7 +20,7 @@
2020

2121
it "returns the complete script wrapped in a function without a bash3 bouncer" do
2222
lines = subject.code.split "\n"
23-
expect(lines[0..12].join("\n")).to match_approval('script/wrapper/code-wrapped').except(/\d+\.\d+\.\d+/)
23+
expect(lines[0..13].join("\n")).to match_approval('script/wrapper/code-wrapped').except(/\d+\.\d+\.\d+/)
2424
expect(lines[-1]).to eq '(return 0 2>/dev/null) || my_super_function "$@"'
2525
end
2626
end
@@ -37,7 +37,8 @@
3737
it "uses the custom header instead of the factory one" do
3838
lines = subject.code.split "\n"
3939
expect(lines[0]).to eq header_text
40-
expect(lines[1]).to eq "# :command.root_command"
40+
expect(lines[1]).to eq "# :command.master_script"
41+
expect(lines[2]).to eq "# :command.root_command"
4142
end
4243
end
4344
end

0 commit comments

Comments
 (0)