Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Sorry for the stupid question #263

Open
VictorYspb opened this issue Feb 9, 2019 · 1 comment
Open

Sorry for the stupid question #263

VictorYspb opened this issue Feb 9, 2019 · 1 comment

Comments

@VictorYspb
Copy link

I am just started to learn the Docker technology. Using book "Docker on Amazon Web Services" by Justin Menga.
There is an example using the acceptance.bats file with the script

setup() {
url=${APP_URL:-localhost:8000}
item='{"title": "Wash the car", "order": 1}'
location='Location: ([^[:space:]]*)'
curl -X DELETE $url/todos
}
...
@test "create todo item" {
run curl -i -X POST -H "Content-Type: application/json" $url/todos -d "$item"
[ $status = 0 ]
[[ $output =~ "201 Created" ]] || false
[[ $output =~ $location ]] || false
[ $(curl ${BASH_REMATCH[1]} | jq '.title') = $(echo "$item" | jq '.title') ] <------- this gives the error
}

While run I get error message
acceptance_1 | # (in test file acceptance.bats, line 26)
acceptance_1 | # `[ $(curl ${BASH_REMATCH[1]} | jq '.title') = $"Wash the car" ]' failed with status 2
acceptance_1 | # % Total % Received % Xferd Average Speed Time Time Time Current
acceptance_1 | # Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
acceptance_1 | # % Total % Received % Xferd Average Speed Time Time Time Current
acceptance_1 | # Dload Upload Total Spent Left Speed
100 84 100 84 0 0 2470 0 --:--:-- --:--:-- --:--:-- 2470
acceptance_1 | # /tmp/bats.1.src: line 26: [: too many arguments

Other tests run OK.
Can someone help to understand what is the bug in the script?
I am using Mac OSx
Thanks in advance

@Potherca
Copy link

You might have more luck getting an answer if you ask your question on StackOverflow.

(And close your issue here)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants