bbq 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG +7 -1
- data/README.md +2 -2
- data/bbq.gemspec +1 -1
- data/lib/bbq/test_client.rb +6 -5
- data/lib/bbq/version.rb +1 -1
- data/test/dummy/app/controllers/home_controller.rb +4 -0
- data/test/dummy/config/routes.rb +1 -0
- data/test/test_helper.rb +5 -0
- data/test/unit/bbq_session_pool_test.rb +1 -1
- data/test/unit/bbq_test_client_test.rb +28 -0
- data/test/unit/bbq_test_unit_test.rb +8 -1
- data/test/unit/bbq_test_user_test.rb +2 -2
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 008a8ef2d4f50633903d790c99a6d01d7a0d4e99
|
4
|
+
data.tar.gz: 0b56fa74ab51b1175d52a2f43baf5950259d9a9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b55f0cd8ef02a7e9bb4e93c3f3145b2c6d80cbaeec088669baeefdbc063989202ab3338388bad815572fb2de6d9285fee8287ff276f8afaddf3fd14afc8db71
|
7
|
+
data.tar.gz: 1ade338defca2ce4f35c355d9a3c940f5906b971e8ec07f0f3ddfec277408d0e180919eae34e76bec0fcd0afd8479cceebd52f5e048ab5ded8d74a9b7661cc05
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1 / 2013-08-22
|
2
|
+
==================
|
3
|
+
|
4
|
+
* bugfix: Bbq::TestClient propagates NoMethodErrors from the controller of
|
5
|
+
tested app instead of rising unsupported method errors.
|
6
|
+
|
7
|
+
0.2.0 / 2013-01-06
|
2
8
|
==================
|
3
9
|
|
4
10
|
* Dropped support for Ruby 1.8.7
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# BBQ
|
2
2
|
|
3
|
-
[![Build Status](https://secure.travis-ci.org/drugpl/bbq.png)](http://travis-ci.org/drugpl/bbq) [![Dependency Status](https://gemnasium.com/drugpl/bbq.png)](https://gemnasium.com/drugpl/bbq) [![Code Climate](https://codeclimate.com/github/drugpl/bbq.png)](https://codeclimate.com/github/drugpl/bbq) [![Gem Version](https://badge.fury.io/rb/bbq.png)](http://badge.fury.io/rb/bbq)
|
3
|
+
[![Build Status](https://secure.travis-ci.org/drugpl/bbq.png)](http://travis-ci.org/drugpl/bbq) [![Dependency Status](https://gemnasium.com/drugpl/bbq.png)](https://gemnasium.com/drugpl/bbq) [![Code Climate](https://codeclimate.com/github/drugpl/bbq.png)](https://codeclimate.com/github/drugpl/bbq) [![Gem Version](https://badge.fury.io/rb/bbq.png)](http://badge.fury.io/rb/bbq)
|
4
4
|
|
5
5
|
Object oriented acceptance testing using personas.
|
6
6
|
|
@@ -16,7 +16,7 @@ Object oriented acceptance testing using personas.
|
|
16
16
|
First, add BBQ to your apps `Gemfile`:
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
gem "bbq", "0.2.
|
19
|
+
gem "bbq", "0.2.1"
|
20
20
|
```
|
21
21
|
|
22
22
|
Run install generator:
|
data/bbq.gemspec
CHANGED
@@ -28,5 +28,5 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency "devise", ">= 1.4.0"
|
29
29
|
s.add_development_dependency "sinatra", ">= 1.2.6"
|
30
30
|
s.add_development_dependency "rspec-rails", "~> 2.6"
|
31
|
-
s.add_development_dependency "rails", "
|
31
|
+
s.add_development_dependency "rails", "~> 3.0"
|
32
32
|
end
|
data/lib/bbq/test_client.rb
CHANGED
@@ -15,18 +15,19 @@ module Bbq
|
|
15
15
|
HTTP_METHODS.each do |method|
|
16
16
|
class_eval <<-RUBY
|
17
17
|
def #{method}(path, params = {}, headers = {})
|
18
|
-
|
18
|
+
unless driver.respond_to? :#{method}
|
19
|
+
raise UnsupportedMethodError, "Your driver does not support #{method.upcase} method"
|
20
|
+
end
|
21
|
+
|
22
|
+
response = driver.#{method}(path, params, default_headers.merge(headers))
|
19
23
|
parsed_response = parse_response(response)
|
20
24
|
yield parsed_response if block_given?
|
21
25
|
parsed_response
|
22
|
-
rescue NoMethodError
|
23
|
-
raise UnsupportedMethodError, "Your driver does not support #{method.upcase} method"
|
24
26
|
end
|
25
27
|
RUBY
|
26
28
|
end
|
27
29
|
|
28
30
|
protected
|
29
|
-
|
30
31
|
def app
|
31
32
|
@options[:app] || Bbq.app
|
32
33
|
end
|
@@ -71,7 +72,7 @@ module Bbq
|
|
71
72
|
k = k.upcase.gsub("-", "_")
|
72
73
|
k = "HTTP_#{k}" unless ["CONTENT_TYPE", "CONTENT_LENGTH"].include?(k)
|
73
74
|
{ k => v }
|
74
|
-
end.inject(:merge)
|
75
|
+
end.inject({}, :merge)
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
data/lib/bbq/version.rb
CHANGED
data/test/dummy/config/routes.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -13,5 +13,10 @@ ActiveRecord::Base.establish_connection("test")
|
|
13
13
|
ActiveRecord::Migration.verbose = false
|
14
14
|
load(File.expand_path("../dummy/db/schema.rb", __FILE__))
|
15
15
|
|
16
|
+
require 'capybara'
|
17
|
+
Capybara.register_driver :rack_test_the_other do |app|
|
18
|
+
Capybara::RackTest::Driver.new(app)
|
19
|
+
end
|
20
|
+
|
16
21
|
# Load support files
|
17
22
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
@@ -34,7 +34,7 @@ class BbqSessionPoolTest < Test::Unit::TestCase
|
|
34
34
|
def test_pool_returns_correct_driver
|
35
35
|
pool = Bbq::Session::Pool.new
|
36
36
|
pool.next(:rack_test)
|
37
|
-
pool.next(:
|
37
|
+
pool.next(:rack_test_the_other)
|
38
38
|
pool.release
|
39
39
|
|
40
40
|
assert_equal :rack_test, pool.next(:rack_test).mode
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'bbq/test_client'
|
3
|
+
|
4
|
+
class BbqTestClientTest < Test::Unit::TestCase
|
5
|
+
def test_rack_test_to_env_headers_for_empty_hash
|
6
|
+
test_client = Bbq::TestClient::RackTest.new(:app)
|
7
|
+
assert_equal({}, test_client.to_env_headers({}))
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_rack_test_to_env_headers_for_content_type_or_content_length
|
11
|
+
test_client = Bbq::TestClient::RackTest.new(:app)
|
12
|
+
result = test_client.to_env_headers({
|
13
|
+
"content-type" => "text/plain",
|
14
|
+
"content-length" => "40"
|
15
|
+
})
|
16
|
+
assert_includes(result.keys, "CONTENT_TYPE")
|
17
|
+
assert_includes(result.keys, "CONTENT_LENGTH")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_rack_test_to_env_headers_for_other_headers
|
21
|
+
test_client = Bbq::TestClient::RackTest.new(:app)
|
22
|
+
result = test_client.to_env_headers({
|
23
|
+
"silly-header" => "silly-value"
|
24
|
+
})
|
25
|
+
assert_includes(result.keys, "HTTP_SILLY_HEADER")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -136,6 +136,13 @@ class BbqTestUnitTest < Test::Unit::TestCase
|
|
136
136
|
assert_equal 7, response.body["colors"]
|
137
137
|
end
|
138
138
|
|
139
|
+
scenario 'client should propagate errors from the app' do
|
140
|
+
assert_raise NoMethodError do
|
141
|
+
client = Bbq::TestClient.new
|
142
|
+
client.get "/uh_oh"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
139
146
|
scenario 'client using driver with unsupported method' do
|
140
147
|
class CustomDriverClient < Bbq::TestClient
|
141
148
|
def driver
|
@@ -152,7 +159,7 @@ class BbqTestUnitTest < Test::Unit::TestCase
|
|
152
159
|
TESTUNIT
|
153
160
|
|
154
161
|
run_cmd 'ruby -Ilib -Itest/dummy/test test/dummy/test/acceptance/api_test.rb'
|
155
|
-
assert_match
|
162
|
+
assert_match /\d+ tests, \d+ assertions, 0 failures, 0 errors/, output
|
156
163
|
end
|
157
164
|
|
158
165
|
def test_session_pool
|
@@ -28,8 +28,8 @@ class BbqTestUserTest < Test::Unit::TestCase
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_driver_option
|
31
|
-
user = TestUser.new(:driver => :
|
32
|
-
assert_equal :
|
31
|
+
user = TestUser.new(:driver => :rack_test_the_other)
|
32
|
+
assert_equal :rack_test_the_other, user.page.mode
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_roles
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DRUG - Dolnośląska Grupa Użytkowników Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: rails
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 3.0
|
131
|
+
version: '3.0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ~>
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 3.0
|
138
|
+
version: '3.0'
|
139
139
|
description: Objected oriented acceptance testing for Rails, using personas.
|
140
140
|
email:
|
141
141
|
- bbq@drug.org.pl
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- test/unit/bbq_install_generator_test.rb
|
220
220
|
- test/unit/bbq_rspec_test.rb
|
221
221
|
- test/unit/bbq_session_pool_test.rb
|
222
|
+
- test/unit/bbq_test_client_test.rb
|
222
223
|
- test/unit/bbq_test_generator_test.rb
|
223
224
|
- test/unit/bbq_test_unit_test.rb
|
224
225
|
- test/unit/bbq_test_user_test.rb
|
@@ -243,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
244
|
version: '0'
|
244
245
|
requirements: []
|
245
246
|
rubyforge_project: bbq
|
246
|
-
rubygems_version: 2.0.
|
247
|
+
rubygems_version: 2.0.3
|
247
248
|
signing_key:
|
248
249
|
specification_version: 4
|
249
250
|
summary: Objected oriented acceptance testing for Rails, using personas.
|
@@ -287,6 +288,7 @@ test_files:
|
|
287
288
|
- test/unit/bbq_install_generator_test.rb
|
288
289
|
- test/unit/bbq_rspec_test.rb
|
289
290
|
- test/unit/bbq_session_pool_test.rb
|
291
|
+
- test/unit/bbq_test_client_test.rb
|
290
292
|
- test/unit/bbq_test_generator_test.rb
|
291
293
|
- test/unit/bbq_test_unit_test.rb
|
292
294
|
- test/unit/bbq_test_user_test.rb
|