Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ script: "bundle exec rake test:ci"
# - RAILS_VERSION=3.0
# - RAILS_VERSION=3.1
# - RAILS_VERSION=3.2
# - RAILS_VERSION=4.0
# - UNITS=true
#
#matrix:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## X.X.X

* Rails 4 support

## 1.1.0

* Multiple window support:
Expand Down
1 change: 1 addition & 0 deletions gemfiles/capybara_1.1_ruby2.0.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem "appraisal", "~> 0.5.1"
gem "mocha", "= 0.13.3"
gem "selenium-webdriver", ">= 0"
gem "gem-release"
gem "test-unit"
gem "capybara", "~> 1.1.4"

gemspec :path=>"../"
1 change: 1 addition & 0 deletions gemfiles/capybara_2.1_ruby2.0.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem "appraisal", "~> 0.5.1"
gem "mocha", "= 0.13.3"
gem "selenium-webdriver", ">= 0"
gem "gem-release"
gem "test-unit"
gem "capybara", "~> 2.1.0"

gemspec :path=>"../"
1 change: 1 addition & 0 deletions gemfiles/capybara_2.2_ruby2.0.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem "appraisal", "~> 0.5.1"
gem "mocha", "= 0.13.3"
gem "selenium-webdriver", ">= 0"
gem "gem-release"
gem "test-unit"
gem "capybara", "~> 2.2.0"

gemspec :path=>"../"
23 changes: 11 additions & 12 deletions lib/ae_page_objects/core/application_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def recognizes?(path, url)
private

def request_for(url, method)
Rails.application.routes.request_class.new(env_for(url, method))
::Rails.application.routes.request_class.new(env_for(url, method))
end

def env_for(url, method)
Expand All @@ -68,15 +68,15 @@ def env_for(url, method)

def url_and_router(url)
url = Rack::Mount::Utils.normalize_path(url) unless url =~ %r{://}
router = Rails.application.routes.set
router = ::Rails.application.routes.set

[url, router]
end

def routes
@routes ||= begin
routes_class = Class.new do
include Rails.application.routes.url_helpers
include ::Rails.application.routes.url_helpers
end
routes_class.new
end
Expand All @@ -88,7 +88,7 @@ class Rails32 < Rails3
private
def url_and_router(url)
url = Journey::Router::Utils.normalize_path(url) unless url =~ %r{://}
router = Rails.application.routes.router
router = ::Rails.application.routes.router

[url, router]
end
Expand All @@ -100,7 +100,7 @@ class Rails4 < Rails32
def url_and_router(url)
require 'action_dispatch/journey'
url = ActionDispatch::Journey::Router::Utils.normalize_path(url) unless url =~ %r{://}
router = Rails.application.routes.router
router = ::Rails.application.routes.router

[url, router]
end
Expand Down Expand Up @@ -128,18 +128,17 @@ def generate_path(named_route, *args)

def recognizer
@recognizer ||= begin
if Rails.version =~ /\A2\.3/
if ::Rails.version =~ /\A2\.3/
Recognizer::Rails23.new
elsif Rails.version =~ /\A3\.[01]/
elsif ::Rails.version =~ /\A3\.[01]/
Recognizer::Rails3.new
elsif Rails.version =~ /\A3\.2/
elsif ::Rails.version =~ /\A3\.2/
Recognizer::Rails32.new
elsif Rails.version =~ /\A4\.[01]/
warn "[WARNING]: AePageObjects works but is not thoroughly tested against Rails 4. Caveat emptor."
elsif ::Rails.version =~ /\A4\.[01]/
Recognizer::Rails4.new
else
warn "[WARNING]: AePageObjects is not tested against Rails #{Rails.version} and may behave in an undefined manner."
Recognizer::Rails32.new
warn "[WARNING]: AePageObjects is not tested against Rails #{::Rails.version} and may behave in an undefined manner."
Recognizer::Rails4.new
end
end
end
Expand Down
16 changes: 16 additions & 0 deletions test/test_apps/4.0/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
26 changes: 26 additions & 0 deletions test/test_apps/4.0/Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
case(RUBY_VERSION)
when '1.9.3' then

appraise "capybara-1.1-ruby#{RUBY_VERSION}" do
gem 'capybara', '~> 1.1.4'
end

appraise "capybara-2.1-ruby#{RUBY_VERSION}" do
gem 'capybara', '~> 2.1.0'
end

appraise "capybara-2.2-ruby#{RUBY_VERSION}" do
gem 'capybara', '~> 2.2.0'
end

when '2.0.0' then

appraise "capybara-2.1-ruby#{RUBY_VERSION}" do
gem 'capybara', '~> 2.1.0'
end

appraise "capybara-2.2-ruby#{RUBY_VERSION}" do
gem 'capybara', '~> 2.2.0'
end

end
30 changes: 30 additions & 0 deletions test/test_apps/4.0/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.4'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.2'
gem 'jquery-rails'

gem "selenium-webdriver"
gem "mocha", "0.13.3", :require => false
gem "appraisal", "~> 0.5.1"

gem 'ae_page_objects', :path => "../../../.."

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

28 changes: 28 additions & 0 deletions test/test_apps/4.0/README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
== README

This README would normally document whatever steps are necessary to get the
application up and running.

Things you may want to cover:

* Ruby version

* System dependencies

* Configuration

* Database creation

* Database initialization

* How to run the test suite

* Services (job queues, cache servers, search engines, etc.)

* Deployment instructions

* ...


Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.
14 changes: 14 additions & 0 deletions test/test_apps/4.0/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

TestApp::Application.load_tasks

namespace :test do
Rake::TestTask.new(:selenium) do |t|
t.libs << "test"
t.pattern = 'test/selenium/**/*_test.rb'
t.verbose = true
end
end
Empty file.
16 changes: 16 additions & 0 deletions test/test_apps/4.0/app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
11 changes: 11 additions & 0 deletions test/test_apps/4.0/app/assets/javascripts/authors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.


$(function() {
$('.js-delay-show').on('click', function(event) {
setTimeout(function() {
window.location.href = event.target.getAttribute("data-href");
}, 3000);
})
})
2 changes: 2 additions & 0 deletions test/test_apps/4.0/app/assets/javascripts/books.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
13 changes: 13 additions & 0 deletions test/test_apps/4.0/app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
3 changes: 3 additions & 0 deletions test/test_apps/4.0/app/assets/stylesheets/authors.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Authors controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions test/test_apps/4.0/app/assets/stylesheets/books.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Books controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
69 changes: 69 additions & 0 deletions test/test_apps/4.0/app/assets/stylesheets/scaffolds.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}

a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}

div {
&.field, &.actions {
margin-bottom: 10px;
}
}

#notice {
color: green;
}

.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}

#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
ul li {
font-size: 12px;
list-style: square;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end
Loading