jam-cloud/web/spec/features/download_spec.rb

49 lines
1.4 KiB
Ruby

require 'spec_helper'
# these test will verify all of the user progression cases that rely on a javascript event (not bothering with instrumented models)
describe "User Progression", :js => true, :type => :feature, :capybara_feature => true do
subject { page }
before(:all) do
Capybara.javascript_driver = :poltergeist
Capybara.current_driver = Capybara.javascript_driver
Capybara.default_wait_time = 10
end
let(:user) { FactoryGirl.create(:user) }
describe "downloaded client" do
before(:each) do
FactoryGirl.create(:artifact_update, :product => 'JamClient/Win32')
FactoryGirl.create(:artifact_update, :product => 'JamClient/MacOSX')
end
describe "downloads-page" do
# there is also a generic download pages
before(:each) do
sign_in_poltergeist user
visit '/downloads'
# put the user on Windows to start
detected_os = find("a.current-os-download")['data-platform']
if detected_os != "Win32"
find(".download-others a[data-platform='Win32']").trigger(:click)
end
end
it "toggle active download" do
find(".download-others a[data-platform='MacOSX']").trigger(:click)
find("a.current-os-download")['data-platform'].should == "MacOSX"
find(".download-others a[data-platform='Win32']").trigger(:click)
find("a.current-os-download")['data-platform'].should == "Win32"
end
end
end
end