From ecc575c7d90cdeb416826fb5ec94ce14060a273e Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 18 Jul 2015 07:49:45 -0500 Subject: [PATCH] * fixnig download spec --- web/spec/features/download_spec.rb | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/web/spec/features/download_spec.rb b/web/spec/features/download_spec.rb index 2e7528674..e2ce0be25 100644 --- a/web/spec/features/download_spec.rb +++ b/web/spec/features/download_spec.rb @@ -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