Permalink
Browse files

Use rspec-mocks instead of opening up the SauceTV::API class

  • Loading branch information...
rtyler committed Aug 5, 2012
1 parent 8bf206b commit b2adeffa18f9988e52470de256214136bb008737
Showing with 5 additions and 7 deletions.
  1. +3 −0 features/step_definitions/watch_steps.rb
  2. +1 −0 features/support/env.rb
  3. +0 −7 features/support/mock_api.rb
  4. +1 −0 features/watch.feature
@@ -5,6 +5,9 @@
has_valid_credentials?
end
+Given /^I have recent jobs$/ do
+ SauceTV::API.any_instance.stub(:recent_jobs).and_return([{:id => 'test'}])
+end
When /^I try to watch videos$/ do
visit '/watch'
View
@@ -1,6 +1,7 @@
require 'capybara'
require 'capybara/cucumber'
require 'rack/test'
+require 'cucumber/rspec/doubles'
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../../lib')
@@ -1,7 +0,0 @@
-module SauceTV
- class API
- def recent_jobs
- [{:id => 'test'}]
- end
- end
-end
View
@@ -12,6 +12,7 @@ Feature: Watch recorded job runs
Scenario: Authenticated user
Given I have a valid Sauce Labs username and API key
+ And I have recent jobs
When I try to watch videos
And I enter my credentials
Then I should be given a list of jobs

0 comments on commit b2adeff

Please sign in to comment.