Skip to content

Commit

Permalink
fix capybara/rspec error for method visit, new gemfile and testing fo…
Browse files Browse the repository at this point in the history
…lder for views changed to requests now
  • Loading branch information
zassmin committed Apr 21, 2013
1 parent 2acf988 commit b6c1182
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--colour
--color
43 changes: 16 additions & 27 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
source 'https://rubygems.org'

gem 'rails', '3.2.11'
gem 'sqlite3'
gem 'jquery-rails'
gem 'rails', '3.2.13'
gem 'bootstrap-sass', '2.1'

group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :test do
gem 'cucumber-rails', :require => false
gem 'database_cleaner'
gem 'rspec-rails'
gem 'capybara', '1.1.2'
end

group :assets do
gem 'bootstrap-sass-rails'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
group :production do
gem 'pg', '0.12.2'
end
149 changes: 74 additions & 75 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,82 +1,72 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.11)
actionpack (= 3.2.11)
mail (~> 2.4.4)
actionpack (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.11)
activesupport (= 3.2.11)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
activerecord (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
activesupport (3.2.11)
i18n (~> 0.6)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
arel (3.0.2)
bootstrap-sass-rails (2.2.1.0)
railties (~> 3.1)
sass-rails (~> 3.1)
bootstrap-sass (2.1.0.0)
builder (3.0.4)
capybara (2.1.0)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.2)
cucumber (1.2.5)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.7)
multi_json (~> 1.3)
cucumber-rails (1.3.1)
capybara (>= 1.1.2)
cucumber (>= 1.2.0)
nokogiri (>= 1.5.0)
rails (~> 3.0)
database_cleaner (0.9.1)
diff-lcs (1.2.2)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
gherkin (2.11.8)
multi_json (~> 1.3)
ffi (1.7.0)
hike (1.2.2)
i18n (0.6.4)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.2.1)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.7.7)
mail (2.4.4)
mail (2.5.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.22)
mime-types (1.23)
multi_json (1.7.2)
nokogiri (1.5.9)
pg (0.12.2)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
Expand All @@ -85,69 +75,78 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.11)
actionmailer (= 3.2.11)
actionpack (= 3.2.11)
activerecord (= 3.2.11)
activeresource (= 3.2.11)
activesupport (= 3.2.11)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
bundler (~> 1.0)
railties (= 3.2.11)
railties (3.2.11)
actionpack (= 3.2.11)
activesupport (= 3.2.11)
railties (= 3.2.13)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.4)
rdoc (3.12.2)
json (~> 1.4)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
rspec-rails (2.13.0)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
rspec-rails (2.11.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec (~> 2.11.0)
rubyzip (0.9.9)
sass (3.2.7)
sass-rails (3.2.6)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
selenium-webdriver (2.32.1)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.7)
sqlite3 (1.3.5)
thor (0.18.1)
tilt (1.3.7)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
uglifier (2.0.1)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
xpath (2.0.0)
multi_json (>= 1.0.2)
websocket (1.0.7)
xpath (0.1.4)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
bootstrap-sass-rails
coffee-rails (~> 3.2.1)
cucumber-rails
database_cleaner
jquery-rails
rails (= 3.2.11)
rspec-rails
sass-rails (~> 3.2.3)
sqlite3
uglifier (>= 1.0.3)
bootstrap-sass (= 2.1)
capybara (= 1.1.2)
coffee-rails (= 3.2.2)
jquery-rails (= 2.0.2)
pg (= 0.12.2)
rails (= 3.2.13)
rspec-rails (= 2.11.0)
sass-rails (= 3.2.5)
sqlite3 (= 1.3.5)
uglifier (= 1.2.3)
12 changes: 11 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
module ApplicationHelper
end

# Returns the full title on a per-page basis.
def full_title(page_title)
base_title = "TicTacToe"
if page_title.empty?
base_title
else
"#{base_title} | #{page_title}"
end
end
end
7 changes: 4 additions & 3 deletions app/views/games/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<br/>
<br/>
<h1>TicTacToe is coming soon!</h1>
<div class="center hero-unit">
<h1>TicTacToe is coming soon!</h1>
<%= link_to "Start Game!", new_path, class: "btn btn-large primary" %>
</div>
5 changes: 3 additions & 2 deletions app/views/games/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% provide(:title, 'Play Game') %>
<br/>
<br/>
<h1>New Game set-up is coming soon!</h1>
<h1>Play Game</h1>
<p>it's coming soon!</p>
2 changes: 1 addition & 1 deletion app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!--<%= link_to "sample app", root_path, id: "logo" %>-->
<nav>
<ul class="nav pull-right">
<li><%= link_to "New Game", new_path %></li>
<li><%= link_to "New Game", new_path %></li>
</ul>
</nav>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>TicTacToe</title>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
Expand Down
Binary file added spec/.DS_Store
Binary file not shown.
19 changes: 19 additions & 0 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'spec_helper'
require 'application_helper'

describe 'ApplicationHelper' do

describe 'full_title' do
it 'should include the page title' do
full_title('foo').should =~ /foo/
end

it 'should include the base title' do
full_title('foo').should =~ /^TicTacToe/
end

it 'should not include a bar for the home page' do
full_title('').should_not =~ /\|/
end
end
end
30 changes: 30 additions & 0 deletions spec/requests/games_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'spec_helper'

describe "Games" do

subject { page }

shared_examples_for "all games pages" do
it { should have_selector('h1', text: heading) }
it { should have_selector('title', text: full_title(page_title)) }
end

# doesn't like visit - it's a capybara thing
describe "Index page" do
before { visit root_path }

let(:heading) { 'TicTacToe' }
let(:page_title) { '' }

it_should_behave_like "all games pages"
end

describe "New page" do
before { visit new_path }

let(:heading) { 'Play Game' }
let(:page_title) { '' }

it_should_behave_like "all games pages"
end
end
Loading

0 comments on commit b6c1182

Please sign in to comment.