bats
bats copied to clipboard
Sorry for the stupid question
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
You might have more luck getting an answer if you ask your question on StackOverflow.
(And close your issue here)