rest-assured 1.1.10 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -2
- data/CHANGELOG +4 -0
- data/Gemfile +1 -3
- data/Gemfile.lock +86 -85
- data/README.markdown +2 -7
- data/bin/heroku_runner +1 -0
- data/bin/rest-assured +10 -2
- data/features/step_definitions/doubles_steps.rb +1 -1
- data/features/support/env.rb +3 -3
- data/features/support/world_helpers.rb +1 -1
- data/lib/rest-assured/application.rb +0 -1
- data/lib/rest-assured/config.rb +0 -16
- data/lib/rest-assured/routes/double.rb +1 -2
- data/lib/rest-assured/version.rb +1 -1
- data/rest-assured.gemspec +5 -5
- data/spec/config_spec.rb +1 -120
- data/spec/functional/double_routes_spec.rb +1 -1
- data/views/doubles/index.haml +3 -5
- metadata +16 -22
- data/features/support/selenium-fix.rb +0 -8
- data/lib/sinatra/handler_options_patch.rb +0 -25
data/.travis.yml
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
bundler_args: --without development
|
2
2
|
rvm:
|
3
3
|
- 1.8.7
|
4
|
-
- 1.9.2
|
5
4
|
- 1.9.3
|
6
5
|
env: DISPLAY=:99.0
|
7
6
|
before_script:
|
8
7
|
- "mysql -e 'create database rest_assured_test;'"
|
9
8
|
- "sh -e /etc/init.d/xvfb start"
|
10
|
-
script: "bundle exec rspec
|
9
|
+
script: "bundle exec rspec spec && bundle exec cucumber --format progress"
|
11
10
|
branches:
|
12
11
|
only:
|
13
12
|
- master
|
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,115 +1,116 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rest-assured (1.
|
4
|
+
rest-assured (1.2.0)
|
5
5
|
activerecord (~> 3.2.0)
|
6
6
|
activeresource (~> 3.2.0)
|
7
|
-
childprocess (~> 0.3
|
8
|
-
haml (
|
9
|
-
|
10
|
-
sinatra (~> 1.3.2)
|
7
|
+
childprocess (~> 0.3)
|
8
|
+
haml (~> 4.0)
|
9
|
+
sinatra (~> 1.4.0)
|
11
10
|
sinatra-flash
|
11
|
+
thin (~> 1.5)
|
12
12
|
|
13
13
|
GEM
|
14
|
-
remote:
|
14
|
+
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
activemodel (3.2.
|
17
|
-
activesupport (= 3.2.
|
16
|
+
activemodel (3.2.13)
|
17
|
+
activesupport (= 3.2.13)
|
18
18
|
builder (~> 3.0.0)
|
19
|
-
activerecord (3.2.
|
20
|
-
activemodel (= 3.2.
|
21
|
-
activesupport (= 3.2.
|
19
|
+
activerecord (3.2.13)
|
20
|
+
activemodel (= 3.2.13)
|
21
|
+
activesupport (= 3.2.13)
|
22
22
|
arel (~> 3.0.2)
|
23
23
|
tzinfo (~> 0.3.29)
|
24
|
-
activeresource (3.2.
|
25
|
-
activemodel (= 3.2.
|
26
|
-
activesupport (= 3.2.
|
27
|
-
activesupport (3.2.
|
28
|
-
i18n (
|
24
|
+
activeresource (3.2.13)
|
25
|
+
activemodel (= 3.2.13)
|
26
|
+
activesupport (= 3.2.13)
|
27
|
+
activesupport (3.2.13)
|
28
|
+
i18n (= 0.6.1)
|
29
29
|
multi_json (~> 1.0)
|
30
|
-
addressable (2.3.
|
30
|
+
addressable (2.3.3)
|
31
31
|
anticipate (0.0.2)
|
32
32
|
archive-tar-minitar (0.5.2)
|
33
33
|
arel (3.0.2)
|
34
34
|
awesome_print (1.1.0)
|
35
|
-
binding_of_caller (0.
|
36
|
-
|
37
|
-
|
35
|
+
binding_of_caller (0.7.1)
|
36
|
+
debug_inspector (>= 0.0.1)
|
37
|
+
bourne (1.4.0)
|
38
|
+
mocha (~> 0.13.2)
|
38
39
|
builder (3.0.4)
|
39
|
-
capybara (1.1.
|
40
|
+
capybara (1.1.4)
|
40
41
|
mime-types (>= 1.16)
|
41
42
|
nokogiri (>= 1.3.3)
|
42
43
|
rack (>= 1.0.0)
|
43
44
|
rack-test (>= 0.5.4)
|
44
45
|
selenium-webdriver (~> 2.0)
|
45
46
|
xpath (~> 0.1.4)
|
46
|
-
childprocess (0.3.
|
47
|
-
ffi (~> 1.0, >= 1.0.
|
47
|
+
childprocess (0.3.9)
|
48
|
+
ffi (~> 1.0, >= 1.0.11)
|
48
49
|
chromedriver-helper (0.0.5)
|
49
50
|
nokogiri
|
50
|
-
coderay (1.0.
|
51
|
+
coderay (1.0.9)
|
51
52
|
columnize (0.3.6)
|
52
|
-
cucumber (1.2.
|
53
|
+
cucumber (1.2.3)
|
53
54
|
builder (>= 2.1.2)
|
54
55
|
diff-lcs (>= 1.1.3)
|
55
|
-
gherkin (~> 2.11.
|
56
|
-
|
56
|
+
gherkin (~> 2.11.6)
|
57
|
+
multi_json (~> 1.3)
|
57
58
|
daemons (1.1.9)
|
58
59
|
database_cleaner (0.9.1)
|
59
|
-
|
60
|
+
debug_inspector (0.0.2)
|
61
|
+
debugger (1.5.0)
|
60
62
|
columnize (>= 0.3.1)
|
61
|
-
debugger-linecache (~> 1.
|
62
|
-
debugger-ruby_core_source (~> 1.
|
63
|
-
debugger-linecache (1.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
guard (1.6.1)
|
63
|
+
debugger-linecache (~> 1.2.0)
|
64
|
+
debugger-ruby_core_source (~> 1.2.0)
|
65
|
+
debugger-linecache (1.2.0)
|
66
|
+
debugger-ruby_core_source (1.2.0)
|
67
|
+
diff-lcs (1.2.1)
|
68
|
+
eventmachine (1.0.3)
|
69
|
+
ffi (1.4.0)
|
70
|
+
gherkin (2.11.6)
|
71
|
+
json (>= 1.7.6)
|
72
|
+
guard (1.6.2)
|
72
73
|
listen (>= 0.6.0)
|
73
74
|
lumberjack (>= 1.0.2)
|
74
75
|
pry (>= 0.9.10)
|
76
|
+
terminal-table (>= 1.4.3)
|
75
77
|
thor (>= 0.14.6)
|
76
|
-
guard-spork (1.
|
78
|
+
guard-spork (1.5.0)
|
77
79
|
childprocess (>= 0.2.3)
|
78
80
|
guard (>= 1.1)
|
79
81
|
spork (>= 0.8.4)
|
80
|
-
haml (
|
82
|
+
haml (4.0.0)
|
83
|
+
tilt
|
81
84
|
i18n (0.6.1)
|
82
|
-
json (1.7.
|
83
|
-
launchy (2.
|
85
|
+
json (1.7.7)
|
86
|
+
launchy (2.2.0)
|
84
87
|
addressable (~> 2.3)
|
85
|
-
|
86
|
-
|
87
|
-
websocket
|
88
|
-
listen (0.7.1)
|
89
|
-
lumberjack (1.0.2)
|
88
|
+
listen (0.7.3)
|
89
|
+
lumberjack (1.0.3)
|
90
90
|
metaclass (0.0.1)
|
91
91
|
method_source (0.8.1)
|
92
|
-
mime-types (1.
|
93
|
-
mocha (0.
|
92
|
+
mime-types (1.21)
|
93
|
+
mocha (0.13.3)
|
94
94
|
metaclass (~> 0.0.1)
|
95
|
-
multi_json (1.
|
95
|
+
multi_json (1.7.1)
|
96
96
|
mysql2 (0.3.11)
|
97
|
-
nokogiri (1.5.
|
97
|
+
nokogiri (1.5.8)
|
98
98
|
pg (0.14.1)
|
99
|
-
pry (0.9.
|
99
|
+
pry (0.9.12)
|
100
100
|
coderay (~> 1.0.5)
|
101
101
|
method_source (~> 0.8)
|
102
|
-
slop (~> 3.
|
103
|
-
pry-debugger (0.2.
|
104
|
-
debugger (~> 1.
|
102
|
+
slop (~> 3.4)
|
103
|
+
pry-debugger (0.2.2)
|
104
|
+
debugger (~> 1.3)
|
105
105
|
pry (~> 0.9.10)
|
106
106
|
pry-doc (0.4.4)
|
107
107
|
pry (>= 0.9.9.6)
|
108
108
|
yard (~> 0.8.1)
|
109
|
-
pry-stack_explorer (0.4.
|
110
|
-
binding_of_caller (
|
111
|
-
|
112
|
-
rack
|
109
|
+
pry-stack_explorer (0.4.9)
|
110
|
+
binding_of_caller (>= 0.7)
|
111
|
+
pry (~> 0.9.11)
|
112
|
+
rack (1.5.2)
|
113
|
+
rack-protection (1.5.0)
|
113
114
|
rack
|
114
115
|
rack-test (0.6.2)
|
115
116
|
rack (>= 1.0)
|
@@ -120,47 +121,48 @@ GEM
|
|
120
121
|
rest-client (>= 1.6.1)
|
121
122
|
rest-client (1.6.7)
|
122
123
|
mime-types (>= 1.16)
|
123
|
-
rspec (2.
|
124
|
-
rspec-core (~> 2.
|
125
|
-
rspec-expectations (~> 2.
|
126
|
-
rspec-mocks (~> 2.
|
127
|
-
rspec-core (2.
|
128
|
-
rspec-expectations (2.
|
129
|
-
diff-lcs (
|
130
|
-
rspec-mocks (2.
|
124
|
+
rspec (2.13.0)
|
125
|
+
rspec-core (~> 2.13.0)
|
126
|
+
rspec-expectations (~> 2.13.0)
|
127
|
+
rspec-mocks (~> 2.13.0)
|
128
|
+
rspec-core (2.13.1)
|
129
|
+
rspec-expectations (2.13.0)
|
130
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
131
|
+
rspec-mocks (2.13.0)
|
131
132
|
rubyzip (0.9.9)
|
132
|
-
selenium-webdriver (2.
|
133
|
+
selenium-webdriver (2.31.0)
|
133
134
|
childprocess (>= 0.2.5)
|
134
|
-
libwebsocket (~> 0.1.3)
|
135
135
|
multi_json (~> 1.0)
|
136
136
|
rubyzip
|
137
|
-
|
137
|
+
websocket (~> 1.0.4)
|
138
|
+
shoulda-matchers (1.5.2)
|
138
139
|
activesupport (>= 3.0.0)
|
139
|
-
bourne (~> 1.
|
140
|
+
bourne (~> 1.3)
|
140
141
|
simplecov (0.7.1)
|
141
142
|
multi_json (~> 1.0)
|
142
143
|
simplecov-html (~> 0.7.1)
|
143
144
|
simplecov-html (0.7.1)
|
144
|
-
sinatra (1.
|
145
|
-
rack (~> 1.
|
146
|
-
rack-protection (~> 1.
|
147
|
-
tilt (~> 1.3, >= 1.3.
|
145
|
+
sinatra (1.4.1)
|
146
|
+
rack (~> 1.5, >= 1.5.2)
|
147
|
+
rack-protection (~> 1.4)
|
148
|
+
tilt (~> 1.3, >= 1.3.4)
|
148
149
|
sinatra-flash (0.3.0)
|
149
150
|
sinatra (>= 1.0.0)
|
150
|
-
slop (3.
|
151
|
+
slop (3.4.4)
|
151
152
|
spork (1.0.0rc3)
|
152
|
-
sqlite3 (1.3.
|
153
|
-
|
153
|
+
sqlite3 (1.3.7)
|
154
|
+
terminal-table (1.4.5)
|
155
|
+
thin (1.5.1)
|
154
156
|
daemons (>= 1.0.9)
|
155
157
|
eventmachine (>= 0.12.6)
|
156
158
|
rack (>= 1.0.0)
|
157
|
-
thor (0.
|
158
|
-
tilt (1.3.
|
159
|
-
tzinfo (0.3.
|
160
|
-
websocket (1.0.
|
159
|
+
thor (0.17.0)
|
160
|
+
tilt (1.3.6)
|
161
|
+
tzinfo (0.3.37)
|
162
|
+
websocket (1.0.7)
|
161
163
|
xpath (0.1.4)
|
162
164
|
nokogiri (~> 1.3)
|
163
|
-
yard (0.8.
|
165
|
+
yard (0.8.5.2)
|
164
166
|
|
165
167
|
PLATFORMS
|
166
168
|
ruby
|
@@ -189,4 +191,3 @@ DEPENDENCIES
|
|
189
191
|
simplecov
|
190
192
|
spork (> 0.9.0.rc)
|
191
193
|
sqlite3
|
192
|
-
thin
|
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# REST assured
|
2
2
|
|
3
|
-
[![Build status](https://secure.travis-ci.org/artemave/REST-assured.png)](https://
|
3
|
+
[![Build status](https://secure.travis-ci.org/artemave/REST-assured.png)](https://travis-ci.org/artemave/REST-assured)
|
4
4
|
|
5
5
|
## Overview
|
6
6
|
|
@@ -28,7 +28,6 @@ You are going to need ruby >= 1.8.7 on Linux/MacOS. Also, one of sqlite3, postgr
|
|
28
28
|
gem 'sqlite3' # or mysql2 or pg
|
29
29
|
# for jruby, use 'jdbcsqlite3' and 'jdbcmysql'
|
30
30
|
|
31
|
-
gem 'thin' # to make it faster; optional
|
32
31
|
gem 'rest-assured'
|
33
32
|
|
34
33
|
# env.rb/spec_helper.rb
|
@@ -47,10 +46,6 @@ Install db client gem:
|
|
47
46
|
|
48
47
|
If using mysql/postgres, rest-assured expects database `rest_assured` to be accessible by user `root` with no password. Those are defaults and can be changed with cli options.
|
49
48
|
|
50
|
-
It is also recommended to have thin installed. This improves startup time (over default webrick) and also it works with in-memory sqlite (which webrick does not):
|
51
|
-
|
52
|
-
$ gem install thin
|
53
|
-
|
54
49
|
Then install gem and run:
|
55
50
|
|
56
51
|
$ gem install rest-assured
|
@@ -131,7 +126,7 @@ For those using REST-assured from non-ruby environments.
|
|
131
126
|
|
132
127
|
- __fullpath__ - e.g., `/some/api/object`, or with parameters in query string (useful for doubling GETs) - `/some/other/api/object?a=2&b=c`. Mandatory.
|
133
128
|
- __content__ - whatever you want this double to respond with. Optional.
|
134
|
-
- __verb__ - one of http the following http verbs: `GET`, `POST`, `PUT`, `DELETE`. Optional. `GET` is default.
|
129
|
+
- __verb__ - one of http the following http verbs: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`. Optional. `GET` is default.
|
135
130
|
- __status__ - status returned when double is requested. Optional. `200` is default.
|
136
131
|
- __response_headers__ - key/value map of headers. Optional.
|
137
132
|
|
data/bin/heroku_runner
CHANGED
data/bin/rest-assured
CHANGED
@@ -15,7 +15,7 @@ OptionParser.new do |opts|
|
|
15
15
|
user_opts[:adapter] = adapter
|
16
16
|
end
|
17
17
|
|
18
|
-
opts.on('-d', '--database FILENAME', "Either path to database file (sqlite, defaults to ./rest-assured.db) or db name (defaults to rest_assured)") do |fname|
|
18
|
+
opts.on('-d', '--database FILENAME', "Either path to database file (sqlite, defaults to ./rest-assured.db) or db name (defaults to rest_assured) or :memory: for in-memory sqlite") do |fname|
|
19
19
|
user_opts[:database] = fname
|
20
20
|
end
|
21
21
|
|
@@ -72,4 +72,12 @@ end.parse!
|
|
72
72
|
RestAssured::Config.build(user_opts)
|
73
73
|
|
74
74
|
require 'rest-assured/application'
|
75
|
-
RestAssured::Application.run!
|
75
|
+
RestAssured::Application.run!(:threaded => false, :server => 'thin') do |server|
|
76
|
+
ssl_options = {
|
77
|
+
:cert_chain_file => AppConfig.ssl_cert,
|
78
|
+
:private_key_file => AppConfig.ssl_key,
|
79
|
+
:verify_peer => false
|
80
|
+
}
|
81
|
+
server.ssl = AppConfig.ssl
|
82
|
+
server.ssl_options = ssl_options
|
83
|
+
end
|
@@ -16,7 +16,7 @@ end
|
|
16
16
|
|
17
17
|
Then /^I should be able to get json representation of that double from response$/ do
|
18
18
|
d = RestAssured::Models::Double.last
|
19
|
-
|
19
|
+
MultiJson.load( @create_a_double_response ).should == MultiJson.load( d.to_json )
|
20
20
|
end
|
21
21
|
|
22
22
|
Then /^I should get (#{CAPTURE_A_NUMBER}) in response status$/ do |status|
|
data/features/support/env.rb
CHANGED
@@ -29,9 +29,9 @@ Spork.prefork do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
Capybara.register_driver :selenium do |app|
|
33
|
-
|
34
|
-
end
|
32
|
+
# Capybara.register_driver :selenium do |app|
|
33
|
+
# Capybara::Selenium::Driver.new(app, :browser => :chrome)
|
34
|
+
# end
|
35
35
|
|
36
36
|
World(Capybara, Rack::Test::Methods, RackHeaderHack, WorldHelpers, Anticipate)
|
37
37
|
|
@@ -8,7 +8,7 @@ module WorldHelpers
|
|
8
8
|
|
9
9
|
code.sub!(/(.*)/, "\\1\nENV['RACK_ENV'] = 'production'")
|
10
10
|
code.sub!(/require 'rest-assured\/application'/, '')
|
11
|
-
code.sub!(/RestAssured::Application.run
|
11
|
+
code.sub!(/RestAssured::Application.run!.*/m, 'puts AppConfig.to_yaml')
|
12
12
|
|
13
13
|
new_exec = "#{rest_assured_exec}_temp"
|
14
14
|
File.open(new_exec, 'w') do |file|
|
data/lib/rest-assured/config.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'logger'
|
2
2
|
require 'active_record'
|
3
3
|
require 'active_support/core_ext/kernel/reporting'
|
4
|
-
require 'webrick'
|
5
|
-
require 'webrick/https'
|
6
4
|
|
7
5
|
module RestAssured
|
8
6
|
module Config
|
@@ -46,7 +44,6 @@ module RestAssured
|
|
46
44
|
def self.included(klass)
|
47
45
|
init_logger
|
48
46
|
setup_db
|
49
|
-
setup_ssl(klass) if AppConfig.ssl
|
50
47
|
|
51
48
|
klass.set :port, AppConfig.port
|
52
49
|
klass.set :environment, AppConfig.environment
|
@@ -69,19 +66,6 @@ module RestAssured
|
|
69
66
|
|
70
67
|
private
|
71
68
|
|
72
|
-
def self.setup_ssl(klass)
|
73
|
-
ssl_config = {
|
74
|
-
:SSLEnable => true,
|
75
|
-
:SSLCertificate => OpenSSL::X509::Certificate.new( File.read( AppConfig.ssl_cert ) ),
|
76
|
-
:SSLPrivateKey => OpenSSL::PKey::RSA.new( File.read( AppConfig.ssl_key ) ),
|
77
|
-
:SSLCertName => [ ["CN", WEBrick::Utils::getservername] ],
|
78
|
-
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE
|
79
|
-
}
|
80
|
-
|
81
|
-
klass.set :server, %[webrick]
|
82
|
-
klass.set :webrick, ssl_config
|
83
|
-
end
|
84
|
-
|
85
69
|
def self.setup_db
|
86
70
|
setup_db_logging
|
87
71
|
connect_db
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'json'
|
2
1
|
require 'active_support/core_ext/hash/slice'
|
3
2
|
|
4
3
|
module RestAssured
|
@@ -44,7 +43,7 @@ module RestAssured
|
|
44
43
|
router.post /^\/doubles(\.json)?$/ do
|
45
44
|
begin
|
46
45
|
data = request.body.read
|
47
|
-
d =
|
46
|
+
d = MultiJson.load(data)['double']
|
48
47
|
|
49
48
|
# fix acitve resource dumbness
|
50
49
|
if d['response_headers'] and d['response_headers']['response_headers']
|
data/lib/rest-assured/version.rb
CHANGED
data/rest-assured.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = RestAssured::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ['Artem Avetisyan']
|
10
|
-
s.email = ['
|
10
|
+
s.email = ['artemave@gmail.com']
|
11
11
|
s.homepage = "https://github.com/artemave/rest-assured"
|
12
12
|
s.summary = %q{Real stubs and spies for HTTP(S) services}
|
13
13
|
#s.description = %q{TODO: Write a gem description}
|
@@ -20,12 +20,12 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.executables = ['rest-assured']
|
21
21
|
s.require_paths = ['lib']
|
22
22
|
|
23
|
-
s.add_dependency 'sinatra', '~> 1.
|
24
|
-
s.add_dependency 'childprocess', '~> 0.3
|
23
|
+
s.add_dependency 'sinatra', '~> 1.4.0'
|
24
|
+
s.add_dependency 'childprocess', '~> 0.3'
|
25
25
|
s.add_dependency 'sinatra-flash'
|
26
|
-
s.add_dependency 'haml', '
|
26
|
+
s.add_dependency 'haml', '~> 4.0'
|
27
27
|
s.add_dependency 'activerecord', '~> 3.2.0'
|
28
28
|
s.add_dependency 'activeresource', '~> 3.2.0'
|
29
|
-
s.add_dependency '
|
29
|
+
s.add_dependency 'thin', '~> 1.5'
|
30
30
|
end
|
31
31
|
|
data/spec/config_spec.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
require File.expand_path('../../lib/rest-assured/config', __FILE__)
|
2
|
-
require 'rack'
|
3
|
-
require 'openssl'
|
4
|
-
require 'webrick'
|
5
|
-
require 'enumerator'
|
6
2
|
|
7
3
|
module RestAssured
|
8
4
|
describe Config do
|
@@ -14,122 +10,7 @@ module RestAssured
|
|
14
10
|
#this is thoroughly covered in cucumber (since there it also serves documentation purposes)
|
15
11
|
end
|
16
12
|
|
17
|
-
|
18
|
-
let(:app) { mock(:app).as_null_object }
|
19
|
-
|
20
|
-
it 'initializes logger' do
|
21
|
-
Config.stub(:setup_db)
|
22
|
-
logger = double(:logger).as_null_object
|
23
|
-
AppConfig.stub(:logfile).and_return('test.log')
|
24
|
-
|
25
|
-
Logger.should_receive(:new).with('test.log').and_return(logger)
|
26
|
-
|
27
|
-
Config.included(app)
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'db setup' do
|
31
|
-
it 'connects db' do
|
32
|
-
Config.stub(:init_logger)
|
33
|
-
Config.stub(:migrate_db) # so it does not complain
|
34
|
-
AppConfig.stub(:db_config).and_return('db_config')
|
35
|
-
|
36
|
-
ActiveRecord::Base.should_receive(:establish_connection).with('db_config')
|
37
|
-
|
38
|
-
Config.included(app)
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'active_record logging' do
|
42
|
-
let(:logger) { double(:logger).as_null_object }
|
43
|
-
|
44
|
-
before do
|
45
|
-
Config.stub(:migrate_db)
|
46
|
-
Config.stub(:connect_db)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'is silenced in production' do
|
50
|
-
AppConfig.stub(:environment).and_return('production')
|
51
|
-
Logger.should_receive(:new).with(Config.dev_null).and_return(logger)
|
52
|
-
|
53
|
-
ActiveRecord::Base.should_receive(:logger=).with(logger)
|
54
|
-
|
55
|
-
Config.setup_db
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'is set to app logger for non production' do
|
59
|
-
AppConfig.stub(:environment).and_return('test')
|
60
|
-
AppConfig.stub(:logger).and_return(logger)
|
61
|
-
|
62
|
-
ActiveRecord::Base.should_receive(:logger=).with(logger)
|
63
|
-
|
64
|
-
Config.setup_db
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'runs migrations' do
|
69
|
-
Config.stub(:connect_db) # so it does not complain
|
70
|
-
|
71
|
-
ActiveRecord::Migrator.should_receive(:migrate)
|
72
|
-
|
73
|
-
Config.setup_db
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'sets up environment' do
|
78
|
-
app.should_receive(:set).with(:environment, AppConfig.environment)
|
79
|
-
Config.included(app)
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'sets up port' do
|
83
|
-
app.should_receive(:set).with(:port, AppConfig.port)
|
84
|
-
Config.included(app)
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'connects logger to application' do
|
88
|
-
logger = double(:logger).as_null_object
|
89
|
-
AppConfig.stub(:logger).and_return(logger)
|
90
|
-
|
91
|
-
app.should_receive(:enable).with(:logging)
|
92
|
-
app.should_receive(:use).with(Rack::CommonLogger, logger)
|
93
|
-
|
94
|
-
Config.included(app)
|
95
|
-
end
|
96
|
-
|
97
|
-
context 'when ssl true' do
|
98
|
-
before do
|
99
|
-
AppConfig.stub(:ssl).and_return(true)
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'makes sure only webrick can be used' do
|
103
|
-
app.should_receive(:set).with(:server, %[webrick])
|
104
|
-
Config.included(app)
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'sets up webrick ssl' do
|
108
|
-
OpenSSL::X509::Certificate.stub(:new).with( File.read( AppConfig.ssl_cert ) ).and_return('ssl_cert')
|
109
|
-
OpenSSL::PKey::RSA.stub(:new).with( File.read( AppConfig.ssl_key ) ).and_return('ssl_key')
|
110
|
-
|
111
|
-
ssl_config = {
|
112
|
-
:SSLEnable => true,
|
113
|
-
:SSLCertificate => 'ssl_cert',
|
114
|
-
:SSLPrivateKey => 'ssl_key',
|
115
|
-
:SSLCertName => [ ["CN", WEBrick::Utils::getservername] ],
|
116
|
-
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE
|
117
|
-
}
|
118
|
-
|
119
|
-
app.should_receive(:set).with(:webrick, hash_including(ssl_config))
|
120
|
-
Config.included(app)
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'does all that only if ssl true' do
|
124
|
-
AppConfig.stub(:ssl).and_return(false)
|
125
|
-
|
126
|
-
app.should_not_receive(:set).with(:webrick, anything)
|
127
|
-
Config.included(app)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
context 'cmd args array conversion' do
|
13
|
+
describe 'cmd args array conversion' do
|
133
14
|
it 'converts true values in form of "value" => ["--#{value}"]' do
|
134
15
|
Config.build(:ssl => true)
|
135
16
|
Config.to_cmdargs.should == ['--ssl']
|
data/views/doubles/index.haml
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
%td= f.status
|
25
25
|
%td.label.text-center
|
26
26
|
- if fs.size > 1
|
27
|
-
%input.active-double-toggle{:type => 'radio', :name => group, :checked => f.active, :data => {
|
27
|
+
%input.active-double-toggle{:type => 'radio', :name => group, :checked => f.active, :data => { 'double-id' => f.id }}
|
28
28
|
- else
|
29
29
|
yes
|
30
30
|
%td.edit-link.text-center.white-space-nowrap
|
@@ -42,11 +42,9 @@
|
|
42
42
|
e.stopPropagation();
|
43
43
|
|
44
44
|
$.post(
|
45
|
-
'/doubles/' + this.
|
45
|
+
'/doubles/' + $(this).data('doubleId'),
|
46
46
|
{ _method: 'put', active: 't' },
|
47
|
-
function(data) {
|
48
|
-
$.jGrowl(data);
|
49
|
-
}
|
47
|
+
function(data) { $.jGrowl(data) }
|
50
48
|
);
|
51
49
|
});
|
52
50
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-assured
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.4.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
29
|
+
version: 1.4.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: childprocess
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.3
|
37
|
+
version: '0.3'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.3
|
45
|
+
version: '0.3'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: sinatra-flash
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,17 +64,17 @@ dependencies:
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: '4.0'
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: '4.0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: activerecord
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,24 +108,24 @@ dependencies:
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 3.2.0
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
111
|
+
name: thin
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '1.5'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
none: false
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
125
|
+
version: '1.5'
|
126
126
|
description:
|
127
127
|
email:
|
128
|
-
-
|
128
|
+
- artemave@gmail.com
|
129
129
|
executables:
|
130
130
|
- rest-assured
|
131
131
|
extensions: []
|
@@ -174,7 +174,6 @@ files:
|
|
174
174
|
- features/step_definitions/ruby_api_steps.rb
|
175
175
|
- features/step_definitions/support/numeric_transforms.rb
|
176
176
|
- features/support/env.rb
|
177
|
-
- features/support/selenium-fix.rb
|
178
177
|
- features/support/test-server.rb
|
179
178
|
- features/support/world_helpers.rb
|
180
179
|
- features/web_ui/doubles.feature
|
@@ -194,7 +193,6 @@ files:
|
|
194
193
|
- lib/rest-assured/routes/response.rb
|
195
194
|
- lib/rest-assured/utils/port_explorer.rb
|
196
195
|
- lib/rest-assured/version.rb
|
197
|
-
- lib/sinatra/handler_options_patch.rb
|
198
196
|
- lib/sinatra/partials.rb
|
199
197
|
- public/css/base.css
|
200
198
|
- public/css/grid.inuit.css
|
@@ -257,9 +255,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
255
|
- - ! '>='
|
258
256
|
- !ruby/object:Gem::Version
|
259
257
|
version: '0'
|
260
|
-
segments:
|
261
|
-
- 0
|
262
|
-
hash: 2865940547805814270
|
263
258
|
requirements: []
|
264
259
|
rubyforge_project: rest-assured
|
265
260
|
rubygems_version: 1.8.23
|
@@ -282,7 +277,6 @@ test_files:
|
|
282
277
|
- features/step_definitions/ruby_api_steps.rb
|
283
278
|
- features/step_definitions/support/numeric_transforms.rb
|
284
279
|
- features/support/env.rb
|
285
|
-
- features/support/selenium-fix.rb
|
286
280
|
- features/support/test-server.rb
|
287
281
|
- features/support/world_helpers.rb
|
288
282
|
- features/web_ui/doubles.feature
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# details are here http://carol-nichols.com/2011/07/seleniumwebdrivererrorunhandlederror-ns_error_illegal_value/
|
2
|
-
class Capybara::Selenium::Driver
|
3
|
-
def find(selector)
|
4
|
-
browser.find_elements(:xpath, selector).map { |node| Capybara::Selenium::Node.new(self, node) }
|
5
|
-
rescue Selenium::WebDriver::Error::InvalidSelectorError => e
|
6
|
-
e.message =~ /nsIDOMXPathEvaluator.createNSResolver/ ? retry : raise
|
7
|
-
end
|
8
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Sinatra
|
2
|
-
class Base
|
3
|
-
class << self
|
4
|
-
def run!(options={})
|
5
|
-
set options
|
6
|
-
handler = detect_rack_handler
|
7
|
-
handler_name = handler.name.gsub(/.*::/, '')
|
8
|
-
# handler specific options use the lower case handler name as hash key, if present
|
9
|
-
handler_opts = begin
|
10
|
-
send(handler_name.downcase)
|
11
|
-
rescue NoMethodError
|
12
|
-
{}
|
13
|
-
end
|
14
|
-
puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " +
|
15
|
-
"on #{port} for #{environment} with backup from #{handler_name}" unless handler_name =~/cgi/i
|
16
|
-
handler.run self, handler_opts.merge(:Host => bind, :Port => port) do |server|
|
17
|
-
[:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } }
|
18
|
-
set :running, true
|
19
|
-
end
|
20
|
-
rescue Errno::EADDRINUSE => e
|
21
|
-
puts "== Someone is already performing on port #{port}!"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|