* fixnig download spec

This commit is contained in:
Seth Call 2015-07-18 07:49:45 -05:00
parent 2a2ad4a378
commit ecc575c7d9
1 changed files with 15 additions and 9 deletions

View File

@ -2,7 +2,7 @@ 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
describe "Download", :js => true, :type => :feature, :capybara_feature => true do
subject { page }
@ -13,6 +13,7 @@ describe "User Progression", :js => true, :type => :feature, :capybara_feature
end
let(:user) { FactoryGirl.create(:user) }
let(:platforms) {[ 'Win32', 'MacOSX']}
describe "downloaded client" do
@ -21,6 +22,7 @@ describe "User Progression", :js => true, :type => :feature, :capybara_feature
FactoryGirl.create(:artifact_update, :product => 'JamClient/MacOSX')
end
describe "downloads-page" do
# there is also a generic download pages
@ -30,18 +32,22 @@ describe "User Progression", :js => true, :type => :feature, :capybara_feature
# put the user on Windows to start
detected_os = find("a.current-os-download")['data-platform']
if detected_os != "Win32"
find(".download-others a").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"
other_download = find(".download-others a")
other_download_platform = other_download['data-platform']
platforms.include?(other_download_platform).should be_true
platforms.delete(other_download_platform)
find(".download-others a").trigger(:click)
platform = find("a.current-os-download")['data-platform']
(platform == "Win32" || platform == "Linux").should be_true
remaining_platform = platforms[0]
other_download.trigger(:click)
find("a.current-os-download")['data-platform'].should == other_download_platform
find(".download-others a[data-platform='#{remaining_platform}']").trigger(:click)
find("a.current-os-download")['data-platform'].should == remaining_platform
end
end