require 'spec_helper' describe 'Incloudr' do before :each do Dir.chdir("spec/blank") @cap = Capucine::Main.new @config_user_incloudr = File.expand_path File.join '..', 'capucine_incloudr.yaml' @config_user_incloudr2 = File.expand_path File.join '..', 'capucine_incloudr2.yaml' @config_user_incloudr3 = File.expand_path File.join '..', 'capucine_incloudr3.yaml' end after :each do Dir.chdir("../..") end it '#new, set incloudr, and download jquery from CDNJS' do @cap.run_command(['n']) Dir.chdir('capucine') @cap.run_command(['c', @config_user_incloudr]) jquery1 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.js') jquery2 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.min.js') File.exist?(jquery1).should eq(true) File.exist?(jquery2).should eq(true) FileUtils.rm_r @cap.settings.working_dir Dir.chdir('..') end it '#new, set incloudr, and download jquery version 1.7 from CDNJS' do @cap.run_command(['n']) Dir.chdir('capucine') @cap.run_command(['c', @config_user_incloudr2]) jquery1 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.js') jquery2 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.min.js') File.exist?(jquery1).should eq(true) File.exist?(jquery2).should eq(true) FileUtils.rm_r @cap.settings.working_dir Dir.chdir('..') end it '#new, set incloudr, and download jque from CDNJS (error)' do @cap.run_command(['n']) Dir.chdir('capucine') @cap.run_command(['c', @config_user_incloudr3]) jquery1 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.js') jquery2 = File.expand_path(File.join @cap.settings.working_dir, 'public/js_generated/modules/jquery.min.js') File.exist?(jquery1).should eq(false) File.exist?(jquery2).should eq(false) FileUtils.rm_r @cap.settings.working_dir Dir.chdir('..') end it '#list' do @cap.run_command(['js:list']) end it '#search' do @cap.run_command(['js:search', 'jquery']) end end