apirunner 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/apirunner.gemspec +4 -4
- data/lib/api_runner.rb +1 -0
- data/lib/expectation_matcher.rb +1 -0
- data/spec/api_runner_spec.rb +10 -19
- data/spec/expectation_matcher_spec.rb +1 -1
- metadata +6 -6
data/Rakefile
CHANGED
@@ -14,10 +14,10 @@ Jeweler::Tasks.new do |gem|
|
|
14
14
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
15
|
gem.name = "apirunner"
|
16
16
|
gem.summary = %Q{one-line summary of your gem}
|
17
|
-
gem.description = %Q{
|
17
|
+
gem.description = %Q{apirunner is a testsuite to query your RESTful JSON API and match response with your defined expectations}
|
18
18
|
gem.email = "developers@moviepilot.com"
|
19
19
|
gem.homepage = "http://github.com/moviepilot/apirunner"
|
20
|
-
gem.authors = ["moviepilot"]
|
20
|
+
gem.authors = ["jan@moviepilot.com"]
|
21
21
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
22
22
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
23
23
|
# spec.add_runtime_dependency 'jabber4r', '> 0.1'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/apirunner.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{apirunner}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["moviepilot"]
|
12
|
-
s.date = %q{2010-09-
|
13
|
-
s.description = %q{
|
11
|
+
s.authors = ["jan@moviepilot.com"]
|
12
|
+
s.date = %q{2010-09-22}
|
13
|
+
s.description = %q{apirunner is a testsuite to query your RESTful JSON API and match response with your defined expectations}
|
14
14
|
s.email = %q{developers@moviepilot.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
data/lib/api_runner.rb
CHANGED
data/lib/expectation_matcher.rb
CHANGED
@@ -46,6 +46,7 @@ class ExpectationMatcher
|
|
46
46
|
result_struct = Struct.new(:succeeded, :error)
|
47
47
|
results = result_struct.new(:succeeded => true, :error => nil)
|
48
48
|
|
49
|
+
debugger
|
49
50
|
testcase['response_expectation']['headers'].try(:each_pair) do |header_name, header_value|
|
50
51
|
if is_regex?(header_value)
|
51
52
|
if not (excluded?(header_name) or regex_matches?(header_value, response.headers[header_name]))
|
data/spec/api_runner_spec.rb
CHANGED
@@ -20,7 +20,10 @@ describe 'apirunner' do
|
|
20
20
|
@a.instance_variable_get(:@excludes).include?("content-length").should be_true
|
21
21
|
@a.instance_variable_get(:@excludes).include?("notthere").should be_false
|
22
22
|
end
|
23
|
-
it 'should fill @spec'
|
23
|
+
it 'should fill @spec' do
|
24
|
+
@a.instance_variable_get(:@spec).should be_a(Array)
|
25
|
+
@a.instance_variable_get(:@spec).size.should >= 1
|
26
|
+
end
|
24
27
|
it 'should instantiate an http client into @http_client' do
|
25
28
|
@a.instance_variable_get(:@http_client).should be_a(HttpClient)
|
26
29
|
end
|
@@ -30,11 +33,14 @@ describe 'apirunner' do
|
|
30
33
|
end
|
31
34
|
|
32
35
|
describe 'run_tests' do
|
33
|
-
it 'should send a request for every given testcase'
|
36
|
+
it 'should send a request for every given testcase' do
|
37
|
+
pending "Rails context missing"
|
38
|
+
@a.should_receive(:server_is_available?).and_return true
|
39
|
+
@a.should_receive(:send_request).exactly(@a.instance_variable_get(:@spec).size).times
|
40
|
+
@a.run
|
41
|
+
end
|
34
42
|
it 'should run a test for every test_type'
|
35
|
-
it 'should output an "F" if an error occured'
|
36
43
|
it 'should save an error message in @errors if an error occured'
|
37
|
-
it 'should output a "." if all test_types of a certain test_case passed'
|
38
44
|
end
|
39
45
|
|
40
46
|
describe 'send_request' do
|
@@ -50,19 +56,4 @@ describe 'apirunner' do
|
|
50
56
|
it 'should return false if the given server is not available'
|
51
57
|
end
|
52
58
|
|
53
|
-
describe 'load_config' do
|
54
|
-
it 'should load the configuration from a YAML file'
|
55
|
-
it 'should put the config into certain instance variables'
|
56
|
-
end
|
57
|
-
|
58
|
-
describe 'load_url_spec' do
|
59
|
-
it 'should load the URL spec from a YAML file'
|
60
|
-
it 'should create an array of test_cases in @spec instance variable'
|
61
|
-
end
|
62
|
-
|
63
|
-
describe 'load_excludes' do
|
64
|
-
it 'should load the excludes from a yaml file'
|
65
|
-
it 'should populate @excludes instance variable with the excludes from the YAML file'
|
66
|
-
it 'should make sure that @excludes is an array'
|
67
|
-
end
|
68
59
|
end
|
@@ -99,7 +99,7 @@ describe 'ExpectationMatcher' do
|
|
99
99
|
@response = response_struct.new
|
100
100
|
end
|
101
101
|
it 'should return a struct representing success, if one certain expected header value matches the response header' do
|
102
|
-
pending "
|
102
|
+
pending "Rails context is missing"
|
103
103
|
@response.headers = {"content-type"=>["text/html; charset=utf-8"], "cache-control"=>["no-cache"], "x-runtime"=>["0.340116"], "server"=>["WEBrick/1.3.1 (Ruby/1.9.2/2010-08-18)"], "date"=>["Tue, 21 Sep 2010 11:33:05 GMT"], "content-length"=>["149"], "connection"=>["close"], "Last-Modified" => "2010-10-01 23:23:23"}
|
104
104
|
testcase = { 'response_expectation' => { 'headers' => {"Last-Modified"=>"/.*/"} } }
|
105
105
|
@em.send(:response_headers, @response, testcase).should be_a(Struct)
|
metadata
CHANGED
@@ -5,16 +5,16 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
|
-
- moviepilot
|
12
|
+
- jan@moviepilot.com
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-22 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -211,7 +211,7 @@ dependencies:
|
|
211
211
|
type: :development
|
212
212
|
prerelease: false
|
213
213
|
version_requirements: *id013
|
214
|
-
description:
|
214
|
+
description: apirunner is a testsuite to query your RESTful JSON API and match response with your defined expectations
|
215
215
|
email: developers@moviepilot.com
|
216
216
|
executables: []
|
217
217
|
|
@@ -262,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
262
|
requirements:
|
263
263
|
- - ">="
|
264
264
|
- !ruby/object:Gem::Version
|
265
|
-
hash: -
|
265
|
+
hash: -2675700175658128746
|
266
266
|
segments:
|
267
267
|
- 0
|
268
268
|
version: "0"
|