Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Problems with spec

  • Loading branch information...
commit ec0cdda83d03086a1004b53a1f0381538ec4e314 1 parent a6ad535
Costa Pissaris authored
1  .rspec
... ... @@ -1 +1,2 @@
1 1 --colour
  2 +--drb
2  Gemfile
@@ -18,6 +18,7 @@ group :test do
18 18 gem 'turn', :require => false
19 19 gem 'cucumber-rails'
20 20 gem 'database_cleaner'
  21 + gem 'spork'
21 22
22 23 end
23 24
@@ -37,6 +38,7 @@ end
37 38
38 39 gem 'jquery-rails'
39 40
  41 +
40 42 group :production do
41 43 gem 'pg', '0.12.2'
42 44 end
2  Gemfile.lock
@@ -131,6 +131,7 @@ GEM
131 131 ffi (~> 1.0.9)
132 132 json_pure
133 133 rubyzip
  134 + spork (0.9.0)
134 135 sprockets (2.1.2)
135 136 hike (~> 1.2)
136 137 rack (~> 1.0)
@@ -164,6 +165,7 @@ DEPENDENCIES
164 165 rails (= 3.2.1)
165 166 rspec-rails
166 167 sass-rails (~> 3.2.3)
  168 + spork
167 169 sqlite3
168 170 turn
169 171 uglifier (>= 1.0.3)
3  app/controllers/pages_controller.rb
... ... @@ -1,11 +1,14 @@
1 1 class PagesController < ApplicationController
2 2 def home
  3 + @title = "Home"
3 4 end
4 5
5 6 def contact
  7 + @title = "Contact"
6 8 end
7 9
8 10 def about
  11 + @title = "About"
9 12 end
10 13
11 14 end
2  app/views/layouts/application.html.erb
... ... @@ -1,7 +1,7 @@
1 1 <!DOCTYPE html>
2 2 <html>
3 3 <head>
4   - <title>LadderForge</title>
  4 + <title>Ruby on Rails Tutorial Sample App | <%= @title %></title>
5 5 <%= stylesheet_link_tag "application", :media => "all" %>
6 6 <%= javascript_include_tag "application" %>
7 7 <%= csrf_meta_tags %>
9 app/views/pages/about.html.erb
... ... @@ -1,2 +1,7 @@
1   -<h1>Pages#about</h1>
2   -<p>Findmeinapp/views/pages/about.html.erb</p>
  1 +<h1>About Us</h1>
  2 +<p>
  3 + <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  4 + is a project to make a book and screencasts to teach web development
  5 + with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
  6 + is the sample application for the tutorial.
  7 +</p>
7 app/views/pages/contact.html.erb
... ... @@ -1,2 +1,5 @@
1   -<h1>Pages#contact</h1>
2   -<p>Find me in app/views/pages/contact.html.erb</p>
  1 +<h1>Contact</h1>
  2 +<p>
  3 + Contact Ruby on Rails Tutorial about the sample app at the
  4 + <a href="http://railstutorial.org/feedback">feedback page</a>.
  5 +</p>
19 app/views/pages/home.html.erb
... ... @@ -1,15 +1,6 @@
1   -<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Strict//EN"
2   -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3   -<htmllang="en"xml:lang="en"xmlns="http://www.w3.org/1999/xhtml">
4   -<head>
5   -<title>Ruby on Rails Tutorial Sample App | Home</title>
6   -</head>
7   -<body>
8   -<h1>SampleAppHome</h1>
  1 +<h1>Sample App</h1>
9 2 <p>
10   -Thisisthehomepageforthe
11   -<ahref="http://www.railstutorial.org/">RubyonRailsTutorial</a>
12   -sampleapplication.
13   -</p>
14   -</body>
15   -</html>
  3 + This is the home page for the
  4 + <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  5 + sample application.
  6 +</p>
16 bin/spork
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'spork' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('spork', 'spork')
2  config/routes.rb
... ... @@ -1,7 +1,7 @@
1 1 LadderForge::Application.routes.draw do
2 2 get "pages/home"
3   -
4 3 get "pages/contact"
  4 + get "pages/about"
5 5
6 6 resources :check_lists
7 7 resources :check_items
15 spec/controllers/pages_controller_spec.rb
@@ -2,7 +2,7 @@
2 2
3 3 describe PagesController do
4 4
5   - integrate_views
  5 + render_views
6 6
7 7 describe "GET 'home'" do
8 8 it "returns http success" do
@@ -11,8 +11,8 @@
11 11 end
12 12 it "should have the right title" do
13 13 get 'home'
14   - response.shouldhave_tag("title",
15   - "Ruby on Rails Tutorial Sample App | Home")
  14 + response.should have_selector("title",
  15 + :content => "Ruby on Rails Tutorial Sample App | Home")
16 16 end
17 17 end
18 18
@@ -23,8 +23,8 @@
23 23 end
24 24 it "should have the right title" do
25 25 get 'contact'
26   - response.should have_tag("title",
27   - "Ruby on Rails Tutorial Sample App | Contact")
  26 + response.should have_selector("title",
  27 + :content => "Ruby on Rails Tutorial Sample App | Contact")
28 28 end
29 29 end
30 30
@@ -36,9 +36,10 @@
36 36
37 37 it "should have the right title" do
38 38 get 'about'
39   - response.should have_tag("title",
40   - "Ruby on Rails Tutorial Sample App | About")
  39 + response.should have_selector('title',
  40 + :content => "Ruby on Rails Tutorial Sample App | About")
41 41 end
42 42 end
43 43
44 44 end
  45 +
15 spec/helpers/pages_helper_spec.rb
... ... @@ -1,15 +0,0 @@
1   -require 'spec_helper'
2   -
3   -# Specs in this file have access to a helper object that includes
4   -# the PagesHelper. For example:
5   -#
6   -# describe PagesHelper do
7   -# describe "string concat" do
8   -# it "concats two strings with spaces" do
9   -# helper.concat_strings("this","that").should == "this that"
10   -# end
11   -# end
12   -# end
13   -describe PagesHelper do
14   - pending "add some examples to (or delete) #{__FILE__}"
15   -end
77 spec/spec_helper.rb
... ... @@ -1,32 +1,57 @@
  1 +require 'rubygems'
  2 +require 'spork'
  3 +#uncomment the following line to use spork with the debugger
  4 +#require 'spork/ext/ruby-debug'
  5 +
  6 +require 'spork'
  7 +
  8 +Spork.prefork do
  9 + # Loading more in this block will cause your tests to run faster. However,
  10 + # if you change any configuration or code from libraries loaded here, you'll
  11 + # need to restart spork for it take effect.
  12 + ENV["RAILS_ENV"] ||= 'test'
  13 + require File.expand_path("../../config/environment", __FILE__)
  14 + require 'rspec/rails'
  15 +
  16 + # Requires supporting files with custom matchers and macros, etc,
  17 + # in ./support/ and its subdirectories.
  18 + Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
  19 +
  20 + RSpec.configure do |config|
  21 + # == Mock Framework
  22 + #
  23 + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  24 + #
  25 + # config.mock_with :mocha
  26 + # config.mock_with :flexmock
  27 + # config.mock_with :rr
  28 + config.mock_with :rspec
  29 +
  30 + config.fixture_path = "#{::Rails.root}/spec/fixtures"
  31 +
  32 + # If you're not using ActiveRecord, or you'd prefer not to run each of your
  33 + # examples within a transaction, comment the following line or assign false
  34 + # instead of true.
  35 + config.use_transactional_fixtures = true
  36 + end
  37 +end
  38 +
  39 +Spork.each_run do
  40 +end
  41 +
  42 +
  43 +
  44 +
  45 +
1 46 # This file is copied to spec/ when you run 'rails generate rspec:install'
2 47 ENV["RAILS_ENV"] ||= 'test'
3 48 require File.expand_path("../../config/environment", __FILE__)
4 49 require 'rspec/rails'
5 50 require 'rspec/autorun'
  51 +require 'capybara'
  52 +require 'capybara/rspec'
  53 +require 'capybara/dsl'
  54 +
  55 +
  56 +
6 57
7   -# Requires supporting ruby files with custom matchers and macros, etc,
8   -# in spec/support/ and its subdirectories.
9   -Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
10   -
11   -RSpec.configure do |config|
12   - # ## Mock Framework
13   - #
14   - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
15   - #
16   - # config.mock_with :mocha
17   - # config.mock_with :flexmock
18   - # config.mock_with :rr
19   -
20   - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21   - config.fixture_path = "#{::Rails.root}/spec/fixtures"
22   -
23   - # If you're not using ActiveRecord, or you'd prefer not to run each of your
24   - # examples within a transaction, remove the following line or assign false
25   - # instead of true.
26   - config.use_transactional_fixtures = true
27   -
28   - # If true, the base class of anonymous controllers will be inferred
29   - # automatically. This will be the default behavior in future versions of
30   - # rspec-rails.
31   - config.infer_base_class_for_anonymous_controllers = false
32   -end
113 spec/spec_helper.rb.backup
... ... @@ -0,0 +1,113 @@
  1 +require 'rubygems'
  2 +require 'spork'
  3 +#uncomment the following line to use spork with the debugger
  4 +#require 'spork/ext/ruby-debug'
  5 +
  6 +Spork.prefork do
  7 + # Loading more in this block will cause your tests to run faster. However,
  8 + # if you change any configuration or code from libraries loaded here, you'll
  9 + # need to restart spork for it take effect.
  10 +
  11 +end
  12 +
  13 +Spork.each_run do
  14 + # This code will be run each time you run your specs.
  15 +
  16 +end
  17 +
  18 +# --- Instructions ---
  19 +# Sort the contents of this file into a Spork.prefork and a Spork.each_run
  20 +# block.
  21 +#
  22 +# The Spork.prefork block is run only once when the spork server is started.
  23 +# You typically want to place most of your (slow) initializer code in here, in
  24 +# particular, require'ing any 3rd-party gems that you don't normally modify
  25 +# during development.
  26 +#
  27 +# The Spork.each_run block is run each time you run your specs. In case you
  28 +# need to load files that tend to change during development, require them here.
  29 +# With Rails, your application modules are loaded automatically, so sometimes
  30 +# this block can remain empty.
  31 +#
  32 +# Note: You can modify files loaded *from* the Spork.each_run block without
  33 +# restarting the spork server. However, this file itself will not be reloaded,
  34 +# so if you change any of the code inside the each_run block, you still need to
  35 +# restart the server. In general, if you have non-trivial code in this file,
  36 +# it's advisable to move it into a separate file so you can easily edit it
  37 +# without restarting spork. (For example, with RSpec, you could move
  38 +# non-trivial code into a file spec/support/my_helper.rb, making sure that the
  39 +# spec/support/* files are require'd from inside the each_run block.)
  40 +#
  41 +# Any code that is left outside the two blocks will be run during preforking
  42 +# *and* during each_run -- that's probably not what you want.
  43 +#
  44 +# These instructions should self-destruct in 10 seconds. If they don't, feel
  45 +# free to delete them.
  46 +
  47 +
  48 +
  49 +
  50 +# This file is copied to spec/ when you run 'rails generate rspec:install'
  51 +ENV["RAILS_ENV"] ||= 'test'
  52 +require File.expand_path("../../config/environment", __FILE__)
  53 +require 'rspec/rails'
  54 +require 'rspec/autorun'
  55 +require 'capybara'
  56 +require 'capybara/rspec'
  57 +require 'capybara/dsl'
  58 +
  59 +
  60 +
  61 +# Requires supporting ruby files with custom matchers and macros, etc,
  62 +# in spec/support/ and its subdirectories.
  63 +Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
  64 +
  65 +module CapybaraStandalone
  66 + def self.setup
  67 + Capybara.configure do |config|
  68 + config.app_host = ENV['CAPYBARA_TEST_URL'] || 'http://localhost:3000'
  69 + config.run_server = false
  70 + config.default_driver = :selenium
  71 + end
  72 + end
  73 +end
  74 +
  75 +
  76 +RSpec.configure do |config|
  77 +
  78 + config.include Capybara
  79 +
  80 + config.before(:all) do
  81 + CapybaraStandalone.setup
  82 + end
  83 + config.after do
  84 + Capybara.reset_sessions!
  85 + Capybara.use_default_driver
  86 + end
  87 +
  88 + # ## Mock Framework
  89 + #
  90 + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  91 + #
  92 + # config.mock_with :mocha
  93 + # config.mock_with :flexmock
  94 + # config.mock_with :rr
  95 +
  96 + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  97 + config.fixture_path = "#{::Rails.root}/spec/fixtures"
  98 +
  99 + # If you're not using ActiveRecord, or you'd prefer not to run each of your
  100 + # examples within a transaction, remove the following line or assign false
  101 + # instead of true.
  102 + config.use_transactional_fixtures = true
  103 +
  104 + # If true, the base class of anonymous controllers will be inferred
  105 + # automatically. This will be the default behavior in future versions of
  106 + # rspec-rails.
  107 + config.infer_base_class_for_anonymous_controllers = false
  108 +
  109 +
  110 +
  111 +
  112 +
  113 +end
5 spec/views/pages/contact.html.erb_spec.rb
... ... @@ -1,5 +0,0 @@
1   -require 'spec_helper'
2   -
3   -describe "pages/contact.html.erb" do
4   - pending "add some examples to (or delete) #{__FILE__}"
5   -end
5 spec/views/pages/home.html.erb_spec.rb
... ... @@ -1,5 +0,0 @@
1   -require 'spec_helper'
2   -
3   -describe "pages/home.html.erb" do
4   - pending "add some examples to (or delete) #{__FILE__}"
5   -end

0 comments on commit ec0cdda

Please sign in to comment.
Something went wrong with that request. Please try again.