webrat-rspec-rails 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/README.markdown +0 -0
- data/Rakefile +38 -0
- data/VERSION.yml +4 -0
- data/lib/webrat_rspec_rails.rb +10 -0
- data/lib/webrat_rspec_rails/base_webrat_example_group.rb +19 -0
- data/lib/webrat_rspec_rails/extensions/action_controller_integration_runner.rb +13 -0
- data/lib/webrat_rspec_rails/extensions/action_controller_integration_test.rb +19 -0
- data/lib/webrat_rspec_rails/extensions/webrat_methods.rb +5 -0
- data/lib/webrat_rspec_rails/selenium_example_group.rb +14 -0
- data/lib/webrat_rspec_rails/webrat_example_group.rb +24 -0
- data/spec/rails_root/app/controllers/application_controller.rb +10 -0
- data/spec/rails_root/app/controllers/users_controller.rb +3 -0
- data/spec/rails_root/app/helpers/application_helper.rb +3 -0
- data/spec/rails_root/config/boot.rb +110 -0
- data/spec/rails_root/config/environment.rb +41 -0
- data/spec/rails_root/config/environments/development.rb +17 -0
- data/spec/rails_root/config/environments/production.rb +28 -0
- data/spec/rails_root/config/environments/test.rb +28 -0
- data/spec/rails_root/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_root/config/initializers/inflections.rb +10 -0
- data/spec/rails_root/config/initializers/mime_types.rb +5 -0
- data/spec/rails_root/config/initializers/new_rails_defaults.rb +19 -0
- data/spec/rails_root/config/initializers/session_store.rb +15 -0
- data/spec/rails_root/config/routes.rb +3 -0
- data/spec/rails_root/spec/selenium/selenium_example_group_spec.rb +20 -0
- data/spec/rails_root/spec/selenium/selenium_spec_helper.rb +27 -0
- data/spec/rails_root/spec/selenium_spec_suite.rb +4 -0
- data/spec/rails_root/spec/spec_helper.rb +12 -0
- data/spec/rails_root/spec/webrat/webrat_example_group_spec.rb +18 -0
- data/spec/rails_root/spec/webrat/webrat_spec_helper.rb +5 -0
- data/spec/rails_root/spec/webrat_spec_suite.rb +4 -0
- data/spec/spec_suite.rb +3 -0
- metadata +87 -0
data/CHANGES
ADDED
data/README.markdown
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "rake"
|
2
|
+
|
3
|
+
desc "Runs the Rspec suite"
|
4
|
+
task(:default) do
|
5
|
+
run_suite
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Runs the Rspec suite"
|
9
|
+
task(:spec) do
|
10
|
+
run_suite
|
11
|
+
end
|
12
|
+
|
13
|
+
def run_suite
|
14
|
+
dir = File.dirname(__FILE__)
|
15
|
+
system("ruby #{dir}/spec/spec_suite.rb") || raise("Spec Suite failed")
|
16
|
+
end
|
17
|
+
|
18
|
+
begin
|
19
|
+
require 'jeweler'
|
20
|
+
Jeweler::Tasks.new do |s|
|
21
|
+
s.name = "webrat-rspec-rails"
|
22
|
+
s.summary = "Webrat + rspec/rails integration"
|
23
|
+
s.email = "brian@pivotallabs.com"
|
24
|
+
s.homepage = "http://pivotallabs.com"
|
25
|
+
s.description = "Webrat + rspec/rails integration"
|
26
|
+
s.authors = ["Brian Takita"]
|
27
|
+
s.files = FileList[
|
28
|
+
'[A-Z]*',
|
29
|
+
'*.rb',
|
30
|
+
'lib/**/*.rb',
|
31
|
+
'spec/**/*.rb'
|
32
|
+
].to_a
|
33
|
+
s.test_files = Dir.glob('spec/*_spec.rb')
|
34
|
+
s.has_rdoc = true
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
38
|
+
end
|
data/VERSION.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
dir = File.dirname(__FILE__)
|
2
|
+
|
3
|
+
require "webrat"
|
4
|
+
|
5
|
+
require "#{dir}/webrat_rspec_rails/extensions/action_controller_integration_runner"
|
6
|
+
require "#{dir}/webrat_rspec_rails/extensions/action_controller_integration_test"
|
7
|
+
require "#{dir}/webrat_rspec_rails/extensions/webrat_methods"
|
8
|
+
require "#{dir}/webrat_rspec_rails/base_webrat_example_group"
|
9
|
+
require "#{dir}/webrat_rspec_rails/webrat_example_group"
|
10
|
+
require "#{dir}/webrat_rspec_rails/selenium_example_group"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Spec
|
2
|
+
module Rails
|
3
|
+
module Example
|
4
|
+
class BaseWebratExampleGroup < ActionController::IntegrationTest
|
5
|
+
include Spec::Matchers
|
6
|
+
include Spec::Rails::Matchers
|
7
|
+
include Spec::Rails::Mocks
|
8
|
+
|
9
|
+
def current_path
|
10
|
+
end
|
11
|
+
|
12
|
+
def html_escape(html)
|
13
|
+
ERB::Util.html_escape(html)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ActionController::Integration::Runner
|
2
|
+
# TODO: Make this a rails patch
|
3
|
+
def method_missing(sym, *args, &block)
|
4
|
+
reset! unless @integration_session
|
5
|
+
if @integration_session.respond_to?(sym)
|
6
|
+
returning @integration_session.__send__(sym, *args, &block) do
|
7
|
+
copy_session_variables!
|
8
|
+
end
|
9
|
+
else
|
10
|
+
super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class ActionController::IntegrationTest
|
2
|
+
class TestResultHack
|
3
|
+
def add_assertion
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
# TODO: For some reason IntegrationTest does not use ActiveSupport::TestCase.fixture_path, but uses its own @fixture_path
|
8
|
+
def self.fixture_path
|
9
|
+
ActiveSupport::TestCase.fixture_path
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(example_proxy, &implementation)
|
13
|
+
@_proxy = example_proxy
|
14
|
+
@_implementation = implementation
|
15
|
+
@_backtrace = caller
|
16
|
+
|
17
|
+
@_result = TestResultHack.new # This is a hack to fix an exception in Integration
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Spec::Rails::Example::SeleniumExampleGroup < Spec::Rails::Example::BaseWebratExampleGroup
|
2
|
+
self.use_transactional_fixtures = false
|
3
|
+
self.use_instantiated_fixtures = true
|
4
|
+
|
5
|
+
def current_path
|
6
|
+
selenium.location.blank? ? "" : URI.parse(selenium.location).path
|
7
|
+
end
|
8
|
+
|
9
|
+
def current_dom
|
10
|
+
Nokogiri::HTML(response.body)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
Spec::Example::ExampleGroupFactory.register(:selenium, Spec::Rails::Example::SeleniumExampleGroup)
|
14
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Spec
|
2
|
+
module Rails
|
3
|
+
module Example
|
4
|
+
class WebratExampleGroup < BaseWebratExampleGroup
|
5
|
+
def current_path
|
6
|
+
current_url.blank? ? "" : URI.parse(current_url).path
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_link(text_or_title_or_id)
|
10
|
+
current_dom.css("a").find do |link|
|
11
|
+
link.text == text_or_title_or_id ||
|
12
|
+
link["title"] == text_or_title_or_id ||
|
13
|
+
link["id"] == text_or_title_or_id
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def field_named(name, *field_types)
|
18
|
+
Webrat::Locators::FieldNamedLocator.new(webrat_session, current_dom, name, *field_types).locate
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
Spec::Example::ExampleGroupFactory.register(:webrat, Spec::Rails::Example::WebratExampleGroup)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
helper :all # include all helpers, all the time
|
6
|
+
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
+
|
8
|
+
# Scrub sensitive parameters from your log
|
9
|
+
# filter_parameter_logging :password
|
10
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
Rails::GemDependency.add_frozen_gem_path
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class GemBoot < Boot
|
52
|
+
def load_initializer
|
53
|
+
self.class.load_rubygems
|
54
|
+
load_rails_gem
|
55
|
+
require 'initializer'
|
56
|
+
end
|
57
|
+
|
58
|
+
def load_rails_gem
|
59
|
+
if version = self.class.gem_version
|
60
|
+
gem 'rails', version
|
61
|
+
else
|
62
|
+
gem 'rails'
|
63
|
+
end
|
64
|
+
rescue Gem::LoadError => load_error
|
65
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
66
|
+
exit 1
|
67
|
+
end
|
68
|
+
|
69
|
+
class << self
|
70
|
+
def rubygems_version
|
71
|
+
Gem::RubyGemsVersion rescue nil
|
72
|
+
end
|
73
|
+
|
74
|
+
def gem_version
|
75
|
+
if defined? RAILS_GEM_VERSION
|
76
|
+
RAILS_GEM_VERSION
|
77
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
78
|
+
ENV['RAILS_GEM_VERSION']
|
79
|
+
else
|
80
|
+
parse_gem_version(read_environment_rb)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def load_rubygems
|
85
|
+
require 'rubygems'
|
86
|
+
min_version = '1.3.1'
|
87
|
+
unless rubygems_version >= min_version
|
88
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
|
92
|
+
rescue LoadError
|
93
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
94
|
+
exit 1
|
95
|
+
end
|
96
|
+
|
97
|
+
def parse_gem_version(text)
|
98
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
def read_environment_rb
|
103
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# All that for this:
|
110
|
+
Rails.boot!
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file
|
2
|
+
|
3
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
4
|
+
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
|
5
|
+
|
6
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
7
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
8
|
+
|
9
|
+
Rails::Initializer.run do |config|
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Add additional load paths for your own custom dirs
|
15
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
16
|
+
|
17
|
+
# Specify gems that this application depends on and have them installed with rake gems:install
|
18
|
+
# config.gem "bj"
|
19
|
+
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
20
|
+
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
21
|
+
# config.gem "aws-s3", :lib => "aws/s3"
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Skip frameworks you're not going to use. To use Rails without a database,
|
28
|
+
# you must remove the Active Record framework.
|
29
|
+
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
30
|
+
|
31
|
+
# Activate observers that should always be running
|
32
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
33
|
+
|
34
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
35
|
+
# Run "rake -D time" for a list of tasks for finding time zone names.
|
36
|
+
config.time_zone = 'UTC'
|
37
|
+
|
38
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
39
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
40
|
+
# config.i18n.default_locale = :de
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = false
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Show full error reports and disable caching
|
12
|
+
config.action_controller.consider_all_requests_local = true
|
13
|
+
config.action_view.debug_rjs = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The production environment is meant for finished, "live" apps.
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.action_controller.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
config.action_view.cache_template_loading = true
|
11
|
+
|
12
|
+
# See everything in the log (default is :info)
|
13
|
+
# config.log_level = :debug
|
14
|
+
|
15
|
+
# Use a different logger for distributed setups
|
16
|
+
# config.logger = SyslogLogger.new
|
17
|
+
|
18
|
+
# Use a different cache store in production
|
19
|
+
# config.cache_store = :mem_cache_store
|
20
|
+
|
21
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
22
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
23
|
+
|
24
|
+
# Disable delivery errors, bad email addresses will be ignored
|
25
|
+
# config.action_mailer.raise_delivery_errors = false
|
26
|
+
|
27
|
+
# Enable threaded mode
|
28
|
+
# config.threadsafe!
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
config.action_view.cache_template_loading = true
|
16
|
+
|
17
|
+
# Disable request forgery protection in test environment
|
18
|
+
config.action_controller.allow_forgery_protection = false
|
19
|
+
|
20
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
21
|
+
# The :test delivery method accumulates sent emails in the
|
22
|
+
# ActionMailer::Base.deliveries array.
|
23
|
+
config.action_mailer.delivery_method = :test
|
24
|
+
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# These settings change the behavior of Rails 2 apps and will be defaults
|
4
|
+
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
5
|
+
|
6
|
+
if defined?(ActiveRecord)
|
7
|
+
# Include Active Record class name as root for JSON serialized output.
|
8
|
+
ActiveRecord::Base.include_root_in_json = true
|
9
|
+
|
10
|
+
# Store the full class name (including module namespace) in STI type column.
|
11
|
+
ActiveRecord::Base.store_full_sti_class = true
|
12
|
+
end
|
13
|
+
|
14
|
+
# Use ISO 8601 format for JSON serialized times and dates.
|
15
|
+
ActiveSupport.use_standard_json_time_format = true
|
16
|
+
|
17
|
+
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
18
|
+
# if you're including raw json in an HTML page.
|
19
|
+
ActiveSupport.escape_html_entities_in_json = false
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying cookie session data integrity.
|
4
|
+
# If you change this key, all old sessions will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
ActionController::Base.session = {
|
8
|
+
:key => '_rails_root_session',
|
9
|
+
:secret => '8e48647a6f8b2c48669e336090ce6490150755abc89bfe679839b03cdf274a428dae45b61de016199a872bad9aad1539568a80400ebb5cbdadf18bab36385914'
|
10
|
+
}
|
11
|
+
|
12
|
+
# Use the database for sessions instead of the cookie-based default,
|
13
|
+
# which shouldn't be used to store highly confidential information
|
14
|
+
# (create the session table with "rake db:sessions:create")
|
15
|
+
# ActionController::Base.session_store = :active_record_store
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/selenium_spec_helper")
|
2
|
+
|
3
|
+
describe Spec::Rails::Example::SeleniumExampleGroup do
|
4
|
+
describe "#describe" do
|
5
|
+
it "creates a SeleniumExampleGroup when in the webrat directory" do
|
6
|
+
is_a?(Spec::Rails::Example::SeleniumExampleGroup).should be_true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "GET /users" do
|
11
|
+
it "works" do
|
12
|
+
visit users_path
|
13
|
+
|
14
|
+
wait_for do
|
15
|
+
current_dom.text.include?("All your users are belong to us")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")
|
2
|
+
|
3
|
+
Webrat.configure do |config|
|
4
|
+
config.mode = :selenium
|
5
|
+
end
|
6
|
+
|
7
|
+
class Spec::Rails::Example::SeleniumExampleGroup
|
8
|
+
before(:suite) do
|
9
|
+
FileUtils.cd("#{RAILS_ROOT}") do
|
10
|
+
system("mongrel_rails mongrel::start -p 3001 -e test -d")
|
11
|
+
end
|
12
|
+
Timeout.timeout(10) do
|
13
|
+
loop do
|
14
|
+
begin
|
15
|
+
TCPSocket.new("localhost", "3001")
|
16
|
+
rescue => e
|
17
|
+
retry
|
18
|
+
end
|
19
|
+
break
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
after(:suite) do
|
25
|
+
system("mongrel_rails mongrel::stop")
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
dir = File.dirname(__FILE__)
|
2
|
+
require File.expand_path("#{dir}/../config/environment")
|
3
|
+
require "spec"
|
4
|
+
require "spec/rails"
|
5
|
+
require "spec/autorun"
|
6
|
+
require "fileutils"
|
7
|
+
$:.unshift(File.expand_path("#{dir}/../../../lib"))
|
8
|
+
require "webrat_rspec_rails"
|
9
|
+
|
10
|
+
Spec::Runner.configure do |config|
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/webrat_spec_helper")
|
2
|
+
|
3
|
+
describe Spec::Rails::Example::WebratExampleGroup do
|
4
|
+
describe "#describe" do
|
5
|
+
it "creates a WebratExampleGroup when in the webrat directory" do
|
6
|
+
is_a?(Spec::Rails::Example::WebratExampleGroup).should be_true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "GET /users" do
|
11
|
+
it "works" do
|
12
|
+
visit users_path
|
13
|
+
|
14
|
+
current_dom.text.should include("All your users are belong to us")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/spec/spec_suite.rb
ADDED
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: webrat-rspec-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Takita
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-04 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Webrat + rspec/rails integration
|
17
|
+
email: brian@pivotallabs.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.markdown
|
24
|
+
files:
|
25
|
+
- CHANGES
|
26
|
+
- README.markdown
|
27
|
+
- Rakefile
|
28
|
+
- VERSION.yml
|
29
|
+
- lib/webrat_rspec_rails.rb
|
30
|
+
- lib/webrat_rspec_rails/base_webrat_example_group.rb
|
31
|
+
- lib/webrat_rspec_rails/extensions/action_controller_integration_runner.rb
|
32
|
+
- lib/webrat_rspec_rails/extensions/action_controller_integration_test.rb
|
33
|
+
- lib/webrat_rspec_rails/extensions/webrat_methods.rb
|
34
|
+
- lib/webrat_rspec_rails/selenium_example_group.rb
|
35
|
+
- lib/webrat_rspec_rails/webrat_example_group.rb
|
36
|
+
- spec/rails_root/app/controllers/application_controller.rb
|
37
|
+
- spec/rails_root/app/controllers/users_controller.rb
|
38
|
+
- spec/rails_root/app/helpers/application_helper.rb
|
39
|
+
- spec/rails_root/config/boot.rb
|
40
|
+
- spec/rails_root/config/environment.rb
|
41
|
+
- spec/rails_root/config/environments/development.rb
|
42
|
+
- spec/rails_root/config/environments/production.rb
|
43
|
+
- spec/rails_root/config/environments/test.rb
|
44
|
+
- spec/rails_root/config/initializers/backtrace_silencers.rb
|
45
|
+
- spec/rails_root/config/initializers/inflections.rb
|
46
|
+
- spec/rails_root/config/initializers/mime_types.rb
|
47
|
+
- spec/rails_root/config/initializers/new_rails_defaults.rb
|
48
|
+
- spec/rails_root/config/initializers/session_store.rb
|
49
|
+
- spec/rails_root/config/routes.rb
|
50
|
+
- spec/rails_root/spec/selenium/selenium_example_group_spec.rb
|
51
|
+
- spec/rails_root/spec/selenium/selenium_spec_helper.rb
|
52
|
+
- spec/rails_root/spec/selenium_spec_suite.rb
|
53
|
+
- spec/rails_root/spec/spec_helper.rb
|
54
|
+
- spec/rails_root/spec/webrat/webrat_example_group_spec.rb
|
55
|
+
- spec/rails_root/spec/webrat/webrat_spec_helper.rb
|
56
|
+
- spec/rails_root/spec/webrat_spec_suite.rb
|
57
|
+
- spec/spec_suite.rb
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: http://pivotallabs.com
|
60
|
+
licenses: []
|
61
|
+
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options:
|
64
|
+
- --charset=UTF-8
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 1.3.5
|
83
|
+
signing_key:
|
84
|
+
specification_version: 2
|
85
|
+
summary: Webrat + rspec/rails integration
|
86
|
+
test_files: []
|
87
|
+
|