From 223eb06da23feb225d4b9100ffc8a92f67fde0de Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 15 Jul 2015 23:19:14 +0200 Subject: [PATCH] configures capybara [#4] --- Gemfile | 1 + Gemfile.lock | 9 +++++++++ app/controllers/welcome_controller.rb | 6 ++++++ app/views/welcome/index.html.erb | 1 + config/routes.rb | 2 +- spec/features/home_spec.rb | 10 ++++++++++ spec/rails_helper.rb | 2 ++ 7 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/controllers/welcome_controller.rb create mode 100644 app/views/welcome/index.html.erb create mode 100644 spec/features/home_spec.rb diff --git a/Gemfile b/Gemfile index 84005e07a..354bd58b6 100644 --- a/Gemfile +++ b/Gemfile @@ -42,5 +42,6 @@ group :development, :test do # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'rspec-rails', '~> 3.0' + gem 'capybara' end diff --git a/Gemfile.lock b/Gemfile.lock index 441af5fa2..cd1df1b04 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,6 +42,12 @@ GEM builder (3.2.2) byebug (5.0.0) columnize (= 0.9.0) + capybara (2.4.4) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) @@ -154,12 +160,15 @@ GEM binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) + xpath (2.0.0) + nokogiri (~> 1.3) PLATFORMS ruby DEPENDENCIES byebug + capybara coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb new file mode 100644 index 000000000..dd09ea984 --- /dev/null +++ b/app/controllers/welcome_controller.rb @@ -0,0 +1,6 @@ +class WelcomeController < ApplicationController + + def index + end + +end diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb new file mode 100644 index 000000000..c71238c69 --- /dev/null +++ b/app/views/welcome/index.html.erb @@ -0,0 +1 @@ +

Bienvenido al Ayuntamiento de Madrid

diff --git a/config/routes.rb b/config/routes.rb index 3f66539d5..b697a6e5e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ Rails.application.routes.draw do # See how all your routes lay out with "rake routes". # You can have the root of your site routed with "root" - # root 'welcome#index' + root 'welcome#index' # Example of regular route: # get 'products/:id' => 'catalog#view' diff --git a/spec/features/home_spec.rb b/spec/features/home_spec.rb new file mode 100644 index 000000000..0fa8b3255 --- /dev/null +++ b/spec/features/home_spec.rb @@ -0,0 +1,10 @@ +require 'rails_helper' + +feature "Home" do + + scenario "Welcome message" do + visit '/' + expect(page).to have_content 'Bienvenido al Ayuntamiento de Madrid' + end + +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 972bb3bba..5c5fedee7 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -4,6 +4,8 @@ abort("The Rails environment is running in production mode!") if Rails.env.produ require 'spec_helper' require 'rspec/rails' +require 'capybara/rails' +require 'capybara/rspec' ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config|