Skip to content

Commit

Permalink
More precise tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Dec 4, 2011
1 parent 8fb5dcf commit 510873e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
8 changes: 7 additions & 1 deletion bin/t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ require 't'

begin
T::CLI.start(ARGV)
rescue Twitter::Error::Unauthorized => error
$stderr.puts error.message
$stderr.puts
$stderr.puts "Run `#{$0} authorize --consumer-key=CONSUMER-KEY --consumer-secret=CONSUMER-SECRET` to authorize."
exit 1
rescue Interrupt
puts "Quitting..."
$stderr.puts "Quitting..."
exit 1
end
3 changes: 2 additions & 1 deletion features/accounts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ Feature: An user can list his or her accounts

Scenario: List accounts
When I list my accounts using an authorized profile
Then the stdout should contain:
Then the stdout should contain exactly:
"""
testcli
MYCm5oNXkmaAPachb5HBhw (default)
"""
And the exit status should be 0
2 changes: 0 additions & 2 deletions features/authorize.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Feature: An user can authorize his or her account

Scenario: Authorize account
When I authorize my account
And I type ""
Then the stdout should contain:
"""
In a moment, your web browser will open to the Twitter app authorization page.
Expand All @@ -14,5 +13,4 @@ Feature: An user can authorize his or her account
Press [Enter] to open the Twitter app authorization page.
"""
And the stdout should contain "https://api.twitter.com/oauth/authorize"
And the exit status should be 0
5 changes: 4 additions & 1 deletion features/step_definitions/authorize_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
rcfile = RCFile.instance
rcfile.path = File.expand_path('../../fixtures/.trc', __FILE__)
profile = rcfile["testcli"]["MYCm5oNXkmaAPachb5HBhw"]
steps "When I run `t authorize --consumer-key #{profile["consumer_key"]} --consumer_secret #{profile["consumer_secret"]} --dry-run` interactively"
steps %{
When I run `t authorize --consumer-key #{profile["consumer_key"]} --consumer_secret #{profile["consumer_secret"]} --dry-run` interactively
And I type ""
}
end

0 comments on commit 510873e

Please sign in to comment.