bbq 0.2.1 → 0.3.0
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 +5 -5
- data/.travis.yml +0 -5
- data/Gemfile +5 -3
- data/bbq.gemspec +8 -9
- data/lib/bbq.rb +7 -8
- data/lib/bbq/roles.rb +2 -9
- data/lib/bbq/session.rb +3 -58
- data/lib/bbq/test_client.rb +2 -92
- data/lib/bbq/test_unit.rb +3 -5
- data/lib/bbq/test_user.rb +2 -30
- data/lib/bbq/version.rb +1 -1
- metadata +51 -177
- data/lib/bbq/devise.rb +0 -57
- data/lib/bbq/rails/routes.rb +0 -13
- data/lib/bbq/railtie.rb +0 -19
- data/lib/bbq/rspec.rb +0 -97
- data/lib/bbq/test_user/capybara_dsl.rb +0 -15
- data/lib/bbq/test_user/eyes.rb +0 -13
- data/lib/bbq/test_user/within.rb +0 -31
- data/lib/bbq/util.rb +0 -19
- data/lib/generators/bbq/install_generator.rb +0 -7
- data/lib/generators/bbq/test_generator.rb +0 -7
- data/lib/generators/rspec/bbq_install_generator.rb +0 -18
- data/lib/generators/rspec/bbq_test_generator.rb +0 -9
- data/lib/generators/rspec/templates/README +0 -5
- data/lib/generators/rspec/templates/bbq_spec.rb +0 -7
- data/lib/generators/rspec/templates/test_user.rb +0 -5
- data/lib/generators/test_unit/bbq_install_generator.rb +0 -18
- data/lib/generators/test_unit/bbq_test_generator.rb +0 -9
- data/lib/generators/test_unit/templates/README +0 -9
- data/lib/generators/test_unit/templates/bbq_test_case.rb +0 -7
- data/lib/generators/test_unit/templates/test_user.rb +0 -5
- data/lib/tasks/bbq.rake +0 -15
- data/test/dope/app.rb +0 -19
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/home_controller.rb +0 -29
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/user.rb +0 -6
- data/test/dummy/app/views/home/ponycorns.html.erb +0 -13
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -46
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -3
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -26
- data/test/dummy/config/environments/production.rb +0 -49
- data/test/dummy/config/environments/test.rb +0 -35
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/devise.rb +0 -194
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -9
- data/test/dummy/db/schema.rb +0 -19
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/spec/spec_helper.rb +0 -10
- data/test/dummy/test/test_helper.rb +0 -2
- data/test/support/driver_factory.rb +0 -49
- data/test/support/helpers.rb +0 -14
- data/test/test_helper.rb +0 -22
- data/test/unit/bbq_devise_test.rb +0 -39
- data/test/unit/bbq_install_generator_test.rb +0 -35
- data/test/unit/bbq_rspec_test.rb +0 -223
- data/test/unit/bbq_session_pool_test.rb +0 -42
- data/test/unit/bbq_test_client_test.rb +0 -28
- data/test/unit/bbq_test_generator_test.rb +0 -23
- data/test/unit/bbq_test_unit_test.rb +0 -252
- data/test/unit/bbq_test_user_test.rb +0 -74
- data/test/unit/bbq_two_simultaneous_users_test.rb +0 -55
- data/test/unit/bbq_util_test.rb +0 -40
data/lib/bbq/devise.rb
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
if defined?(Devise)
|
|
2
|
-
require 'securerandom'
|
|
3
|
-
|
|
4
|
-
module Bbq
|
|
5
|
-
module Devise
|
|
6
|
-
attr_accessor :devise_authentication_key, :email, :password, :scope
|
|
7
|
-
|
|
8
|
-
def self.included(klass)
|
|
9
|
-
require 'bbq/rails/routes'
|
|
10
|
-
klass.send(:include, Bbq::Rails::Routes)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def initialize_devise
|
|
14
|
-
@devise_initialized ||= begin
|
|
15
|
-
self.devise_authentication_key = ::Devise.authentication_keys.first
|
|
16
|
-
self.email = options[devise_authentication_key.to_sym] || Bbq::Devise.next_email
|
|
17
|
-
self.password = options[:password] || Bbq::Devise.next_password
|
|
18
|
-
self.scope = ::Devise.mappings.first.second.singular.to_s
|
|
19
|
-
true
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def register
|
|
24
|
-
initialize_devise
|
|
25
|
-
visit send("new_#{scope}_registration_path")
|
|
26
|
-
fill_in "#{scope}_#{devise_authentication_key}", :with => @email
|
|
27
|
-
fill_in "#{scope}_password", :with => @password
|
|
28
|
-
fill_in "#{scope}_password_confirmation", :with => @password
|
|
29
|
-
find(:xpath, "//input[@name='commit']").click
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def login
|
|
33
|
-
initialize_devise
|
|
34
|
-
visit send("new_#{scope}_session_path")
|
|
35
|
-
fill_in "#{scope}_#{devise_authentication_key}", :with => @email
|
|
36
|
-
fill_in "#{scope}_password", :with => @password
|
|
37
|
-
find(:xpath, "//input[@name='commit']").click
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def logout
|
|
41
|
-
visit send("destroy_#{scope}_session_path")
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def register_and_login
|
|
45
|
-
register
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def self.next_email
|
|
49
|
-
"#{SecureRandom.hex(3)}@example.com"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def self.next_password
|
|
53
|
-
SecureRandom.hex(8)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
data/lib/bbq/rails/routes.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
module Bbq
|
|
2
|
-
module Rails
|
|
3
|
-
module Routes
|
|
4
|
-
def self.included(klass)
|
|
5
|
-
klass.send(:include, ::ActionDispatch::Routing::UrlFor)
|
|
6
|
-
klass.send(:include, ::Rails.application.routes.url_helpers)
|
|
7
|
-
unless ::Rails.version < "3.1"
|
|
8
|
-
klass.send(:include, ::ActionDispatch::Routing::RouteSet::MountedHelpers)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
data/lib/bbq/railtie.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require 'rails/generators'
|
|
2
|
-
|
|
3
|
-
module Bbq
|
|
4
|
-
class Railtie < Rails::Railtie
|
|
5
|
-
initializer "bqq.set_app" do
|
|
6
|
-
Bbq.app = Rails.application
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
rake_tasks do
|
|
10
|
-
load Bbq.root.join("lib/tasks/bbq.rake")
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
helper_generators = %w(test_unit rspec).collect do |test_framework|
|
|
14
|
-
["#{test_framework}:bbq_test", "#{test_framework}:bbq_install"]
|
|
15
|
-
end.flatten
|
|
16
|
-
|
|
17
|
-
Rails::Generators.hide_namespaces *helper_generators
|
|
18
|
-
end
|
|
19
|
-
end
|
data/lib/bbq/rspec.rb
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
require 'bbq'
|
|
2
|
-
require 'bbq/session'
|
|
3
|
-
require 'rspec/core'
|
|
4
|
-
require 'capybara/rspec/matchers'
|
|
5
|
-
|
|
6
|
-
module Bbq
|
|
7
|
-
module RSpecFeature
|
|
8
|
-
def self.included(base)
|
|
9
|
-
base.instance_eval do
|
|
10
|
-
alias :background :before
|
|
11
|
-
alias :scenario :it
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
module RSpecMatchers
|
|
17
|
-
extend RSpec::Matchers::DSL
|
|
18
|
-
|
|
19
|
-
matcher :see do |text|
|
|
20
|
-
chain :within do |locator|
|
|
21
|
-
@locator = locator
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
match_for_should do |page|
|
|
25
|
-
if @locator
|
|
26
|
-
page.within(@locator) do
|
|
27
|
-
page.see? text
|
|
28
|
-
end
|
|
29
|
-
else
|
|
30
|
-
page.see? text
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
match_for_should_not do |page|
|
|
35
|
-
if @locator
|
|
36
|
-
page.within(@locator) do
|
|
37
|
-
page.not_see? text
|
|
38
|
-
end
|
|
39
|
-
else
|
|
40
|
-
page.not_see? text
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
failure_message_for_should do |page|
|
|
45
|
-
body = if @locator
|
|
46
|
-
page.find(@locator).text
|
|
47
|
-
else
|
|
48
|
-
page.body
|
|
49
|
-
end
|
|
50
|
-
"expected to see #{text} in #{body}"
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
failure_message_for_should_not do |page|
|
|
54
|
-
body = if @locator
|
|
55
|
-
page.find(@locator).text
|
|
56
|
-
else
|
|
57
|
-
page.body
|
|
58
|
-
end
|
|
59
|
-
"expected not to see #{text} in #{body}"
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
class TestUser
|
|
65
|
-
include RSpec::Matchers
|
|
66
|
-
include Capybara::RSpecMatchers
|
|
67
|
-
include Bbq::RSpecMatchers
|
|
68
|
-
|
|
69
|
-
def see!(*args)
|
|
70
|
-
see?(*args).should be_true
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def not_see!(*args)
|
|
74
|
-
not_see?(*args).should be_true
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def self.feature(*args, &block)
|
|
80
|
-
options = if args.last.is_a?(Hash) then args.pop else {} end
|
|
81
|
-
options[:type] = :acceptance
|
|
82
|
-
options[:caller] ||= caller
|
|
83
|
-
args.push(options)
|
|
84
|
-
|
|
85
|
-
describe(*args, &block)
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
RSpec.configuration.include Bbq::RSpecFeature, :type => :acceptance
|
|
89
|
-
|
|
90
|
-
RSpec.configure do |config|
|
|
91
|
-
config.include Capybara::RSpecMatchers, :type => :acceptance
|
|
92
|
-
config.include Bbq::RSpecMatchers, :type => :acceptance
|
|
93
|
-
|
|
94
|
-
config.after :each, :type => :acceptance do
|
|
95
|
-
Bbq::Session.pool.release
|
|
96
|
-
end
|
|
97
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require 'capybara/dsl'
|
|
2
|
-
|
|
3
|
-
module Bbq
|
|
4
|
-
class TestUser
|
|
5
|
-
module CapybaraDsl
|
|
6
|
-
::Capybara::Session::DSL_METHODS.each do |method|
|
|
7
|
-
class_eval <<-RUBY, __FILE__, __LINE__+1
|
|
8
|
-
def #{method}(*args, &block)
|
|
9
|
-
page.#{method}(*args, &block)
|
|
10
|
-
end
|
|
11
|
-
RUBY
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
data/lib/bbq/test_user/eyes.rb
DELETED
data/lib/bbq/test_user/within.rb
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
module Bbq
|
|
2
|
-
class TestUser
|
|
3
|
-
module Within
|
|
4
|
-
METHODS_USING_WITHIN = [
|
|
5
|
-
:see?, :not_see?,
|
|
6
|
-
:attach_file, :check, :choose, :click_link_or_button, :click_button,
|
|
7
|
-
:click_link, :click_on, :fill_in, :select, :uncheck, :unselect
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
METHODS_USING_WITHIN.each do |method_name|
|
|
11
|
-
class_eval <<-RUBY
|
|
12
|
-
def #{method_name}(*args)
|
|
13
|
-
using_within(args) { super }
|
|
14
|
-
end
|
|
15
|
-
RUBY
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def using_within(args)
|
|
19
|
-
options = args.extract_options!
|
|
20
|
-
locator = options.delete(:within)
|
|
21
|
-
args.push(options) unless options.empty?
|
|
22
|
-
|
|
23
|
-
if locator
|
|
24
|
-
within(locator) { yield }
|
|
25
|
-
else
|
|
26
|
-
yield
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
data/lib/bbq/util.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require 'active_support/core_ext/string/inflections'
|
|
2
|
-
|
|
3
|
-
module Bbq
|
|
4
|
-
class Util
|
|
5
|
-
def self.find_module(name, scope = nil)
|
|
6
|
-
namespace = case scope
|
|
7
|
-
when String, Symbol
|
|
8
|
-
"::#{scope.to_s.camelize}"
|
|
9
|
-
when Class
|
|
10
|
-
"::#{scope.name}"
|
|
11
|
-
when NilClass
|
|
12
|
-
nil
|
|
13
|
-
else
|
|
14
|
-
"::#{scope.class.name}"
|
|
15
|
-
end
|
|
16
|
-
"#{namespace}::#{name.to_s.camelize}".constantize
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module Rspec
|
|
2
|
-
class BbqInstallGenerator < Rails::Generators::Base
|
|
3
|
-
source_root Bbq.root.join("lib/generators/rspec/templates")
|
|
4
|
-
|
|
5
|
-
def create_directory
|
|
6
|
-
empty_directory "spec/acceptance"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def generate_test_user
|
|
10
|
-
empty_directory "spec/support"
|
|
11
|
-
template "test_user.rb", "spec/support/test_user.rb"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def show_readme
|
|
15
|
-
readme "README" if behavior == :invoke
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module TestUnit
|
|
2
|
-
class BbqInstallGenerator < Rails::Generators::Base
|
|
3
|
-
source_root Bbq.root.join("lib/generators/test_unit/templates")
|
|
4
|
-
|
|
5
|
-
def create_directory
|
|
6
|
-
empty_directory "test/acceptance"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def generate_test_user
|
|
10
|
-
empty_directory "test/support"
|
|
11
|
-
template "test_user.rb", "test/support/test_user.rb"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def show_readme
|
|
15
|
-
readme "README" if behavior == :invoke
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
data/lib/tasks/bbq.rake
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require 'rake/testtask'
|
|
2
|
-
|
|
3
|
-
Rake::TestTask.new("test:acceptance") do |t|
|
|
4
|
-
t.libs << 'test'
|
|
5
|
-
t.pattern = 'test/acceptance/**/*_test.rb'
|
|
6
|
-
t.verbose = false
|
|
7
|
-
end if File.exists?('test/acceptance')
|
|
8
|
-
|
|
9
|
-
begin
|
|
10
|
-
require 'rspec/core/rake_task'
|
|
11
|
-
RSpec::Core::RakeTask.new('spec:acceptance') do |spec|
|
|
12
|
-
spec.pattern = FileList['spec/acceptance/**/*_spec.rb']
|
|
13
|
-
end if File.exists?('spec/acceptance')
|
|
14
|
-
rescue LoadError
|
|
15
|
-
end
|
data/test/dope/app.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
gemfile = File.expand_path('../../../Gemfile', __FILE__)
|
|
3
|
-
|
|
4
|
-
raise 'could not find gemfile' unless File.exist?(gemfile)
|
|
5
|
-
ENV['BUNDLE_GEMFILE'] = gemfile
|
|
6
|
-
require 'bundler'
|
|
7
|
-
Bundler.setup
|
|
8
|
-
|
|
9
|
-
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
|
10
|
-
|
|
11
|
-
require 'sinatra'
|
|
12
|
-
|
|
13
|
-
module Dope
|
|
14
|
-
class App < ::Sinatra::Base
|
|
15
|
-
get "/" do
|
|
16
|
-
"BBQ supports sinatra"
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
data/test/dummy/Rakefile
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
3
|
-
|
|
4
|
-
require File.expand_path('../config/application', __FILE__)
|
|
5
|
-
require 'rake'
|
|
6
|
-
|
|
7
|
-
Dummy::Application.load_tasks
|