Skip to content

Instantly share code, notes, and snippets.

Created January 10, 2015 19:04
Show Gist options
  • Save anonymous/26a3552479ace3e4233f to your computer and use it in GitHub Desktop.
Save anonymous/26a3552479ace3e4233f to your computer and use it in GitHub Desktop.
Simple Rails App
<h1>Sample App</h1>
<p>
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
<h1>Sample App</h1>
<p>
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.7'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# 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'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# 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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',
group: :development do
gem 'webrat'
gem 'spec_helper'
gem 'rspec', '>-3.1.0'
gem 'rspec-rails'
gem 'ZenTest', '4.4.1'
gem 'autotest-rails'
end
gem 'rspec-core'
gem 'rspec-rails'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
<h1>Sample App</h1>
<p>
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
class PagesController < ApplicationController
def home
@title="Home"
end
def contact
@title="Contact"
end
def about
@title="About"
end
end
require_relative '../spec_helper'
describe PagesController, :type => :controller do
describe "GET 'home'" do
it "should be successful" do
get 'pages/home'
response.should be_success
end
end
describe "GET 'contact'" do
it "should be successful" do
get 'pages/contact'
response.should be_success
end
end
end
require_relative '../spec_helper'
describe "PagesController", :type => :controller do
describe "GET 'home'" do
it "should be successful" do
get 'pages/home'
response.should be_success
end
end
describe "GET 'contact'" do
it "should be successful" do
get 'pages/contact'
response.should be_success
end
end
end
pcmagas@dimitris:~/Kwdikas/Ruby/Rails/sample_app$ bundle exec rspec ./spec/
Invalid gemspec in [/var/lib/gems/1.9.1/specifications/ZenTest-4.11.0.gemspec]: Illformed requirement ["< 3.0, >= 1.8"]
Invalid gemspec in [/var/lib/gems/1.9.1/specifications/ZenTest-4.11.0.gemspec]: Illformed requirement ["< 3.0, >= 1.8"]
Invalid gemspec in [/var/lib/gems/1.9.1/specifications/ZenTest-4.11.0.gemspec]: Illformed requirement ["< 3.0, >= 1.8"]
/home/pcmagas/Kwdikas/Ruby/Rails/sample_app/spec/controllers/pages_controller_spec.rb:3:in `<top (required)>': uninitialized co
nstant PagesController (NameError)
from /var/lib/gems/1.9.1/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `load'
from /var/lib/gems/1.9.1/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `block in load_spec_files'
from /var/lib/gems/1.9.1/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `each'
from /var/lib/gems/1.9.1/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105:in `load_spec_files'
from /var/lib/gems/1.9.1/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:96:in `setup'
from /var/lib/gems/1.9.1/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:84:in `run'
from /var/lib/gems/1.9.1/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in `run'
from /var/lib/gems/1.9.1/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:in `invoke'
from /var/lib/gems/1.9.1/gems/rspec-core-3.1.7/exe/rspec:4:in `<top (required)>'
from /usr/local/bin/rspec:23:in `load'
from /usr/local/bin/rspec:23:in `<main>'
Invalid gemspec in [/var/lib/gems/1.9.1/specifications/ZenTest-4.11.0.gemspec]: Illformed requirement ["< 3.0, >= 1.8"]
Invalid gemspec in [/var/lib/gems/1.9.1/specifications/ZenTest-4.11.0.gemspec]: Illformed requirement ["< 3.0, >= 1.8"]
Invalid gemspec in [/var/lib/gems/1.9.1/specifications/ZenTest-4.11.0.gemspec]: Illformed requirement ["< 3.0, >= 1.8"]
FF
Failures:
1) PagesController GET 'home' should be successful
Failure/Error: get 'pages/home'
NoMethodError:
undefined method `get' for #<RSpec::ExampleGroups::PagesController::GETHome:0x00000002343aa8>
# ./spec/controllers/pages_controller_spec.rb:6:in `block (3 levels) in <top (required)>'
2) PagesController GET 'contact' should be successful
Failure/Error: get 'pages/contact'
NoMethodError:
undefined method `get' for #<RSpec::ExampleGroups::PagesController::GETContact:0x0000000264bef8>
# ./spec/controllers/pages_controller_spec.rb:13:in `block (3 levels) in <top (required)>'
Finished in 0.00176 seconds (files took 0.21205 seconds to load)
2 examples, 2 failures
Failed examples:
rspec ./spec/controllers/pages_controller_spec.rb:5 # PagesController GET 'home' should be successful
rspec ./spec/controllers/pages_controller_spec.rb:12 # PagesController GET 'contact' should be successful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment