Permalink
Browse files

Add a scenario outlining what should happen if you log in without val…

…id credentials
  • Loading branch information...
1 parent 75032ec commit 6a0679b393e1024e8846a88cc1c396f2cef9f1d9 @rtyler committed Aug 5, 2012
@@ -5,6 +5,13 @@
has_valid_credentials?
end
+Given /^I have an invalid Sauce Labs username or API key$/ do
+ invalidate!
+ SauceTV::API.any_instance.stub(:recent_jobs) do
+ raise SauceTV::InvalidUserCredentials
+ end
+end
+
Given /^I have recent jobs$/ do
SauceTV::API.any_instance.stub(:recent_jobs).and_return([{:id => 'test'}])
end
@@ -28,3 +35,6 @@
page.should have_content 'Please log in with your username and API key'
end
+Then /^I should be told my credentials are invalid$/ do
+ pending # express the regexp above with the code you wish you had
+end
@@ -9,6 +9,10 @@ def has_valid_credentials?
@credentials = YAML.load_file(filepath)
end
+ def invalidate!
+ @credentials = {}
+ end
+
def username
@credentials['username'] || 'anonymous'
end
View
@@ -7,5 +7,6 @@
require 'saucetv/app'
require 'saucetv/api'
+require 'saucetv/errors'
Capybara.app = SauceTV::Application
View
@@ -5,12 +5,19 @@ Feature: Watch recorded job runs
focused on the videos and test results
- Scenario: Unauthenticated user
+ Scenario: With no credentials
Given I am an unauthenticated user
When I try to watch videos
Then I should be prompted to log in with my username and API key
- Scenario: Authenticated user
+ @wip
+ Scenario: With invalid user credentials
+ Given I have an invalid Sauce Labs username or API key
+ When I try to watch videos
+ And I enter my credentials
+ Then I should be told my credentials are invalid
+
+ Scenario: With valid user credentials
Given I have a valid Sauce Labs username and API key
And I have recent jobs
When I try to watch videos
View
@@ -0,0 +1,4 @@
+
+module SauceTV
+ class InvalidUserCredentials < Exception; end
+end

0 comments on commit 6a0679b

Please sign in to comment.