testotron 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/testotron.rb +1 -2
  3. data/lib/tests/http.rb +11 -5
  4. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82c1b1b254a39cc35e9960543e42fdae63825d71
4
- data.tar.gz: 5bcbd3c78acc4f445ad5f696c70928b7c3b6cc1e
3
+ metadata.gz: 1a4a4bf135594ac12a6f129153cba38464577008
4
+ data.tar.gz: 375f6cefadb516364a517ade6afe3133d58b1c5a
5
5
  SHA512:
6
- metadata.gz: 89d9a25a9ee77e0850bd2a9a202388e6926cea13db103cc48ad05aa223fb42727b54ffbe9d83126c47351a6c4482b7fb70e5571df600399b1b398b39c76b7959
7
- data.tar.gz: 6c743d954549b131bc19049b9a6c7d29c804283c41b5f44d691bd89aaf61172bc1a3405680ffdaf8f0da38576157965112dbf3f3baeae80a9b5787f76c65fb65
6
+ metadata.gz: 3fda793f194abda163dc0ee75890f042785897e87e0640da451dde715c88b91f5e9193eead9455761df904a5920ffa4e9dfae0f3385f64fb290040457ae1df81
7
+ data.tar.gz: ea50a288befb0162f9e330612eb9ee7dcaa19068f155f4b80ecc5f88d9bcf52e7a70bcb0ee65ba98258ad0d892e3754c551e84c4eff818c3eb23bf831d468191
data/lib/testotron.rb CHANGED
@@ -49,7 +49,7 @@ module Testotron
49
49
  def report_with(*methods)
50
50
  methods = methods.first if methods.length == 1
51
51
  methods = [methods] unless methods.is_a? Array
52
- @report_methods = methods.map &:to_sym
52
+ @report_methods = methods.map(&:to_sym)
53
53
  end
54
54
 
55
55
  def complain_using(&block)
@@ -124,7 +124,6 @@ EOF
124
124
  else
125
125
  raise ArgumentError if args.empty?
126
126
  test = args.shift.to_sym
127
- keys = TEST_CLASSES.map { |x| x.const_get(:KEY).to_sym }
128
127
  raise KeyError, "Unknown test: #{test}" unless TEST_CLASSES.map { |x| x.const_get(:KEY).to_sym }.include?(test)
129
128
  TEST_CLASSES.each { |klass|
130
129
  if klass.const_get(:KEY).to_sym == test
data/lib/tests/http.rb CHANGED
@@ -5,11 +5,11 @@ module Testotron
5
5
  class HTTP < Test
6
6
  KEY = "http"
7
7
 
8
- def initialize(host, port = 80, requests = nil)
9
- if requests.nil?
10
- requests = "http://#{host}/"
11
- end
12
- @host, @port, @requests = host, port, [*requests]
8
+ def initialize(host, options = {})
9
+ @host = host
10
+ @port = options[:port] || 80
11
+ @requests = [*(options[:requests] || "http://#{host}")]
12
+ @grep = options[:grep]
13
13
  end
14
14
 
15
15
  def human_name
@@ -42,6 +42,12 @@ module Testotron
42
42
  unless good_codes.include? code
43
43
  raise TestFailed, "Response code #{code} on #{@post}:#{@port} GET #{page}"
44
44
  end
45
+
46
+ if @grep
47
+ unless response.body.include? @grep
48
+ raise TestFailed, "Response on GET #{page} doesn't match '#@grep'"
49
+ end
50
+ end
45
51
  end
46
52
  end
47
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testotron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Pokorny
@@ -14,14 +14,14 @@ dependencies:
14
14
  name: mail
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description: "\t\tTestotron can automatically test basic functions of common servers,
@@ -44,18 +44,19 @@ require_paths:
44
44
  - lib
45
45
  required_ruby_version: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  requirements: []
56
56
  rubyforge_project:
57
- rubygems_version: 2.0.0
57
+ rubygems_version: 2.0.7
58
58
  signing_key:
59
59
  specification_version: 4
60
60
  summary: Simple server testing
61
61
  test_files: []
62
+ has_rdoc: