How to use localhost method of Platform Package

Best Selenium code snippet using Platform.localhost

lockfile_bundler_1_spec.rb

Source:lockfile_bundler_1_spec.rb Github

copy

Full Screen

...3 include Bundler::GemHelpers4 before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" }5 it "generates a simple lockfile for a single source, gem" do6 install_gemfile <<-G7 source "file://localhost#{gem_repo1}"8 gem "rack"9 G10 lockfile_should_be <<-G11 GEM12 remote: file://localhost#{gem_repo1}/13 specs:14 rack (1.0.0)15 PLATFORMS16 #{generic_local_platform}17 DEPENDENCIES18 rack19 BUNDLED WITH20 #{Bundler::VERSION}21 G22 end23 it "updates the lockfile's bundler version if current ver. is newer" do24 lockfile <<-L25 GIT26 remote: git://github.com/nex3/haml.git27 revision: 8a2271f28 specs:29 GEM30 remote: file://localhost#{gem_repo1}/31 specs:32 rack (1.0.0)33 PLATFORMS34 #{generic_local_platform}35 DEPENDENCIES36 omg!37 rack38 BUNDLED WITH39 1.8.240 L41 install_gemfile <<-G42 source "file://localhost#{gem_repo1}"43 gem "rack"44 G45 lockfile_should_be <<-G46 GEM47 remote: file://localhost#{gem_repo1}/48 specs:49 rack (1.0.0)50 PLATFORMS51 #{generic_local_platform}52 DEPENDENCIES53 rack54 BUNDLED WITH55 #{Bundler::VERSION}56 G57 end58 it "does not update the lockfile's bundler version if nothing changed during bundle install", :ruby_repo do59 version = "#{Bundler::VERSION.split(".").first}.0.0.0.a"60 lockfile <<-L61 GEM62 remote: file://localhost#{gem_repo1}/63 specs:64 rack (1.0.0)65 PLATFORMS66 #{generic_local_platform}67 DEPENDENCIES68 rack69 BUNDLED WITH70 #{version}71 L72 install_gemfile <<-G73 source "file://localhost#{gem_repo1}"74 gem "rack"75 G76 lockfile_should_be <<-G77 GEM78 remote: file://localhost#{gem_repo1}/79 specs:80 rack (1.0.0)81 PLATFORMS82 #{generic_local_platform}83 DEPENDENCIES84 rack85 BUNDLED WITH86 #{version}87 G88 end89 it "updates the lockfile's bundler version if not present" do90 lockfile <<-L91 GEM92 remote: file://localhost#{gem_repo1}/93 specs:94 rack (1.0.0)95 PLATFORMS96 #{generic_local_platform}97 DEPENDENCIES98 rack99 L100 install_gemfile <<-G101 source "file://localhost#{gem_repo1}"102 gem "rack", "> 0"103 G104 lockfile_should_be <<-G105 GEM106 remote: file://localhost#{gem_repo1}/107 specs:108 rack (1.0.0)109 PLATFORMS110 #{generic_local_platform}111 DEPENDENCIES112 rack (> 0)113 BUNDLED WITH114 #{Bundler::VERSION}115 G116 end117 it "outputs a warning if the current is older than lockfile's bundler version" do118 lockfile <<-L119 GEM120 remote: file://localhost#{gem_repo1}/121 specs:122 rack (1.0.0)123 PLATFORMS124 #{generic_local_platform}125 DEPENDENCIES126 rack127 BUNDLED WITH128 9999999.1.0129 L130 simulate_bundler_version "9999999.0.0" do131 install_gemfile <<-G132 source "file://localhost#{gem_repo1}"133 gem "rack"134 G135 end136 warning_message = "the running version of Bundler (9999999.0.0) is older " \137 "than the version that created the lockfile (9999999.1.0)"138 expect(out.scan(warning_message).size).to eq(1)139 lockfile_should_be <<-G140 GEM141 remote: file://localhost#{gem_repo1}/142 specs:143 rack (1.0.0)144 PLATFORMS145 #{generic_local_platform}146 #{specific_local_platform}147 DEPENDENCIES148 rack149 BUNDLED WITH150 9999999.1.0151 G152 end153 it "errors if the current is a major version older than lockfile's bundler version" do154 lockfile <<-L155 GEM156 remote: file://localhost#{gem_repo1}/157 specs:158 rack (1.0.0)159 PLATFORMS160 #{generic_local_platform}161 DEPENDENCIES162 rack163 BUNDLED WITH164 9999999.0.0165 L166 install_gemfile <<-G167 source "file://localhost#{gem_repo1}"168 gem "rack"169 G170 expect(exitstatus > 0) if exitstatus171 expect(out).to include("You must use Bundler 9999999 or greater with this lockfile.")172 end173 it "shows a friendly error when running with a new bundler 2 lockfile" do174 lockfile <<-L175 GEM176 remote: https://rails-assets.org/177 specs:178 rails-assets-bootstrap (3.3.4)179 rails-assets-jquery (>= 1.9.1)180 rails-assets-jquery (2.1.4)181 GEM182 remote: https://rubygems.org/183 specs:184 rake (10.4.2)185 PLATFORMS186 ruby187 DEPENDENCIES188 rails-assets-bootstrap!189 rake190 BUNDLED WITH191 9999999.0.0192 L193 install_gemfile <<-G194 source 'https://rubygems.org'195 gem 'rake'196 source 'https://rails-assets.org' do197 gem 'rails-assets-bootstrap'198 end199 G200 expect(exitstatus > 0) if exitstatus201 expect(out).to include("You must use Bundler 9999999 or greater with this lockfile.")202 end203 it "warns when updating bundler major version" do204 lockfile <<-L205 GEM206 remote: file://localhost#{gem_repo1}/207 specs:208 rack (1.0.0)209 PLATFORMS210 #{generic_local_platform}211 DEPENDENCIES212 rack213 BUNDLED WITH214 1.10.0215 L216 simulate_bundler_version "9999999.0.0" do217 install_gemfile <<-G218 source "file://localhost#{gem_repo1}"219 gem "rack"220 G221 end222 expect(out).to include("Warning: the lockfile is being updated to Bundler " \223 "9999999, after which you will be unable to return to Bundler 1.")224 lockfile_should_be <<-G225 GEM226 remote: file://localhost#{gem_repo1}/227 specs:228 rack (1.0.0)229 PLATFORMS230 #{generic_local_platform}231 #{specific_local_platform}232 DEPENDENCIES233 rack234 BUNDLED WITH235 9999999.0.0236 G237 end238 it "generates a simple lockfile for a single source, gem with dependencies" do239 install_gemfile <<-G240 source "file://localhost#{gem_repo1}"241 gem "rack-obama"242 G243 lockfile_should_be <<-G244 GEM245 remote: file://localhost#{gem_repo1}/246 specs:247 rack (1.0.0)248 rack-obama (1.0)249 rack250 PLATFORMS251 #{generic_local_platform}252 DEPENDENCIES253 rack-obama254 BUNDLED WITH255 #{Bundler::VERSION}256 G257 end258 it "generates a simple lockfile for a single source, gem with a version requirement" do259 install_gemfile <<-G260 source "file://localhost#{gem_repo1}"261 gem "rack-obama", ">= 1.0"262 G263 lockfile_should_be <<-G264 GEM265 remote: file://localhost#{gem_repo1}/266 specs:267 rack (1.0.0)268 rack-obama (1.0)269 rack270 PLATFORMS271 #{generic_local_platform}272 DEPENDENCIES273 rack-obama (>= 1.0)274 BUNDLED WITH275 #{Bundler::VERSION}276 G277 end278 it "generates a lockfile wihout credentials for a configured source" do279 bundle "config http://localgemserver.test/ user:pass"280 install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)281 source "http://localgemserver.test/"282 source "http://user:pass@othergemserver.test/"283 gem "rack-obama", ">= 1.0"284 G285 lockfile_should_be <<-G286 GEM287 remote: http://localgemserver.test/288 remote: http://user:pass@othergemserver.test/289 specs:290 rack (1.0.0)291 rack-obama (1.0)292 rack293 PLATFORMS294 #{generic_local_platform}295 DEPENDENCIES296 rack-obama (>= 1.0)297 BUNDLED WITH298 #{Bundler::VERSION}299 G300 end301 it "generates lockfiles with multiple requirements" do302 install_gemfile <<-G303 source "file://localhost#{gem_repo1}"304 gem "net-sftp"305 G306 lockfile_should_be <<-G307 GEM308 remote: file://localhost#{gem_repo1}/309 specs:310 net-sftp (1.1.1)311 net-ssh (>= 1.0.0, < 1.99.0)312 net-ssh (1.0)313 PLATFORMS314 ruby315 DEPENDENCIES316 net-sftp317 BUNDLED WITH318 #{Bundler::VERSION}319 G320 expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0"321 end322 it "generates a simple lockfile for a single pinned source, gem with a version requirement" do323 git = build_git "foo"324 install_gemfile <<-G325 gem "foo", :git => "#{lib_path("foo-1.0")}"326 G327 lockfile_should_be <<-G328 GIT329 remote: #{lib_path("foo-1.0")}330 revision: #{git.ref_for("master")}331 specs:332 foo (1.0)333 GEM334 specs:335 PLATFORMS336 #{generic_local_platform}337 DEPENDENCIES338 foo!339 BUNDLED WITH340 #{Bundler::VERSION}341 G342 end343 it "does not asplode when a platform specific dependency is present and the Gemfile has not been resolved on that platform" do344 build_lib "omg", :path => lib_path("omg")345 gemfile <<-G346 source "file://localhost#{gem_repo1}"347 platforms :#{not_local_tag} do348 gem "omg", :path => "#{lib_path("omg")}"349 end350 gem "rack"351 G352 lockfile <<-L353 GIT354 remote: git://github.com/nex3/haml.git355 revision: 8a2271f356 specs:357 GEM358 remote: file://localhost#{gem_repo1}/359 specs:360 rack (1.0.0)361 PLATFORMS362 #{not_local}363 DEPENDENCIES364 omg!365 rack366 BUNDLED WITH367 #{Bundler::VERSION}368 L369 bundle "install"370 expect(the_bundle).to include_gems "rack 1.0.0"371 end372 it "serializes global git sources" do373 git = build_git "foo"374 install_gemfile <<-G375 git "#{lib_path("foo-1.0")}" do376 gem "foo"377 end378 G379 lockfile_should_be <<-G380 GIT381 remote: #{lib_path("foo-1.0")}382 revision: #{git.ref_for("master")}383 specs:384 foo (1.0)385 GEM386 specs:387 PLATFORMS388 #{generic_local_platform}389 DEPENDENCIES390 foo!391 BUNDLED WITH392 #{Bundler::VERSION}393 G394 end395 it "generates a lockfile with a ref for a single pinned source, git gem with a branch requirement" do396 git = build_git "foo"397 update_git "foo", :branch => "omg"398 install_gemfile <<-G399 gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"400 G401 lockfile_should_be <<-G402 GIT403 remote: #{lib_path("foo-1.0")}404 revision: #{git.ref_for("omg")}405 branch: omg406 specs:407 foo (1.0)408 GEM409 specs:410 PLATFORMS411 #{generic_local_platform}412 DEPENDENCIES413 foo!414 BUNDLED WITH415 #{Bundler::VERSION}416 G417 end418 it "generates a lockfile with a ref for a single pinned source, git gem with a tag requirement" do419 git = build_git "foo"420 update_git "foo", :tag => "omg"421 install_gemfile <<-G422 gem "foo", :git => "#{lib_path("foo-1.0")}", :tag => "omg"423 G424 lockfile_should_be <<-G425 GIT426 remote: #{lib_path("foo-1.0")}427 revision: #{git.ref_for("omg")}428 tag: omg429 specs:430 foo (1.0)431 GEM432 specs:433 PLATFORMS434 #{generic_local_platform}435 DEPENDENCIES436 foo!437 BUNDLED WITH438 #{Bundler::VERSION}439 G440 end441 it "serializes pinned path sources to the lockfile" do442 build_lib "foo"443 install_gemfile <<-G444 gem "foo", :path => "#{lib_path("foo-1.0")}"445 G446 lockfile_should_be <<-G447 PATH448 remote: #{lib_path("foo-1.0")}449 specs:450 foo (1.0)451 GEM452 specs:453 PLATFORMS454 #{generic_local_platform}455 DEPENDENCIES456 foo!457 BUNDLED WITH458 #{Bundler::VERSION}459 G460 end461 it "serializes pinned path sources to the lockfile even when packaging" do462 build_lib "foo"463 install_gemfile! <<-G464 gem "foo", :path => "#{lib_path("foo-1.0")}"465 G466 bundle! :package, forgotten_command_line_options([:all, :cache_all] => true)467 bundle! :install, :local => true468 lockfile_should_be <<-G469 PATH470 remote: #{lib_path("foo-1.0")}471 specs:472 foo (1.0)473 GEM474 specs:475 PLATFORMS476 #{generic_local_platform}477 DEPENDENCIES478 foo!479 BUNDLED WITH480 #{Bundler::VERSION}481 G482 end483 it "sorts serialized sources by type" do484 build_lib "foo"485 bar = build_git "bar"486 install_gemfile <<-G487 source "file://localhost#{gem_repo1}"488 gem "rack"489 gem "foo", :path => "#{lib_path("foo-1.0")}"490 gem "bar", :git => "#{lib_path("bar-1.0")}"491 G492 lockfile_should_be <<-G493 GIT494 remote: #{lib_path("bar-1.0")}495 revision: #{bar.ref_for("master")}496 specs:497 bar (1.0)498 PATH499 remote: #{lib_path("foo-1.0")}500 specs:501 foo (1.0)502 GEM503 remote: file://localhost#{gem_repo1}/504 specs:505 rack (1.0.0)506 PLATFORMS507 #{generic_local_platform}508 DEPENDENCIES509 bar!510 foo!511 rack512 BUNDLED WITH513 #{Bundler::VERSION}514 G515 end516 it "lists gems alphabetically" do517 install_gemfile <<-G518 source "file://localhost#{gem_repo1}"519 gem "thin"520 gem "actionpack"521 gem "rack-obama"522 G523 lockfile_should_be <<-G524 GEM525 remote: file://localhost#{gem_repo1}/526 specs:527 actionpack (2.3.2)528 activesupport (= 2.3.2)529 activesupport (2.3.2)530 rack (1.0.0)531 rack-obama (1.0)532 rack533 thin (1.0)534 rack535 PLATFORMS536 #{generic_local_platform}537 DEPENDENCIES538 actionpack539 rack-obama540 thin541 BUNDLED WITH542 #{Bundler::VERSION}543 G544 end545 it "orders dependencies' dependencies in alphabetical order" do546 install_gemfile <<-G547 source "file://localhost#{gem_repo1}"548 gem "rails"549 G550 lockfile_should_be <<-G551 GEM552 remote: file://localhost#{gem_repo1}/553 specs:554 actionmailer (2.3.2)555 activesupport (= 2.3.2)556 actionpack (2.3.2)557 activesupport (= 2.3.2)558 activerecord (2.3.2)559 activesupport (= 2.3.2)560 activeresource (2.3.2)561 activesupport (= 2.3.2)562 activesupport (2.3.2)563 rails (2.3.2)564 actionmailer (= 2.3.2)565 actionpack (= 2.3.2)566 activerecord (= 2.3.2)567 activeresource (= 2.3.2)568 rake (= 10.0.2)569 rake (10.0.2)570 PLATFORMS571 #{generic_local_platform}572 DEPENDENCIES573 rails574 BUNDLED WITH575 #{Bundler::VERSION}576 G577 end578 it "orders dependencies by version" do579 install_gemfile <<-G580 source "file://localhost#{gem_repo1}"581 gem 'double_deps'582 G583 lockfile_should_be <<-G584 GEM585 remote: file://localhost#{gem_repo1}/586 specs:587 double_deps (1.0)588 net-ssh589 net-ssh (>= 1.0.0)590 net-ssh (1.0)591 PLATFORMS592 #{generic_local_platform}593 DEPENDENCIES594 double_deps595 BUNDLED WITH596 #{Bundler::VERSION}597 G598 end599 it "does not add the :require option to the lockfile" do600 install_gemfile <<-G601 source "file://localhost#{gem_repo1}"602 gem "rack-obama", ">= 1.0", :require => "rack/obama"603 G604 lockfile_should_be <<-G605 GEM606 remote: file://localhost#{gem_repo1}/607 specs:608 rack (1.0.0)609 rack-obama (1.0)610 rack611 PLATFORMS612 #{generic_local_platform}613 DEPENDENCIES614 rack-obama (>= 1.0)615 BUNDLED WITH616 #{Bundler::VERSION}617 G618 end619 it "does not add the :group option to the lockfile" do620 install_gemfile <<-G621 source "file://localhost#{gem_repo1}"622 gem "rack-obama", ">= 1.0", :group => :test623 G624 lockfile_should_be <<-G625 GEM626 remote: file://localhost#{gem_repo1}/627 specs:628 rack (1.0.0)629 rack-obama (1.0)630 rack631 PLATFORMS632 #{generic_local_platform}633 DEPENDENCIES634 rack-obama (>= 1.0)635 BUNDLED WITH636 #{Bundler::VERSION}637 G638 end639 it "stores relative paths when the path is provided in a relative fashion and in Gemfile dir" do640 build_lib "foo", :path => bundled_app("foo")641 install_gemfile <<-G642 path "foo"643 gem "foo"644 G645 lockfile_should_be <<-G646 PATH647 remote: foo648 specs:649 foo (1.0)650 GEM651 specs:652 PLATFORMS653 #{generic_local_platform}654 DEPENDENCIES655 foo656 BUNDLED WITH657 #{Bundler::VERSION}658 G659 end660 it "stores relative paths when the path is provided in a relative fashion and is above Gemfile dir" do661 build_lib "foo", :path => bundled_app(File.join("..", "foo"))662 install_gemfile <<-G663 path "../foo"664 gem "foo"665 G666 lockfile_should_be <<-G667 PATH668 remote: ../foo669 specs:670 foo (1.0)671 GEM672 specs:673 PLATFORMS674 #{generic_local_platform}675 DEPENDENCIES676 foo677 BUNDLED WITH678 #{Bundler::VERSION}679 G680 end681 it "stores relative paths when the path is provided in an absolute fashion but is relative" do682 build_lib "foo", :path => bundled_app("foo")683 install_gemfile <<-G684 path File.expand_path("../foo", __FILE__)685 gem "foo"686 G687 lockfile_should_be <<-G688 PATH689 remote: foo690 specs:691 foo (1.0)692 GEM693 specs:694 PLATFORMS695 #{generic_local_platform}696 DEPENDENCIES697 foo698 BUNDLED WITH699 #{Bundler::VERSION}700 G701 end702 it "stores relative paths when the path is provided for gemspec" do703 build_lib("foo", :path => tmp.join("foo"))704 install_gemfile <<-G705 gemspec :path => "../foo"706 G707 lockfile_should_be <<-G708 PATH709 remote: ../foo710 specs:711 foo (1.0)712 GEM713 specs:714 PLATFORMS715 #{generic_local_platform}716 DEPENDENCIES717 foo!718 BUNDLED WITH719 #{Bundler::VERSION}720 G721 end722 it "keeps existing platforms in the lockfile" do723 lockfile <<-G724 GEM725 remote: file://localhost#{gem_repo1}/726 specs:727 rack (1.0.0)728 PLATFORMS729 java730 DEPENDENCIES731 rack732 BUNDLED WITH733 #{Bundler::VERSION}734 G735 install_gemfile <<-G736 source "file://localhost#{gem_repo1}"737 gem "rack"738 G739 platforms = ["java", generic_local_platform.to_s].sort740 lockfile_should_be <<-G741 GEM742 remote: file://localhost#{gem_repo1}/743 specs:744 rack (1.0.0)745 PLATFORMS746 #{platforms[0]}747 #{platforms[1]}748 DEPENDENCIES749 rack750 BUNDLED WITH751 #{Bundler::VERSION}752 G753 end754 it "persists the spec's platform to the lockfile" do755 build_gem "platform_specific", "1.0.0", :to_system => true do |s|756 s.platform = Gem::Platform.new("universal-java-16")757 end758 simulate_platform "universal-java-16"759 install_gemfile <<-G760 source "file://localhost#{gem_repo1}"761 gem "platform_specific"762 G763 lockfile_should_be <<-G764 GEM765 remote: file://localhost#{gem_repo1}/766 specs:767 platform_specific (1.0-java)768 PLATFORMS769 java770 DEPENDENCIES771 platform_specific772 BUNDLED WITH773 #{Bundler::VERSION}774 G775 end776 it "does not add duplicate gems" do777 install_gemfile <<-G778 source "file://localhost#{gem_repo1}"779 gem "rack"780 G781 install_gemfile <<-G782 source "file://localhost#{gem_repo1}"783 gem "rack"784 gem "activesupport"785 G786 lockfile_should_be <<-G787 GEM788 remote: file://localhost#{gem_repo1}/789 specs:790 activesupport (2.3.5)791 rack (1.0.0)792 PLATFORMS793 ruby794 DEPENDENCIES795 activesupport796 rack797 BUNDLED WITH798 #{Bundler::VERSION}799 G800 end801 it "does not add duplicate dependencies" do802 install_gemfile <<-G803 source "file://localhost#{gem_repo1}"804 gem "rack"805 gem "rack"806 G807 lockfile_should_be <<-G808 GEM809 remote: file://localhost#{gem_repo1}/810 specs:811 rack (1.0.0)812 PLATFORMS813 ruby814 DEPENDENCIES815 rack816 BUNDLED WITH817 #{Bundler::VERSION}818 G819 end820 it "does not add duplicate dependencies with versions" do821 install_gemfile <<-G822 source "file://localhost#{gem_repo1}"823 gem "rack", "1.0"824 gem "rack", "1.0"825 G826 lockfile_should_be <<-G827 GEM828 remote: file://localhost#{gem_repo1}/829 specs:830 rack (1.0.0)831 PLATFORMS832 ruby833 DEPENDENCIES834 rack (= 1.0)835 BUNDLED WITH836 #{Bundler::VERSION}837 G838 end839 it "does not add duplicate dependencies in different groups" do840 install_gemfile <<-G841 source "file://localhost#{gem_repo1}"842 gem "rack", "1.0", :group => :one843 gem "rack", "1.0", :group => :two844 G845 lockfile_should_be <<-G846 GEM847 remote: file://localhost#{gem_repo1}/848 specs:849 rack (1.0.0)850 PLATFORMS851 ruby852 DEPENDENCIES853 rack (= 1.0)854 BUNDLED WITH855 #{Bundler::VERSION}856 G857 end858 it "raises if two different versions are used" do859 install_gemfile <<-G860 source "file://localhost#{gem_repo1}"861 gem "rack", "1.0"862 gem "rack", "1.1"863 G864 expect(bundled_app("Gemfile.lock")).not_to exist865 expect(out).to include "rack (= 1.0) and rack (= 1.1)"866 end867 it "raises if two different sources are used" do868 install_gemfile <<-G869 source "file://localhost#{gem_repo1}"870 gem "rack"871 gem "rack", :git => "git://hubz.com"872 G873 expect(bundled_app("Gemfile.lock")).not_to exist874 expect(out).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)"875 end876 it "works correctly with multiple version dependencies" do877 install_gemfile <<-G878 source "file://localhost#{gem_repo1}"879 gem "rack", "> 0.9", "< 1.0"880 G881 lockfile_should_be <<-G882 GEM883 remote: file://localhost#{gem_repo1}/884 specs:885 rack (0.9.1)886 PLATFORMS887 ruby888 DEPENDENCIES889 rack (> 0.9, < 1.0)890 BUNDLED WITH891 #{Bundler::VERSION}892 G893 end894 it "captures the Ruby version in the lockfile" do895 install_gemfile <<-G896 source "file://localhost#{gem_repo1}"897 ruby '#{RUBY_VERSION}'898 gem "rack", "> 0.9", "< 1.0"899 G900 lockfile_should_be <<-G901 GEM902 remote: file://localhost#{gem_repo1}/903 specs:904 rack (0.9.1)905 PLATFORMS906 ruby907 DEPENDENCIES908 rack (> 0.9, < 1.0)909 RUBY VERSION910 ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}911 BUNDLED WITH912 #{Bundler::VERSION}913 G914 end915 # Some versions of the Bundler 1.1 RC series introduced corrupted916 # lockfiles. There were two major problems:917 #918 # * multiple copies of the same GIT section appeared in the lockfile919 # * when this happened, those sections got multiple copies of gems920 # in those sections.921 it "fixes corrupted lockfiles" do922 build_git "omg", :path => lib_path("omg")923 revision = revision_for(lib_path("omg"))924 gemfile <<-G925 source "file://localhost#{gem_repo1}"926 gem "omg", :git => "#{lib_path("omg")}", :branch => 'master'927 G928 bundle "install --path vendor"929 expect(the_bundle).to include_gems "omg 1.0"930 # Create a Gemfile.lock that has duplicate GIT sections931 lockfile <<-L932 GIT933 remote: #{lib_path("omg")}934 revision: #{revision}935 branch: master936 specs:937 omg (1.0)938 GIT939 remote: #{lib_path("omg")}940 revision: #{revision}941 branch: master942 specs:943 omg (1.0)944 GEM945 remote: file://localhost#{gem_repo1}/946 specs:947 PLATFORMS948 #{local}949 DEPENDENCIES950 omg!951 BUNDLED WITH952 #{Bundler::VERSION}953 L954 FileUtils.rm_rf(bundled_app("vendor"))955 bundle "install"956 expect(the_bundle).to include_gems "omg 1.0"957 # Confirm that duplicate specs do not appear958 lockfile_should_be(<<-L)959 GIT960 remote: #{lib_path("omg")}961 revision: #{revision}962 branch: master963 specs:964 omg (1.0)965 GEM966 remote: file://localhost#{gem_repo1}/967 specs:968 PLATFORMS969 #{local}970 DEPENDENCIES971 omg!972 BUNDLED WITH973 #{Bundler::VERSION}974 L975 end976 it "raises a helpful error message when the lockfile is missing deps" do977 lockfile <<-L978 GEM979 remote: file://localhost#{gem_repo1}/980 specs:981 rack_middleware (1.0)982 PLATFORMS983 #{local}984 DEPENDENCIES985 rack_middleware986 L987 install_gemfile <<-G988 source "file:#{gem_repo1}"989 gem "rack_middleware"990 G991 expect(out).to include("Downloading rack_middleware-1.0 revealed dependencies not in the API or the lockfile (#{Gem::Dependency.new("rack", "= 0.9.1")}).").992 and include("Either installing with `--full-index` or running `bundle update rack_middleware` should fix the problem.")993 end994 describe "a line ending" do995 def set_lockfile_mtime_to_known_value996 time = Time.local(2000, 1, 1, 0, 0, 0)997 File.utime(time, time, bundled_app("Gemfile.lock"))998 end999 before(:each) do1000 build_repo21001 install_gemfile <<-G1002 source "file://localhost#{gem_repo2}"1003 gem "rack"1004 G1005 set_lockfile_mtime_to_known_value1006 end1007 it "generates Gemfile.lock with \\n line endings" do1008 expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")1009 expect(the_bundle).to include_gems "rack 1.0"1010 end1011 context "during updates" do1012 it "preserves Gemfile.lock \\n line endings" do1013 update_repo21014 expect { bundle "update", :all => true }.to change { File.mtime(bundled_app("Gemfile.lock")) }1015 expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")1016 expect(the_bundle).to include_gems "rack 1.2"1017 end1018 it "preserves Gemfile.lock \\n\\r line endings" do1019 update_repo21020 win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")1021 File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) }1022 set_lockfile_mtime_to_known_value1023 expect { bundle "update", :all => true }.to change { File.mtime(bundled_app("Gemfile.lock")) }1024 expect(File.read(bundled_app("Gemfile.lock"))).to match("\r\n")1025 expect(the_bundle).to include_gems "rack 1.2"1026 end1027 end1028 context "when nothing changes" do1029 it "preserves Gemfile.lock \\n line endings" do1030 expect do1031 ruby <<-RUBY1032 require 'rubygems'1033 require 'bundler'1034 Bundler.setup1035 RUBY1036 end.not_to change { File.mtime(bundled_app("Gemfile.lock")) }1037 end1038 it "preserves Gemfile.lock \\n\\r line endings" do1039 win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")1040 File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) }1041 set_lockfile_mtime_to_known_value1042 expect do1043 ruby <<-RUBY1044 require 'rubygems'1045 require 'bundler'1046 Bundler.setup1047 RUBY1048 end.not_to change { File.mtime(bundled_app("Gemfile.lock")) }1049 end1050 end1051 end1052 it "refuses to install if Gemfile.lock contains conflict markers" do1053 lockfile <<-L1054 GEM1055 remote: file://localhost#{gem_repo1}/1056 specs:1057 <<<<<<<1058 rack (1.0.0)1059 =======1060 rack (1.0.1)1061 >>>>>>>1062 PLATFORMS1063 ruby1064 DEPENDENCIES1065 rack1066 BUNDLED WITH1067 #{Bundler::VERSION}1068 L1069 install_gemfile(<<-G)1070 source "file://localhost#{gem_repo1}"1071 gem "rack"1072 G1073 expect(last_command.bundler_err).to match(/your Gemfile.lock contains merge conflicts/i)1074 expect(last_command.bundler_err).to match(/git checkout HEAD -- Gemfile.lock/i)1075 end1076end...

Full Screen

Full Screen

platform.rb

Source:platform.rb Github

copy

Full Screen

...132 end133 end134 nil135 end136 def localhost137 info = Socket.getaddrinfo "localhost", 80, Socket::AF_INET, Socket::SOCK_STREAM138 if info.empty?139 raise Error::WebDriverError, "unable to translate 'localhost' for TCP + IPv4"140 end141 info[0][3]142 end143 def ip144 orig = Socket.do_not_reverse_lookup145 Socket.do_not_reverse_lookup = true146 begin147 UDPSocket.open do |s|148 s.connect '8.8.8.8', 53149 return s.addr.last150 end151 ensure152 Socket.do_not_reverse_lookup = orig153 end154 rescue Errno::ENETUNREACH, Errno::EHOSTUNREACH155 # no external ip156 end157 def interfaces158 interfaces = Socket.getaddrinfo("localhost", 8080).map { |e| e[3] }159 interfaces += ["0.0.0.0", Platform.ip]160 interfaces.compact.uniq161 end162 end # Platform163 end # WebDriver164end # Selenium165if __FILE__ == $0166 p :engine => Selenium::WebDriver::Platform.engine,167 :os => Selenium::WebDriver::Platform.os,168 :ruby187? => Selenium::WebDriver::Platform.ruby187?,169 :ruby19? => Selenium::WebDriver::Platform.ruby19?,170 :jruby? => Selenium::WebDriver::Platform.jruby?,171 :windows? => Selenium::WebDriver::Platform.windows?,172 :home => Selenium::WebDriver::Platform.home,173 :bitsize => Selenium::WebDriver::Platform.bitsize,174 :localhost => Selenium::WebDriver::Platform.localhost,175 :ip => Selenium::WebDriver::Platform.ip,176 :interfaces => Selenium::WebDriver::Platform.interfaces,177 :null_device => Selenium::WebDriver::Platform.null_device178end...

Full Screen

Full Screen

mysql_server_account_security_spec.rb

Source:mysql_server_account_security_spec.rb Github

copy

Full Screen

...7 [ 'root@myhost.mydomain',8 'root@127.0.0.1',9 'root@::1',10 '@myhost.mydomain',11 '@localhost',12 '@%',13 ].each do |user|14 it "removes Mysql_User[#{user}]" do15 is_expected.to contain_mysql_user(user).with_ensure('absent')16 end17 end18 # When the hostname doesn't match the fqdn we also remove these.19 # We don't need to test the inverse as when they match they are20 # covered by the above list.21 [ 'root@myhost', '@myhost' ].each do |user|22 it "removes Mysql_User[#{user}]" do23 is_expected.to contain_mysql_user(user).with_ensure('absent')24 end25 end26 it 'should remove Mysql_database[test]' do27 is_expected.to contain_mysql_database('test').with_ensure('absent')28 end29 end30 describe "on #{pe_version} #{pe_platform} with fqdn==localhost" do31 let(:facts) { facts.merge({:fqdn => 'localhost', :hostname => 'localhost'}) }32 [ 'root@127.0.0.1',33 'root@::1',34 '@localhost',35 'root@localhost.localdomain',36 '@localhost.localdomain',37 '@%',38 ].each do |user|39 it "removes Mysql_User[#{user}]" do40 is_expected.to contain_mysql_user(user).with_ensure('absent')41 end42 end43 end44 describe "on #{pe_version} #{pe_platform} with fqdn==localhost.localdomain" do45 let(:facts) { facts.merge({:fqdn => 'localhost.localdomain', :hostname => 'localhost'}) }46 [ 'root@127.0.0.1',47 'root@::1',48 '@localhost',49 'root@localhost.localdomain',50 '@localhost.localdomain',51 '@%',52 ].each do |user|53 it "removes Mysql_User[#{user}]" do54 is_expected.to contain_mysql_user(user).with_ensure('absent')55 end56 end57 end58 end59 end60end...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful