atributo style à tag body <body style='background-color:black;'> Criar nova action 'black' no controller Welcome @jlucasps def black render :layout => 'application_black' end
class="hero-unit"> <h1>Hello, world!</h1> <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p> <p><a href="#" class="btn btn-primary btn-large">Learn more »</a></p> </div> <div class="row-fluid"> <div class="span6"> <h2>Heading</h2> <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p> <p><a class="btn" href="#">View details »</a></p> </div><!--/span--> <div class="span6"> <h2>Heading</h2> <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p> <p><a class="btn" href="#">View details »</a></p> </div><!--/span--> </div><!--/row--> </div><!--/span--> <%= content_for :sidebar do %> <%= render :partial => 'shared/sidebar' %> <% end %>
Adicionar ao Gemfile group :test do gem 'capybara' gem rspec-rails' end Executar $ bundle install Remover diretório /test Executar $ rails g rspec:install @jlucasps
config do arquivo RSpec.configure do |config| # ## Mock Framework # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: # config.mock_with :mocha # config.mock_with :flexmock # config.mock_with :rr config.include Capybara::DSL config.include Rails.application.routes. url_helpers # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root} /spec/fixtures" # .......
about page Failure/Error: visit about_path AbstractController::ActionNotFound: The action 'about' could not be found for WelcomeController # ./spec/features/welcome/about.html.erb_spec.rb:6:in `block (2 levels) in <top (required)>' Finished in 0.19052 seconds 2 examples, 1 failure Failed examples: rspec ./spec/features/welcome/about.html.erb_spec.rb:5 # .about access about page Randomized with seed 45018 jlucasps@lotus:/media/truecrypt1/handsonrails/first_app$
require 'spec_helper' describe ".index", :type => :feature do it "access index page" do visit index_path page.should have_content("Hello, world!") end it "access public pages" do visit index_path page.should have_content("Hello, world!") click_link "About" page.should have_content("About us") click_link "Contact" page.should have_content("How to find us") click_link "Home" page.should have_content("Hello, world!") end end