* ok tests finally working. focused on websocket example next

This commit is contained in:
Seth Call 2012-09-01 15:24:51 -05:00
parent ee8919481e
commit 4f8f4f392a
10 changed files with 17 additions and 39 deletions

View File

@ -17,7 +17,7 @@ class UsersController < ApplicationController
end
def create
@user = User.new(params[:user])
@user = User.new(params[:jam_ruby_user])
if @user.save
sign_in @user
flash[:success] = "Welcome to the Sample App!"
@ -31,7 +31,7 @@ class UsersController < ApplicationController
end
def update
if @user.update_attributes(params[:user])
if @user.update_attributes(params[:jam_ruby_user])
flash[:success] = "Profile updated"
sign_in @user
redirect_to @user

View File

@ -2,7 +2,7 @@ module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title)
base_title = "Ruby on Rails Tutorial Sample App"
base_title = "Jamkazam"
if page_title.empty?
base_title
else

View File

@ -16,7 +16,7 @@
<ul class="dropdown-menu">
<li><%= link_to "Profile", current_user %></li>
<li><%= link_to "Settings", edit_user_path(current_user) %></li>
<li class="divider"></li>m
<li class="divider"></li>
<li>
<%= link_to "Sign out", signout_path, method: "delete" %>
</li>

View File

@ -1,8 +1,5 @@
<% provide(:title, 'About Us') %>
<h1>About Us</h1>
<p>
The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
is a project to make a book and screencasts to teach web development
with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
is the sample application for the tutorial.
<a href="http://www.jamkazam.com/">Jamkazam</a> is bringing musicians and fans together everywhere.
</p>

View File

@ -1,8 +0,0 @@
<li>
<%= gravatar_for user, size: 52 %>
<%= link_to user.name, user %>
<% if current_user.admin? && !current_user?(user) %>
| <%= link_to "delete", user, method: :delete,
data: { confirm: "You sure?" } %>
<% end %>
</li>

View File

@ -1,12 +1,16 @@
SampleApp::Application.routes.draw do
scope 'jam_ruby' do
# scope 'jam_ruby' do
#resources :jam_session_members
#resources :jam_sessions
resources :users, :as => nil
end
# resources :users, :as => 'jam_ruby'
# end
scope :as => 'jam_ruby' do
resources :users
end
resources :users
#resources :users
resources :sessions, only: [:new, :create, :destroy]

View File

@ -8,7 +8,7 @@ describe ApplicationHelper do
end
it "should includes the base name" do
full_title("foo").should =~ /^Ruby on Rails Tutorial Sample App/
full_title("foo").should =~ /^Jamkazam/
end
it "should not include a bar for the home page" do

View File

@ -100,16 +100,6 @@ describe "Authentication" do
before { visit users_path }
it { should have_selector('title', text: 'Sign in') }
end
describe "visiting the following page" do
before { visit following_user_path(user) }
it { should have_selector('title', text: 'Sign in') }
end
describe "visiting the followers page" do
before { visit followers_user_path(user) }
it { should have_selector('title', text: 'Sign in') }
end
end
end

View File

@ -7,7 +7,7 @@ describe "Static pages" do
describe "Home page" do
before { visit root_path }
it { should have_selector('h1', text: 'Sample App') }
it { should have_selector('h1', text: 'Jam') }
it { should have_selector('title', text: full_title('')) }
it { should_not have_selector 'title', text: '| Home' }
@ -53,6 +53,6 @@ describe "Static pages" do
click_link "Sign up now!"
page.should have_selector 'title', text: full_title('Sign up')
click_link "sample app"
page.should have_selector 'h1', text: 'Sample App'
page.should have_selector 'h1', text: 'Jam'
end
end

View File

@ -45,7 +45,7 @@ describe "User pages" do
end
describe "showing the second page" do
before { visit _users_path(page: 2) }
before { visit users_path(page: 2) }
it "should list the second page of users" do
second_page.each do |user|
@ -147,11 +147,6 @@ describe "User pages" do
it { should have_link('change', href: 'http://gravatar.com/emails') }
end
describe "with invalid information" do
before { click_button "Save changes" }
it { should have_content('error') }
end
describe "with valid information" do
let(:new_name) { "New Name" }