From 091792403a780d5cc862041282fe21a4a21a2ccb Mon Sep 17 00:00:00 2001 From: Donnie Tognazzini Date: Mon, 8 Jul 2013 23:39:26 -0700 Subject: [PATCH] shared views and controllers across test apps --- .../3.0/app/views/authors/index.html.erb | 21 ----- .../3.0/app/views/authors/show.html.erb | 5 -- .../app/controllers/application_controller.rb | 3 - .../3.1/app/controllers/authors_controller.rb | 85 ------------------- .../3.1/app/controllers/books_controller.rb | 85 ------------------- .../3.1/app/views/authors/_form.html.erb | 54 ------------ .../3.1/app/views/authors/edit.html.erb | 6 -- .../3.1/app/views/authors/new.html.erb | 5 -- .../3.1/app/views/authors/show.html.erb | 5 -- .../3.1/app/views/books/_form.html.erb | 27 ------ .../3.1/app/views/books/edit.html.erb | 6 -- .../3.1/app/views/books/index.html.erb | 21 ----- .../3.1/app/views/books/new.html.erb | 5 -- .../3.1/app/views/books/show.html.erb | 5 -- .../3.1/app/views/books/update.html.erb | 0 .../app/controllers/application_controller.rb | 3 - .../3.2/app/controllers/authors_controller.rb | 85 ------------------- .../3.2/app/controllers/books_controller.rb | 85 ------------------- .../3.2/app/views/authors/_form.html.erb | 54 ------------ .../3.2/app/views/authors/edit.html.erb | 6 -- .../3.2/app/views/authors/index.html.erb | 21 ----- .../3.2/app/views/authors/new.html.erb | 5 -- .../3.2/app/views/books/_form.html.erb | 27 ------ .../3.2/app/views/books/edit.html.erb | 6 -- .../3.2/app/views/books/index.html.erb | 21 ----- .../3.2/app/views/books/new.html.erb | 5 -- .../3.2/app/views/books/show.html.erb | 5 -- .../3.2/app/views/books/update.html.erb | 0 .../controllers/application_controller.rb | 0 .../controllers/authors_controller.rb | 2 +- .../controllers/books_controller.rb | 0 .../shared/test/fixtures/authors.yml | 9 ++ test/test_apps/shared/test/fixtures/books.yml | 7 ++ .../test/page_objects/authors/index_page.rb | 43 ++++++++++ .../test/page_objects/authors/show_page.rb | 12 +++ test/test_apps/shared/test/selenium_helper.rb | 9 +- .../views/authors/_form.html.erb | 0 .../views/authors/edit.html.erb | 0 .../views/authors/index.html.erb | 8 +- .../app => shared}/views/authors/new.html.erb | 0 .../views/authors/show.html.erb | 2 + .../app => shared}/views/books/_form.html.erb | 0 .../app => shared}/views/books/edit.html.erb | 0 .../app => shared}/views/books/index.html.erb | 0 .../app => shared}/views/books/new.html.erb | 0 .../app => shared}/views/books/show.html.erb | 0 .../views/books/update.html.erb | 0 47 files changed, 82 insertions(+), 666 deletions(-) delete mode 100644 test/test_apps/3.0/app/views/authors/index.html.erb delete mode 100644 test/test_apps/3.0/app/views/authors/show.html.erb delete mode 100644 test/test_apps/3.1/app/controllers/application_controller.rb delete mode 100644 test/test_apps/3.1/app/controllers/authors_controller.rb delete mode 100644 test/test_apps/3.1/app/controllers/books_controller.rb delete mode 100644 test/test_apps/3.1/app/views/authors/_form.html.erb delete mode 100644 test/test_apps/3.1/app/views/authors/edit.html.erb delete mode 100644 test/test_apps/3.1/app/views/authors/new.html.erb delete mode 100644 test/test_apps/3.1/app/views/authors/show.html.erb delete mode 100644 test/test_apps/3.1/app/views/books/_form.html.erb delete mode 100644 test/test_apps/3.1/app/views/books/edit.html.erb delete mode 100644 test/test_apps/3.1/app/views/books/index.html.erb delete mode 100644 test/test_apps/3.1/app/views/books/new.html.erb delete mode 100644 test/test_apps/3.1/app/views/books/show.html.erb delete mode 100644 test/test_apps/3.1/app/views/books/update.html.erb delete mode 100644 test/test_apps/3.2/app/controllers/application_controller.rb delete mode 100644 test/test_apps/3.2/app/controllers/authors_controller.rb delete mode 100644 test/test_apps/3.2/app/controllers/books_controller.rb delete mode 100644 test/test_apps/3.2/app/views/authors/_form.html.erb delete mode 100644 test/test_apps/3.2/app/views/authors/edit.html.erb delete mode 100644 test/test_apps/3.2/app/views/authors/index.html.erb delete mode 100644 test/test_apps/3.2/app/views/authors/new.html.erb delete mode 100644 test/test_apps/3.2/app/views/books/_form.html.erb delete mode 100644 test/test_apps/3.2/app/views/books/edit.html.erb delete mode 100644 test/test_apps/3.2/app/views/books/index.html.erb delete mode 100644 test/test_apps/3.2/app/views/books/new.html.erb delete mode 100644 test/test_apps/3.2/app/views/books/show.html.erb delete mode 100644 test/test_apps/3.2/app/views/books/update.html.erb rename test/test_apps/{3.0/app => shared}/controllers/application_controller.rb (100%) rename test/test_apps/{3.0/app => shared}/controllers/authors_controller.rb (97%) rename test/test_apps/{3.0/app => shared}/controllers/books_controller.rb (100%) create mode 100644 test/test_apps/shared/test/fixtures/authors.yml create mode 100644 test/test_apps/shared/test/fixtures/books.yml create mode 100644 test/test_apps/shared/test/page_objects/authors/index_page.rb create mode 100644 test/test_apps/shared/test/page_objects/authors/show_page.rb rename test/test_apps/{3.0/app => shared}/views/authors/_form.html.erb (100%) rename test/test_apps/{3.0/app => shared}/views/authors/edit.html.erb (100%) rename test/test_apps/{3.1/app => shared}/views/authors/index.html.erb (65%) rename test/test_apps/{3.0/app => shared}/views/authors/new.html.erb (100%) rename test/test_apps/{3.2/app => shared}/views/authors/show.html.erb (51%) rename test/test_apps/{3.0/app => shared}/views/books/_form.html.erb (100%) rename test/test_apps/{3.0/app => shared}/views/books/edit.html.erb (100%) rename test/test_apps/{3.0/app => shared}/views/books/index.html.erb (100%) rename test/test_apps/{3.0/app => shared}/views/books/new.html.erb (100%) rename test/test_apps/{3.0/app => shared}/views/books/show.html.erb (100%) rename test/test_apps/{3.0/app => shared}/views/books/update.html.erb (100%) diff --git a/test/test_apps/3.0/app/views/authors/index.html.erb b/test/test_apps/3.0/app/views/authors/index.html.erb deleted file mode 100644 index ea92e928..00000000 --- a/test/test_apps/3.0/app/views/authors/index.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -

Listing authors

- - - - - - - - -<% @authors.each do |author| %> - - - - - -<% end %> -
<%= link_to 'Show', author %><%= link_to 'Edit', edit_author_path(author) %><%= link_to 'Destroy', author, :confirm => 'Are you sure?', :method => :delete %>
- -
- -<%= link_to 'New Author', new_author_path %> diff --git a/test/test_apps/3.0/app/views/authors/show.html.erb b/test/test_apps/3.0/app/views/authors/show.html.erb deleted file mode 100644 index 6a3ade13..00000000 --- a/test/test_apps/3.0/app/views/authors/show.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

<%= notice %>

- - -<%= link_to 'Edit', edit_author_path(@author) %> | -<%= link_to 'Back', authors_path %> diff --git a/test/test_apps/3.1/app/controllers/application_controller.rb b/test/test_apps/3.1/app/controllers/application_controller.rb deleted file mode 100644 index e8065d95..00000000 --- a/test/test_apps/3.1/app/controllers/application_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery -end diff --git a/test/test_apps/3.1/app/controllers/authors_controller.rb b/test/test_apps/3.1/app/controllers/authors_controller.rb deleted file mode 100644 index d0b3842a..00000000 --- a/test/test_apps/3.1/app/controllers/authors_controller.rb +++ /dev/null @@ -1,85 +0,0 @@ -class AuthorsController < ApplicationController - # GET /authors - # GET /authors.json - def index - @authors = Author.all - - respond_to do |format| - format.html # index.html.erb - format.json { render :json => @authors } - end - end - - # GET /authors/1 - # GET /authors/1.json - def show - @author = Author.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render :json => @author } - end - end - - # GET /authors/new - # GET /authors/new.json - def new - @author = Author.new - @author.books.build - @author.books.build - - respond_to do |format| - format.html # new.html.erb - format.json { render :json => @author } - end - end - - # GET /authors/1/edit - def edit - @author = Author.find(params[:id]) - end - - # POST /authors - # POST /authors.json - def create - @author = Author.new(params[:author]) - - respond_to do |format| - if @author.save - format.html { redirect_to @author, :notice => 'Author was successfully created.' } - format.json { render :json => @author, :status => :created, :location => @author } - else - format.html { render :action => "new" } - format.json { render :json => @author.errors, :status => :unprocessable_entity } - end - end - end - - # PUT /authors/1 - # PUT /authors/1.json - def update - @author = Author.find(params[:id]) - - respond_to do |format| - if @author.update_attributes(params[:author]) - format.html { redirect_to @author, :notice => 'Author was successfully updated.' } - format.json { head :ok } - else - format.html { render :action => "edit" } - format.json { render :json => @author.errors, :status => :unprocessable_entity } - end - end - end - - # DELETE /authors/1 - # DELETE /authors/1.json - def destroy - @author = Author.find(params[:id]) - @author.destroy - - respond_to do |format| - format.html { redirect_to authors_url } - format.json { head :ok } - end - end -end diff --git a/test/test_apps/3.1/app/controllers/books_controller.rb b/test/test_apps/3.1/app/controllers/books_controller.rb deleted file mode 100644 index de875900..00000000 --- a/test/test_apps/3.1/app/controllers/books_controller.rb +++ /dev/null @@ -1,85 +0,0 @@ -class BooksController < ApplicationController - # GET /books - # GET /books.json - def index - @books = Book.all - - respond_to do |format| - format.html # index.html.erb - format.json { render :json => @books } - end - end - - # GET /books/1 - # GET /books/1.json - def show - @book = Book.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render :json => @book } - end - end - - # GET /books/new - # GET /books/new.json - def new - @book = Book.new - @book.build_author - @book.build_index - - respond_to do |format| - format.html # new.html.erb - format.json { render :json => @book } - end - end - - # GET /books/1/edit - def edit - @book = Book.find(params[:id]) - end - - # POST /books - # POST /books.json - def create - @book = Book.new(params[:book]) - - respond_to do |format| - if @book.save - format.html { redirect_to @book, :notice => 'Book was successfully created.' } - format.json { render :json => @book, :status => :created, :location => @book } - else - format.html { render :action => "new" } - format.json { render :json => @book.errors, :status => :unprocessable_entity } - end - end - end - - # PUT /books/1 - # PUT /books/1.json - def update - @book = Book.find(params[:id]) - - respond_to do |format| - if @book.update_attributes(params[:book]) - format.html { redirect_to @book, :notice => 'Book was successfully updated.' } - format.json { head :ok } - else - format.html { render :action => "edit" } - format.json { render :json => @book.errors, :status => :unprocessable_entity } - end - end - end - - # DELETE /books/1 - # DELETE /books/1.json - def destroy - @book = Book.find(params[:id]) - @book.destroy - - respond_to do |format| - format.html { redirect_to books_url } - format.json { head :ok } - end - end -end diff --git a/test/test_apps/3.1/app/views/authors/_form.html.erb b/test/test_apps/3.1/app/views/authors/_form.html.erb deleted file mode 100644 index 04b01478..00000000 --- a/test/test_apps/3.1/app/views/authors/_form.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -<%= javascript_tag do %> - $(function() { - $('.hide_star').on('click', function() { - $('.star').hide(); - }); - $('.show_star').on('click', function() { - $('.star').show(); - }); - $('.remove_star').on('click', function() { - $('.star').remove(); - }); - }); -<% end %> - -
- Hide Star - Show Star - Remove Star - - * -
- -<%= form_for @author do |f| %> - <% if @author.errors.any? %> -
-

<%= pluralize(@author.errors.count, "error") %> prohibited this author from being saved:

- - -
- <% end %> - - <%= f.text_field :first_name %> - <%= f.text_field :last_name %> - -
-
- <%= f.fields_for :books do |book_form| %> -
- <%= book_form.label :title %> - <%= book_form.text_field :title %> - <%= book_form.fields_for :index do |index_form| %> - <%= index_form.text_field :pages %> - <% end %> -
- <% end %> -
-
- - <%= f.submit %> -<% end %> diff --git a/test/test_apps/3.1/app/views/authors/edit.html.erb b/test/test_apps/3.1/app/views/authors/edit.html.erb deleted file mode 100644 index 6bc8c91f..00000000 --- a/test/test_apps/3.1/app/views/authors/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing author

- -<%= render 'form' %> - -<%= link_to 'Show', @author %> | -<%= link_to 'Back', authors_path %> diff --git a/test/test_apps/3.1/app/views/authors/new.html.erb b/test/test_apps/3.1/app/views/authors/new.html.erb deleted file mode 100644 index dacd1bc5..00000000 --- a/test/test_apps/3.1/app/views/authors/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New author

- -<%= render 'form' %> - -<%= link_to 'Back', authors_path %> diff --git a/test/test_apps/3.1/app/views/authors/show.html.erb b/test/test_apps/3.1/app/views/authors/show.html.erb deleted file mode 100644 index 6a3ade13..00000000 --- a/test/test_apps/3.1/app/views/authors/show.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

<%= notice %>

- - -<%= link_to 'Edit', edit_author_path(@author) %> | -<%= link_to 'Back', authors_path %> diff --git a/test/test_apps/3.1/app/views/books/_form.html.erb b/test/test_apps/3.1/app/views/books/_form.html.erb deleted file mode 100644 index e63e8ce6..00000000 --- a/test/test_apps/3.1/app/views/books/_form.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= form_for @book do |f| %> - <% if @book.errors.any? %> -
-

<%= pluralize(@book.errors.count, "error") %> prohibited this book from being saved:

- - -
- <% end %> - - - <%= f.text_field :title %> -
- <%= f.fields_for :index do |index_form| %> - <%= index_form.text_field :pages %> - <% end %> -
- - <%= f.fields_for :author do |auth_form| %> - <%= auth_form.text_field :first_name %> - <% end %> - - <%= f.submit %> -<% end %> diff --git a/test/test_apps/3.1/app/views/books/edit.html.erb b/test/test_apps/3.1/app/views/books/edit.html.erb deleted file mode 100644 index a907cb4a..00000000 --- a/test/test_apps/3.1/app/views/books/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing book

- -<%= render 'form' %> - -<%= link_to 'Show', @book %> | -<%= link_to 'Back', books_path %> diff --git a/test/test_apps/3.1/app/views/books/index.html.erb b/test/test_apps/3.1/app/views/books/index.html.erb deleted file mode 100644 index f8a699aa..00000000 --- a/test/test_apps/3.1/app/views/books/index.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -

Listing books

- - - - - - - - -<% @books.each do |book| %> - - - - - -<% end %> -
<%= link_to 'Show', book %><%= link_to 'Edit', edit_book_path(book) %><%= link_to 'Destroy', book, :confirm => 'Are you sure?', :method => :delete %>
- -
- -<%= link_to 'New Book', new_book_path %> diff --git a/test/test_apps/3.1/app/views/books/new.html.erb b/test/test_apps/3.1/app/views/books/new.html.erb deleted file mode 100644 index c9042b21..00000000 --- a/test/test_apps/3.1/app/views/books/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New book

- -<%= render 'form' %> - -<%= link_to 'Back', books_path %> diff --git a/test/test_apps/3.1/app/views/books/show.html.erb b/test/test_apps/3.1/app/views/books/show.html.erb deleted file mode 100644 index 0165bdc7..00000000 --- a/test/test_apps/3.1/app/views/books/show.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

<%= notice %>

- - -<%= link_to 'Edit', edit_book_path(@book) %> | -<%= link_to 'Back', books_path %> diff --git a/test/test_apps/3.1/app/views/books/update.html.erb b/test/test_apps/3.1/app/views/books/update.html.erb deleted file mode 100644 index e69de29b..00000000 diff --git a/test/test_apps/3.2/app/controllers/application_controller.rb b/test/test_apps/3.2/app/controllers/application_controller.rb deleted file mode 100644 index e8065d95..00000000 --- a/test/test_apps/3.2/app/controllers/application_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery -end diff --git a/test/test_apps/3.2/app/controllers/authors_controller.rb b/test/test_apps/3.2/app/controllers/authors_controller.rb deleted file mode 100644 index d0b3842a..00000000 --- a/test/test_apps/3.2/app/controllers/authors_controller.rb +++ /dev/null @@ -1,85 +0,0 @@ -class AuthorsController < ApplicationController - # GET /authors - # GET /authors.json - def index - @authors = Author.all - - respond_to do |format| - format.html # index.html.erb - format.json { render :json => @authors } - end - end - - # GET /authors/1 - # GET /authors/1.json - def show - @author = Author.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render :json => @author } - end - end - - # GET /authors/new - # GET /authors/new.json - def new - @author = Author.new - @author.books.build - @author.books.build - - respond_to do |format| - format.html # new.html.erb - format.json { render :json => @author } - end - end - - # GET /authors/1/edit - def edit - @author = Author.find(params[:id]) - end - - # POST /authors - # POST /authors.json - def create - @author = Author.new(params[:author]) - - respond_to do |format| - if @author.save - format.html { redirect_to @author, :notice => 'Author was successfully created.' } - format.json { render :json => @author, :status => :created, :location => @author } - else - format.html { render :action => "new" } - format.json { render :json => @author.errors, :status => :unprocessable_entity } - end - end - end - - # PUT /authors/1 - # PUT /authors/1.json - def update - @author = Author.find(params[:id]) - - respond_to do |format| - if @author.update_attributes(params[:author]) - format.html { redirect_to @author, :notice => 'Author was successfully updated.' } - format.json { head :ok } - else - format.html { render :action => "edit" } - format.json { render :json => @author.errors, :status => :unprocessable_entity } - end - end - end - - # DELETE /authors/1 - # DELETE /authors/1.json - def destroy - @author = Author.find(params[:id]) - @author.destroy - - respond_to do |format| - format.html { redirect_to authors_url } - format.json { head :ok } - end - end -end diff --git a/test/test_apps/3.2/app/controllers/books_controller.rb b/test/test_apps/3.2/app/controllers/books_controller.rb deleted file mode 100644 index de875900..00000000 --- a/test/test_apps/3.2/app/controllers/books_controller.rb +++ /dev/null @@ -1,85 +0,0 @@ -class BooksController < ApplicationController - # GET /books - # GET /books.json - def index - @books = Book.all - - respond_to do |format| - format.html # index.html.erb - format.json { render :json => @books } - end - end - - # GET /books/1 - # GET /books/1.json - def show - @book = Book.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render :json => @book } - end - end - - # GET /books/new - # GET /books/new.json - def new - @book = Book.new - @book.build_author - @book.build_index - - respond_to do |format| - format.html # new.html.erb - format.json { render :json => @book } - end - end - - # GET /books/1/edit - def edit - @book = Book.find(params[:id]) - end - - # POST /books - # POST /books.json - def create - @book = Book.new(params[:book]) - - respond_to do |format| - if @book.save - format.html { redirect_to @book, :notice => 'Book was successfully created.' } - format.json { render :json => @book, :status => :created, :location => @book } - else - format.html { render :action => "new" } - format.json { render :json => @book.errors, :status => :unprocessable_entity } - end - end - end - - # PUT /books/1 - # PUT /books/1.json - def update - @book = Book.find(params[:id]) - - respond_to do |format| - if @book.update_attributes(params[:book]) - format.html { redirect_to @book, :notice => 'Book was successfully updated.' } - format.json { head :ok } - else - format.html { render :action => "edit" } - format.json { render :json => @book.errors, :status => :unprocessable_entity } - end - end - end - - # DELETE /books/1 - # DELETE /books/1.json - def destroy - @book = Book.find(params[:id]) - @book.destroy - - respond_to do |format| - format.html { redirect_to books_url } - format.json { head :ok } - end - end -end diff --git a/test/test_apps/3.2/app/views/authors/_form.html.erb b/test/test_apps/3.2/app/views/authors/_form.html.erb deleted file mode 100644 index 04b01478..00000000 --- a/test/test_apps/3.2/app/views/authors/_form.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -<%= javascript_tag do %> - $(function() { - $('.hide_star').on('click', function() { - $('.star').hide(); - }); - $('.show_star').on('click', function() { - $('.star').show(); - }); - $('.remove_star').on('click', function() { - $('.star').remove(); - }); - }); -<% end %> - -
- Hide Star - Show Star - Remove Star - - * -
- -<%= form_for @author do |f| %> - <% if @author.errors.any? %> -
-

<%= pluralize(@author.errors.count, "error") %> prohibited this author from being saved:

- - -
- <% end %> - - <%= f.text_field :first_name %> - <%= f.text_field :last_name %> - -
-
- <%= f.fields_for :books do |book_form| %> -
- <%= book_form.label :title %> - <%= book_form.text_field :title %> - <%= book_form.fields_for :index do |index_form| %> - <%= index_form.text_field :pages %> - <% end %> -
- <% end %> -
-
- - <%= f.submit %> -<% end %> diff --git a/test/test_apps/3.2/app/views/authors/edit.html.erb b/test/test_apps/3.2/app/views/authors/edit.html.erb deleted file mode 100644 index 6bc8c91f..00000000 --- a/test/test_apps/3.2/app/views/authors/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing author

- -<%= render 'form' %> - -<%= link_to 'Show', @author %> | -<%= link_to 'Back', authors_path %> diff --git a/test/test_apps/3.2/app/views/authors/index.html.erb b/test/test_apps/3.2/app/views/authors/index.html.erb deleted file mode 100644 index ea92e928..00000000 --- a/test/test_apps/3.2/app/views/authors/index.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -

Listing authors

- - - - - - - - -<% @authors.each do |author| %> - - - - - -<% end %> -
<%= link_to 'Show', author %><%= link_to 'Edit', edit_author_path(author) %><%= link_to 'Destroy', author, :confirm => 'Are you sure?', :method => :delete %>
- -
- -<%= link_to 'New Author', new_author_path %> diff --git a/test/test_apps/3.2/app/views/authors/new.html.erb b/test/test_apps/3.2/app/views/authors/new.html.erb deleted file mode 100644 index dacd1bc5..00000000 --- a/test/test_apps/3.2/app/views/authors/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New author

- -<%= render 'form' %> - -<%= link_to 'Back', authors_path %> diff --git a/test/test_apps/3.2/app/views/books/_form.html.erb b/test/test_apps/3.2/app/views/books/_form.html.erb deleted file mode 100644 index e63e8ce6..00000000 --- a/test/test_apps/3.2/app/views/books/_form.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= form_for @book do |f| %> - <% if @book.errors.any? %> -
-

<%= pluralize(@book.errors.count, "error") %> prohibited this book from being saved:

- - -
- <% end %> - - - <%= f.text_field :title %> -
- <%= f.fields_for :index do |index_form| %> - <%= index_form.text_field :pages %> - <% end %> -
- - <%= f.fields_for :author do |auth_form| %> - <%= auth_form.text_field :first_name %> - <% end %> - - <%= f.submit %> -<% end %> diff --git a/test/test_apps/3.2/app/views/books/edit.html.erb b/test/test_apps/3.2/app/views/books/edit.html.erb deleted file mode 100644 index a907cb4a..00000000 --- a/test/test_apps/3.2/app/views/books/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing book

- -<%= render 'form' %> - -<%= link_to 'Show', @book %> | -<%= link_to 'Back', books_path %> diff --git a/test/test_apps/3.2/app/views/books/index.html.erb b/test/test_apps/3.2/app/views/books/index.html.erb deleted file mode 100644 index f8a699aa..00000000 --- a/test/test_apps/3.2/app/views/books/index.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -

Listing books

- - - - - - - - -<% @books.each do |book| %> - - - - - -<% end %> -
<%= link_to 'Show', book %><%= link_to 'Edit', edit_book_path(book) %><%= link_to 'Destroy', book, :confirm => 'Are you sure?', :method => :delete %>
- -
- -<%= link_to 'New Book', new_book_path %> diff --git a/test/test_apps/3.2/app/views/books/new.html.erb b/test/test_apps/3.2/app/views/books/new.html.erb deleted file mode 100644 index c9042b21..00000000 --- a/test/test_apps/3.2/app/views/books/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New book

- -<%= render 'form' %> - -<%= link_to 'Back', books_path %> diff --git a/test/test_apps/3.2/app/views/books/show.html.erb b/test/test_apps/3.2/app/views/books/show.html.erb deleted file mode 100644 index 0165bdc7..00000000 --- a/test/test_apps/3.2/app/views/books/show.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

<%= notice %>

- - -<%= link_to 'Edit', edit_book_path(@book) %> | -<%= link_to 'Back', books_path %> diff --git a/test/test_apps/3.2/app/views/books/update.html.erb b/test/test_apps/3.2/app/views/books/update.html.erb deleted file mode 100644 index e69de29b..00000000 diff --git a/test/test_apps/3.0/app/controllers/application_controller.rb b/test/test_apps/shared/controllers/application_controller.rb similarity index 100% rename from test/test_apps/3.0/app/controllers/application_controller.rb rename to test/test_apps/shared/controllers/application_controller.rb diff --git a/test/test_apps/3.0/app/controllers/authors_controller.rb b/test/test_apps/shared/controllers/authors_controller.rb similarity index 97% rename from test/test_apps/3.0/app/controllers/authors_controller.rb rename to test/test_apps/shared/controllers/authors_controller.rb index d0b3842a..83fe5b96 100644 --- a/test/test_apps/3.0/app/controllers/authors_controller.rb +++ b/test/test_apps/shared/controllers/authors_controller.rb @@ -2,7 +2,7 @@ class AuthorsController < ApplicationController # GET /authors # GET /authors.json def index - @authors = Author.all + @authors = Author.all(:order => :last_name) respond_to do |format| format.html # index.html.erb diff --git a/test/test_apps/3.0/app/controllers/books_controller.rb b/test/test_apps/shared/controllers/books_controller.rb similarity index 100% rename from test/test_apps/3.0/app/controllers/books_controller.rb rename to test/test_apps/shared/controllers/books_controller.rb diff --git a/test/test_apps/shared/test/fixtures/authors.yml b/test/test_apps/shared/test/fixtures/authors.yml new file mode 100644 index 00000000..d36784d8 --- /dev/null +++ b/test/test_apps/shared/test/fixtures/authors.yml @@ -0,0 +1,9 @@ +robert: + id: 1 + first_name: "Robert" + last_name: "Paulson" + +paul: + id: 2 + first_name: "Paul" + last_name: "Robertson" diff --git a/test/test_apps/shared/test/fixtures/books.yml b/test/test_apps/shared/test/fixtures/books.yml new file mode 100644 index 00000000..12c1cc34 --- /dev/null +++ b/test/test_apps/shared/test/fixtures/books.yml @@ -0,0 +1,7 @@ +roberts_book: + author_id: 1 + title: "My own name" + +pauls_book: + author_id: 2 + title: "Own thy name" \ No newline at end of file diff --git a/test/test_apps/shared/test/page_objects/authors/index_page.rb b/test/test_apps/shared/test/page_objects/authors/index_page.rb new file mode 100644 index 00000000..b9321b1e --- /dev/null +++ b/test/test_apps/shared/test/page_objects/authors/index_page.rb @@ -0,0 +1,43 @@ +module TestApp + module PageObjects + module Authors + class IndexPage < AePageObjects::Document + path :authors + + class Table < AePageObjects::Collection + self.item_class = AePageObjects::Element.new_subclass do + private + def configure(*) + super + @name = nil + end + end + + private + def configure(*) + super + @name = nil + end + end + + collection :authors, + :is => Table, + :locator => "table", + :row_xpath => "//tr" do + + element :first_name, :locator => '.first_name' + element :last_name, :locator => '.last_name' + + def show_in_new_window + node.click_link("Show In New Window") + end + + def show! + node.click_link("Show") + ShowPage.new + end + end + end + end + end +end diff --git a/test/test_apps/shared/test/page_objects/authors/show_page.rb b/test/test_apps/shared/test/page_objects/authors/show_page.rb new file mode 100644 index 00000000..0cf978ba --- /dev/null +++ b/test/test_apps/shared/test/page_objects/authors/show_page.rb @@ -0,0 +1,12 @@ +module TestApp + module PageObjects + module Authors + class ShowPage < ::AePageObjects::Document + path :author + + element :first_name + element :last_name + end + end + end +end diff --git a/test/test_apps/shared/test/selenium_helper.rb b/test/test_apps/shared/test/selenium_helper.rb index 394ca81b..ea63e546 100644 --- a/test/test_apps/shared/test/selenium_helper.rb +++ b/test/test_apps/shared/test/selenium_helper.rb @@ -18,11 +18,12 @@ module Selenium class TestCase < ActiveSupport::TestCase include Capybara::DSL include AfCruft - - # fixtures are added to ActiveSupport::TestCase when rails/test_help is required + + self.use_transactional_fixtures = true self.use_instantiated_fixtures = false - self.use_transactional_fixtures = false - + + fixtures :all + include Rails.application.routes.url_helpers end end diff --git a/test/test_apps/3.0/app/views/authors/_form.html.erb b/test/test_apps/shared/views/authors/_form.html.erb similarity index 100% rename from test/test_apps/3.0/app/views/authors/_form.html.erb rename to test/test_apps/shared/views/authors/_form.html.erb diff --git a/test/test_apps/3.0/app/views/authors/edit.html.erb b/test/test_apps/shared/views/authors/edit.html.erb similarity index 100% rename from test/test_apps/3.0/app/views/authors/edit.html.erb rename to test/test_apps/shared/views/authors/edit.html.erb diff --git a/test/test_apps/3.1/app/views/authors/index.html.erb b/test/test_apps/shared/views/authors/index.html.erb similarity index 65% rename from test/test_apps/3.1/app/views/authors/index.html.erb rename to test/test_apps/shared/views/authors/index.html.erb index ea92e928..375060e5 100644 --- a/test/test_apps/3.1/app/views/authors/index.html.erb +++ b/test/test_apps/shared/views/authors/index.html.erb @@ -1,15 +1,13 @@

Listing authors

- - - - - <% @authors.each do |author| %> + + + diff --git a/test/test_apps/3.0/app/views/authors/new.html.erb b/test/test_apps/shared/views/authors/new.html.erb similarity index 100% rename from test/test_apps/3.0/app/views/authors/new.html.erb rename to test/test_apps/shared/views/authors/new.html.erb diff --git a/test/test_apps/3.2/app/views/authors/show.html.erb b/test/test_apps/shared/views/authors/show.html.erb similarity index 51% rename from test/test_apps/3.2/app/views/authors/show.html.erb rename to test/test_apps/shared/views/authors/show.html.erb index 6a3ade13..a2e0f55a 100644 --- a/test/test_apps/3.2/app/views/authors/show.html.erb +++ b/test/test_apps/shared/views/authors/show.html.erb @@ -1,5 +1,7 @@

<%= notice %>

+<%= @author.first_name %>
+<%= @author.last_name %> <%= link_to 'Edit', edit_author_path(@author) %> | <%= link_to 'Back', authors_path %> diff --git a/test/test_apps/3.0/app/views/books/_form.html.erb b/test/test_apps/shared/views/books/_form.html.erb similarity index 100% rename from test/test_apps/3.0/app/views/books/_form.html.erb rename to test/test_apps/shared/views/books/_form.html.erb diff --git a/test/test_apps/3.0/app/views/books/edit.html.erb b/test/test_apps/shared/views/books/edit.html.erb similarity index 100% rename from test/test_apps/3.0/app/views/books/edit.html.erb rename to test/test_apps/shared/views/books/edit.html.erb diff --git a/test/test_apps/3.0/app/views/books/index.html.erb b/test/test_apps/shared/views/books/index.html.erb similarity index 100% rename from test/test_apps/3.0/app/views/books/index.html.erb rename to test/test_apps/shared/views/books/index.html.erb diff --git a/test/test_apps/3.0/app/views/books/new.html.erb b/test/test_apps/shared/views/books/new.html.erb similarity index 100% rename from test/test_apps/3.0/app/views/books/new.html.erb rename to test/test_apps/shared/views/books/new.html.erb diff --git a/test/test_apps/3.0/app/views/books/show.html.erb b/test/test_apps/shared/views/books/show.html.erb similarity index 100% rename from test/test_apps/3.0/app/views/books/show.html.erb rename to test/test_apps/shared/views/books/show.html.erb diff --git a/test/test_apps/3.0/app/views/books/update.html.erb b/test/test_apps/shared/views/books/update.html.erb similarity index 100% rename from test/test_apps/3.0/app/views/books/update.html.erb rename to test/test_apps/shared/views/books/update.html.erb
<%= author.first_name %><%= author.last_name %> <%= link_to 'Show', author %><%= link_to 'Show In New Window', author, :target => :blank %> <%= link_to 'Edit', edit_author_path(author) %> <%= link_to 'Destroy', author, :confirm => 'Are you sure?', :method => :delete %>