Set new user and test server.

This commit is contained in:
Steven Miers 2014-10-30 19:05:06 -05:00
parent d7f6d089d8
commit cc0d33e6da
1 changed files with 16 additions and 12 deletions

View File

@ -1,27 +1,30 @@
require 'spec_helper'
require 'youtube_client'
describe "YouTube", :js=>true, :type => :feature, :capybara_feature => true, :slow=>true do
describe "YouTube", :js=>true, :type => :feature, :capybara_feature => true do
subject { page }
before(:all) do
Capybara.run_server = false
Capybara.javascript_driver = :poltergeist
Capybara.current_driver = Capybara.javascript_driver
Capybara.default_wait_time = 10
@previous_run_server = Capybara.run_server
Capybara.run_server = false
#Capybara.ignore_hidden_elements = false
@user=FactoryGirl.create(:user, :email => "steven@jamkazam.com")
@user=FactoryGirl.create(:user, :email => "jamkazamtest@gmail.com")
@youtube_client = YouTubeClient.new()
# authorize_google_user(@youtube_client, @user, "jam_2112")
# google_auth = UserAuthorization.google_auth(@user).first # Consider returning this from above now that it is reliable
authorize_google_user(@youtube_client, @user, "stinkyblueberryjam")
google_auth = UserAuthorization.google_auth(@user).first # Consider returning this from above now that it is reliable
end
after(:all) do
@user.destroy
@youtube_client.shutdown
Capybara.run_server = @previous_run_server
end
before(:each) do
@ -33,9 +36,9 @@ describe "YouTube", :js=>true, :type => :feature, :capybara_feature => true, :sl
end
it "should retrieve upload url" do
pending "finish this"
pending "fix this"
length = 3276
upload_hash=@youtube_client.upload_sign(@user, "testvideo.mp4", length)
upload_hash=@youtube_client.upload_sign(@user, "test_video.mp4", length)
upload_hash.should_not be_nil
upload_hash.length.should gte(1)
upload_hash['method'].should eq("PUT")
@ -47,10 +50,11 @@ describe "YouTube", :js=>true, :type => :feature, :capybara_feature => true, :sl
end
it "upload url should allow uploading" do
pending "finish this"
vid_path = Rails.root.join('spec', 'files', 'testvideo.mp4')
pending "fix this"
vid_path = Rails.root.join('spec', 'files', 'test_video.mp4')
length = File.size?(vid_path)
upload_hash=@youtube_client.upload_sign(@user, "testvideo.mp4", length)
upload_hash=@youtube_client.upload_sign(@user, "test_video.mp4", length)
puts upload_hash.inspect
upload_hash.should_not be_nil
upload_hash.length.should gte(1)
upload_hash['method'].should eq("PUT")