You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
oh-my-fish/plugins/tiny/spec/tiny.spec.fish

44 lines
1.1 KiB
Fish

import plugins/fish-spec
import plugins/tiny
function describe_tiny -d "tiny (git.io ULR shortener)"
function it_generates_a_short_url
expect (tiny -u facebook -r react | cut -d/ -f3) --to-equal git.io
end
function it_prints_usage_if_there_is_no_input
expect (tiny | grep USAGE) --to-equal " USAGE"
end
function it_returns_1_if_gitio_fails
tiny https://notgithub.com/bad/url
expect $status --to-equal 1
end
function it_returns_2_if_there_is_an_invalid_option
set -l ignore_output (tiny --wrong-option)
expect $status --to-equal 2
end
function it_returns_2_if_there_is_no_user_or_repo_specified
set -l ignore_output (tiny)
expect $status --to-equal 2
end
function it_prints_usage_if_there_is_an_invalid_option
expect (tiny -x | grep USAGE) --to-equal " USAGE"
end
function it_prints_help_if_no_global_user_is_configured
set github_user_copy (git config --local github.user)
git config --local github.user ""
expect (tiny --repo whos-repo | head -c7) --to-equal "Specify"
expect $status --to-equal 2
git config --local github.user "$github_user_copy"
end
end
spec.run $argv