ruby-jmeter 2.11.4 → 2.11.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5bc1f6b2c1312ab7e9922978ee213d39deef0a8
4
- data.tar.gz: 0e8446660a68a200b541c13ba7db7217a66cf377
3
+ metadata.gz: 6d6fa9fb9703eb230c92bf837ff1f0dfe98d8fe0
4
+ data.tar.gz: 63d62ea17960c6ba6e6ac538e92987841cc2267d
5
5
  SHA512:
6
- metadata.gz: 071962a0464223aecd0ad7314e631affc67ac582fb321172051cbce5e72c4533e71e57f2a503d7ea61ceea7964d87bfc14d60449e6f3cf051cab9001ae17bf00
7
- data.tar.gz: 6693613ecb51856faa38aefa2ca33c40516cc76ce1f316af497c59d824fcf126d29c3620442755604089bbdb6ae8aedf8860ad4c3e0466a32950e8ab9dc92a96
6
+ metadata.gz: 0d377a9d968acf5c6e8bf5657341e07a3faedbf77c4d048bba52adc69969c4cdfd7ead98686c98b63048c4e7a9a64a8ab1da57a92a1e65ad1747b207c33bbe26
7
+ data.tar.gz: 47a25ef52dba2f9ad0318083d4b5baaf95edc816263a5425da642e4168b806b3d7c1ebe22fdec973738a999baaaddc53f507905f110c0aa1442f7768c9c567c5
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 1.9.3-p484
1
+ 2.0.0-p353
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'ruby-jmeter'
3
+
4
+ test do
5
+ threads do
6
+ transaction name: "TC_03", parent: true, include_timers: true do
7
+ submit url: "/", fill_in: { username: 'tim', password: 'password' },
8
+ files: [{path: '/tmp/foo', paramname: 'fileup', mimetype: 'text/plain'},
9
+ {path: '/tmp/bar', paramname: 'otherfileup'}]
10
+ end
11
+ end
12
+ end
@@ -16,6 +16,7 @@ module RubyJmeter
16
16
 
17
17
  fill_in(params) if params.has_key?(:fill_in)
18
18
  raw_body(params) if params.has_key?(:raw_body)
19
+ files(params) if params.has_key?(:files)
19
20
  end
20
21
 
21
22
  def parse_url(params)
@@ -80,6 +81,29 @@ module RubyJmeter
80
81
  params.delete(:raw_body)
81
82
  end
82
83
 
84
+ def files(params)
85
+ files = params.delete(:files)
86
+ return if files.empty?
87
+ x = Nokogiri::XML::Builder.new do |b|
88
+ b.elementProp(name: "HTTPsampler.Files", elementType: "HTTPFileArgs") {
89
+ b.collectionProp(name: "HTTPFileArgs.files") {
90
+ files.each do |f|
91
+ b.elementProp(name: f[:path], elementType: "HTTPFileArg") {
92
+ b.stringProp f[:path] || '' , name: "File.path"
93
+ b.stringProp f[:paramname] || '' , name: "File.paramname"
94
+ b.stringProp f[:mimetype] || '' , name: "File.mimetype"
95
+ }
96
+ end
97
+ }
98
+ }
99
+ end
100
+ params[:update_at_xpath] ||= []
101
+ params[:update_at_xpath] << {
102
+ :xpath => '//HTTPSamplerProxy',
103
+ :value => x.doc.root
104
+ }
105
+ end
106
+
83
107
  def parse_test_type(params)
84
108
  case params.keys.first
85
109
  when 'contains'
@@ -1,3 +1,3 @@
1
1
  module RubyJmeter
2
- VERSION = "2.11.4"
2
+ VERSION = "2.11.5"
3
3
  end
data/spec/dsl_spec.rb CHANGED
@@ -451,6 +451,36 @@ describe "DSL" do
451
451
  it 'should match on POST' do
452
452
  fragment.search(".//stringProp[@name='HTTPSampler.method']").text.should == 'POST'
453
453
  end
454
+
455
+ it 'should have no files' do
456
+ fragment.search(".//elementProp[@name='HTTPsampler.Files']").length.should == 0
457
+ end
458
+
459
+ end
460
+
461
+
462
+ describe 'submit_with_files' do
463
+ let(:doc) do
464
+ test do
465
+ threads do
466
+ transaction name: "TC_03", parent: true, include_timers: true do
467
+ submit url: "/", fill_in: { username: 'tim', password: 'password' },
468
+ files: [{path: '/tmp/foo', paramname: 'fileup', mimetype: 'text/plain'},
469
+ {path: '/tmp/bar', paramname: 'otherfileup'}]
470
+ end
471
+ end
472
+ end.to_doc
473
+ end
474
+
475
+ let(:fragment) { doc.search("//HTTPSamplerProxy/elementProp[@name='HTTPsampler.Files']").first }
476
+
477
+ it 'should have two files' do
478
+ fragment.search("./collectionProp/elementProp[@elementType='HTTPFileArg']").length.should == 2
479
+ end
480
+
481
+ it 'should have one empty mimetype' do
482
+ fragment.search("./collectionProp/elementProp[@elementType='HTTPFileArg']/stringProp[@name='File.mimetype' and normalize-space(.) = '']").length.should == 1
483
+ end
454
484
  end
455
485
 
456
486
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-jmeter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.4
4
+ version: 2.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Koopmans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-23 00:00:00.000000000 Z
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -71,6 +71,7 @@ files:
71
71
  - examples/basic_har.rb
72
72
  - examples/basic_header.rb
73
73
  - examples/basic_http_request_defaults.rb
74
+ - examples/basic_http_request_with_files.rb
74
75
  - examples/basic_ldap_ext.rb
75
76
  - examples/basic_meta_fu.rb
76
77
  - examples/basic_post.rb