bbq 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f512a9b51c233f36e2200fcd837bbe0a543de1f0
4
- data.tar.gz: b7eddf0a7415cc1a7658f5352180be479f81c60a
3
+ metadata.gz: 008a8ef2d4f50633903d790c99a6d01d7a0d4e99
4
+ data.tar.gz: 0b56fa74ab51b1175d52a2f43baf5950259d9a9c
5
5
  SHA512:
6
- metadata.gz: 8762aceda8bc14c5d3fc843c3b396195f1f1eaac889d8a4ca54221f192fb78c939fe8ba1f0bbde301ceb29ada7c9f814fb96f4e2b215fb9a7635873c2ea6e678
7
- data.tar.gz: b4b6afca79551d918f5fca92909e0ac054f544450c57d781ecc6716345baf0fd6d8042af0b2c624047e5bc4acf9b776d866d176d3af75a95a5aa3a306936c603
6
+ metadata.gz: 2b55f0cd8ef02a7e9bb4e93c3f3145b2c6d80cbaeec088669baeefdbc063989202ab3338388bad815572fb2de6d9285fee8287ff276f8afaddf3fd14afc8db71
7
+ data.tar.gz: 1ade338defca2ce4f35c355d9a3c940f5906b971e8ec07f0f3ddfec277408d0e180919eae34e76bec0fcd0afd8479cceebd52f5e048ab5ded8d74a9b7661cc05
@@ -1,6 +1,5 @@
1
1
  rvm:
2
2
  - 1.9.3
3
- - 1.9.2
4
3
  - 2.0.0
5
4
  - rbx-19mode
6
5
 
data/CHANGELOG CHANGED
@@ -1,4 +1,10 @@
1
- 0.2.0
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.0"
19
+ gem "bbq", "0.2.1"
20
20
  ```
21
21
 
22
22
  Run install generator:
@@ -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", ">= 3.0.0"
31
+ s.add_development_dependency "rails", "~> 3.0"
32
32
  end
@@ -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
- response = driver.send(:#{method}, path, params, default_headers.merge(headers))
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
 
@@ -1,3 +1,3 @@
1
1
  module Bbq
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -22,4 +22,8 @@ class HomeController < ApplicationController
22
22
  format.yaml { render :text => @rainbow.to_yaml }
23
23
  end
24
24
  end
25
+
26
+ def uh_oh
27
+ raise NoMethodError
28
+ end
25
29
  end
@@ -5,4 +5,5 @@ Dummy::Application.routes.draw do
5
5
  match "/miracle" => "home#miracle"
6
6
  match "/ponycorns" => "home#ponycorns"
7
7
  match "/rainbow" => "home#rainbow"
8
+ match "/uh_oh" => "home#uh_oh"
8
9
  end
@@ -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(:selenium)
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 /5 tests, \d+ assertions, 0 failures, 0 errors/, output
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 => :selenium)
32
- assert_equal :selenium, user.page.mode
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.0
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-03-07 00:00:00.000000000 Z
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.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.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.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