How to use win_platform method of Gem Package

Best Vcr_ruby code snippet using Gem.win_platform

test_gem_request_set_gem_dependency_api.rb

Source:test_gem_request_set_gem_dependency_api.rb Github

copy

Full Screen

...104 loaded = @vendor_set.load_spec(name, version, Gem::Platform::RUBY, nil)105 assert_equal "#{name}-#{version}", loaded.full_name106 end107 def test_gem_platforms108 win_platform, Gem.win_platform = Gem.win_platform?, false109 with_engine_version 'ruby', '2.0.0' do110 @gda.gem 'a', :platforms => :ruby111 refute_empty @set.dependencies112 end113 ensure114 Gem.win_platform = win_platform115 end116 def test_gem_platforms_bundler_ruby117 win_platform, Gem.win_platform = Gem.win_platform?, false118 with_engine_version 'ruby', '2.0.0' do119 set = Gem::RequestSet.new120 gda = @GDA.new set, 'gem.deps.rb'121 gda.gem 'a', :platforms => :ruby122 refute_empty set.dependencies123 end124 with_engine_version 'rbx', '2.0.0' do125 set = Gem::RequestSet.new126 gda = @GDA.new set, 'gem.deps.rb'127 gda.gem 'a', :platforms => :ruby128 refute_empty set.dependencies129 end130 with_engine_version 'jruby', '1.7.6' do131 set = Gem::RequestSet.new132 gda = @GDA.new set, 'gem.deps.rb'133 gda.gem 'a', :platforms => :ruby134 assert_empty set.dependencies135 end136 Gem.win_platform = true137 with_engine_version 'ruby', '2.0.0' do138 set = Gem::RequestSet.new139 gda = @GDA.new set, 'gem.deps.rb'140 gda.gem 'a', :platforms => :ruby141 assert_empty set.dependencies142 end143 Gem.win_platform = win_platform144 end145 def test_gem_platforms_engine146 with_engine_version 'jruby', '1.7.6' do147 @gda.gem 'a', :platforms => :mri148 assert_empty @set.dependencies149 end150 end151 def test_gem_platforms_maglev152 win_platform, Gem.win_platform = Gem.win_platform?, false153 with_engine_version 'maglev', '1.0.0' do154 set = Gem::RequestSet.new155 gda = @GDA.new set, 'gem.deps.rb'156 gda.gem 'a', :platforms => :ruby157 refute_empty set.dependencies158 set = Gem::RequestSet.new159 gda = @GDA.new set, 'gem.deps.rb'160 gda.gem 'a', :platforms => :maglev161 refute_empty set.dependencies162 end163 ensure164 Gem.win_platform = win_platform165 end166 def test_gem_platforms_multiple167 win_platform, Gem.win_platform = Gem.win_platform?, false168 with_engine_version 'ruby', '2.0.0' do169 @gda.gem 'a', :platforms => [:mswin, :jruby]170 assert_empty @set.dependencies171 end172 ensure173 Gem.win_platform = win_platform174 end175 def test_gem_platforms_version176 with_engine_version 'ruby', '2.0.0' do177 @gda.gem 'a', :platforms => :ruby_18178 assert_empty @set.dependencies179 end180 end181 def test_gem_platforms_unknown182 e = assert_raises ArgumentError do183 @gda.gem 'a', :platforms => :unknown184 end185 assert_equal 'unknown platform :unknown', e.message186 end187 def test_gem_require188 @gda.gem 'a', :require => %w[b c]189 @gda.gem 'd', :require => 'e'190 assert_equal [dep('a'), dep('d')], @set.dependencies191 assert_equal %w[b c], @gda.requires['a']192 assert_equal %w[e], @gda.requires['d']193 end194 def test_gem_require_false195 @gda.gem 'a', :require => false196 assert_equal [dep('a')], @set.dependencies197 assert_empty @gda.requires198 end199 def test_gem_require_without_group200 @gda.without_groups << :test201 @gda.gem 'a', :group => :test202 assert_empty @set.dependencies203 assert_empty @gda.requires['a']204 end205 def test_gem_requirement206 @gda.gem 'a', '~> 1.0'207 assert_equal [dep('a', '~> 1.0')], @set.dependencies208 end209 def test_gem_requirements210 @gda.gem 'b', '~> 1.0', '>= 1.0.2'211 assert_equal [dep('b', '~> 1.0', '>= 1.0.2')], @set.dependencies212 end213 def test_gem_requirements_options214 @gda.gem 'c', :git => 'https://example/c.git'215 assert_equal [dep('c')], @set.dependencies216 end217 def test_gem_source_mismatch218 name, _, directory = vendor_gem219 gda = @GDA.new @set, nil220 gda.gem name221 e = assert_raises ArgumentError do222 gda.gem name, :path => directory223 end224 assert_equal "duplicate source path: #{directory} for gem #{name}",225 e.message226 gda = @GDA.new @set, nil227 gda.instance_variable_set :@vendor_set, @vendor_set228 gda.gem name, :path => directory229 e = assert_raises ArgumentError do230 gda.gem name231 end232 assert_equal "duplicate source (default) for gem #{name}",233 e.message234 end235 def test_gem_deps_file236 assert_equal 'gem.deps.rb', @gda.gem_deps_file237 gda = @GDA.new @set, 'foo/Gemfile'238 assert_equal 'Gemfile', gda.gem_deps_file239 end240 def test_gem_group_method241 groups = []242 @gda.group :a do243 groups = @gda.send :gem_group, 'a', :group => :b, :groups => [:c, :d]244 end245 assert_equal [:a, :b, :c, :d], groups.sort_by { |group| group.to_s }246 end247 def test_gemspec248 spec = util_spec 'a', 1, 'b' => 2249 spec.add_development_dependency 'c', 3250 open 'a.gemspec', 'w' do |io|251 io.write spec.to_ruby_for_cache252 end253 @gda.gemspec254 assert_equal [dep('b', '= 2'), dep('c', '=3')], @set.dependencies255 assert_equal %w[a], @gda.requires['a']256 end257 def test_gemspec_bad258 FileUtils.touch 'a.gemspec'259 e = assert_raises ArgumentError do260 capture_io do261 @gda.gemspec262 end263 end264 assert_equal 'invalid gemspec ./a.gemspec', e.message265 end266 def test_gemspec_development_group267 spec = util_spec 'a', 1, 'b' => 2268 spec.add_development_dependency 'c', 3269 open 'a.gemspec', 'w' do |io|270 io.write spec.to_ruby_for_cache271 end272 @gda.without_groups << :other273 @gda.gemspec :development_group => :other274 assert_equal [dep('b', '= 2')], @set.dependencies275 assert_equal %w[a], @gda.requires['a']276 end277 def test_gemspec_multiple278 open 'a.gemspec', 'w' do |io|279 spec = util_spec 'a', 1, 'b' => 2280 io.write spec.to_ruby_for_cache281 end282 open 'b.gemspec', 'w' do |io|283 spec = util_spec 'b', 2, 'c' => 3284 io.write spec.to_ruby_for_cache285 end286 e = assert_raises ArgumentError do287 @gda.gemspec288 end289 assert_equal "found multiple gemspecs at #{@tempdir}, use the name: option to specify the one you want", e.message290 end291 def test_gemspec_name292 open 'a.gemspec', 'w' do |io|293 spec = util_spec 'a', 1, 'b' => 2294 io.write spec.to_ruby_for_cache295 end296 open 'b.gemspec', 'w' do |io|297 spec = util_spec 'b', 2, 'c' => 3298 io.write spec.to_ruby_for_cache299 end300 @gda.gemspec :name => 'b'301 assert_equal [dep('c', '= 3')], @set.dependencies302 end303 def test_gemspec_named304 spec = util_spec 'a', 1, 'b' => 2305 open 'other.gemspec', 'w' do |io|306 io.write spec.to_ruby_for_cache307 end308 @gda.gemspec309 assert_equal [dep('b', '= 2')], @set.dependencies310 end311 def test_gemspec_none312 e = assert_raises ArgumentError do313 @gda.gemspec314 end315 assert_equal "no gemspecs found at #{@tempdir}", e.message316 end317 def test_gemspec_path318 spec = util_spec 'a', 1, 'b' => 2319 FileUtils.mkdir 'other'320 open 'other/a.gemspec', 'w' do |io|321 io.write spec.to_ruby_for_cache322 end323 @gda.gemspec :path => 'other'324 assert_equal [dep('b', '= 2')], @set.dependencies325 end326 def test_git327 @gda.git 'git://example/repo.git' do328 @gda.gem 'a'329 @gda.gem 'b'330 end331 assert_equal [dep('a'), dep('b')], @set.dependencies332 assert_equal %w[git://example/repo.git master], @git_set.repositories['a']333 assert_equal %w[git://example/repo.git master], @git_set.repositories['b']334 end335 def test_group336 @gda.group :test do337 @gda.gem 'a'338 end339 assert_equal [dep('a')], @set.dependencies340 end341 def test_load342 Tempfile.open 'gem.deps.rb' do |io|343 io.write <<-GEM_DEPS344gem 'a'345group :test do346 gem 'b'347end348 GEM_DEPS349 io.flush350 gda = @GDA.new @set, io.path351 gda.load352 assert_equal [dep('a'), dep('b')], @set.dependencies353 end354 end355 def test_name_typo356 assert_same @GDA, Gem::RequestSet::GemDepedencyAPI357 end358 def test_pin_gem_source359 gda = @GDA.new @set, nil360 gda.send :pin_gem_source, 'a'361 gda.send :pin_gem_source, 'a'362 e = assert_raises ArgumentError do363 gda.send :pin_gem_source, 'a', :path, 'vendor/a'364 end365 assert_equal "duplicate source path: vendor/a for gem a",366 e.message367 e = assert_raises ArgumentError do368 gda.send :pin_gem_source, 'a', :git, 'git://example/repo.git'369 end370 assert_equal "duplicate source git: git://example/repo.git for gem a",371 e.message372 end373 def test_platform_mswin374 win_platform, Gem.win_platform = Gem.win_platform?, false375 @gda.platform :mswin do376 @gda.gem 'a'377 end378 assert_empty @set.dependencies379 Gem.win_platform = true380 @gda.platform :mswin do381 @gda.gem 'a'382 end383 refute_empty @set.dependencies384 ensure385 Gem.win_platform = win_platform386 end387 def test_platform_ruby388 win_platform, Gem.win_platform = Gem.win_platform?, false389 @gda.platform :ruby do390 @gda.gem 'a'391 end392 assert_equal [dep('a')], @set.dependencies393 ensure394 Gem.win_platform = win_platform395 end396 def test_platforms397 win_platform, Gem.win_platform = Gem.win_platform?, false398 @gda.platforms :ruby do399 @gda.gem 'a'400 end401 assert_equal [dep('a')], @set.dependencies402 @gda.platforms :mswin do403 @gda.gem 'b'404 end405 assert_equal [dep('a')], @set.dependencies406 Gem.win_platform = true407 @gda.platforms :mswin do408 @gda.gem 'c'409 end410 assert_equal [dep('a'), dep('c')], @set.dependencies411 ensure412 Gem.win_platform = win_platform413 end414 def test_ruby415 assert @gda.ruby RUBY_VERSION416 end417 def test_ruby_engine418 with_engine_version 'jruby', '1.7.6' do419 assert @gda.ruby RUBY_VERSION,420 :engine => 'jruby', :engine_version => '1.7.6'421 end422 end423 def test_ruby_engine_mismatch_engine424 with_engine_version 'ruby', '2.0.0' do425 e = assert_raises Gem::RubyVersionMismatch do426 @gda.ruby RUBY_VERSION, :engine => 'jruby', :engine_version => '1.7.4'...

Full Screen

Full Screen

win_platform

Using AI Code Generation

copy

Full Screen

1 Encoding.default_external = Encoding.find(Encoding.locale_charmap)2 io.set_encoding(Encoding.default_external, Encoding.default_internal)3 Encoding.default_external = Encoding.find(Encoding.locale_charmap)4 io.set_encoding(Encoding.default_external, Encoding.default_internal)5name = STDIN.gets.encode("UTF-8").chomp6 Encoding.default_external = Encoding.find(Encoding.locale_charmap)7 io.set_encoding(Encoding.default_external, Encoding.default_internal)8name = STDIN.gets.encode("UTF-8").chomp9height = STDIN.gets.encode("UTF-8").chomp10 Encoding.default_external = Encoding.find(Encoding.locale_charmap)11 io.set_encoding(Encoding.default_external, Encoding.default_internal)12name = STDIN.gets.encode("UTF-8").chomp13height = STDIN.gets.encode("UTF

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.

Run Vcr_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful