railstutorial.org

signed_in? function not working in Chapter 8-9 of Rails Tutorial (Hartl)

淺唱寂寞╮ 提交于 2019-12-02 11:23:33
I have one rspec test failing. 1) User pages edit with valid information should have link "Sign out", {:href=>"/signout"} Failure/Error: it { should have_link('Sign out', href: signout_path) } expected #has_link?("Sign out", {:href=>"/signout"}) to return true, got false # ./spec/requests/user_pages_spec.rb:80:in `block (4 levels) in <top (required)>' The test looks to see if a 'Sign out' link is present in the header after signing in. The code works in a browser but not in rspec. The spec in question is aligned with the Hartl tutorial: describe "User pages" do subject { page } ... describe

Bootstrap 3 navbar links display vertical when should be horizontal

▼魔方 西西 提交于 2019-12-02 08:59:37
问题 Following Michael Hartl's ruby on rails tutorial and after importing bootstrap into a custom.css.scss file the links display as a block (vertical) when they should really be horizontal causing the navbar to be really thick as shown below. So the question is what did I do wrong and how can I make the navigation horizontal using boostrap? Here's my application.html.erb layout <!DOCTYPE html> <html> <head> <title><%= full_title(yield(:title)) %></title> <%= stylesheet_link_tag "application",

Bootstrap 3 navbar links display vertical when should be horizontal

耗尽温柔 提交于 2019-12-02 06:04:51
Following Michael Hartl's ruby on rails tutorial and after importing bootstrap into a custom.css.scss file the links display as a block (vertical) when they should really be horizontal causing the navbar to be really thick as shown below. So the question is what did I do wrong and how can I make the navigation horizontal using boostrap? Here's my application.html.erb layout <!DOCTYPE html> <html> <head> <title><%= full_title(yield(:title)) %></title> <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data

Rails 3.1 link_to not showing confirmation or destroying properly

被刻印的时光 ゝ 提交于 2019-12-01 18:48:31
I've been plowing through the chapters at railstutorial.org and been using Rails 3.1.3 because I'm crazy and/or wanted a challenge. I managed to figure out most version problems easily but this one stumped me for a while. In 10.4.2, Michael Hartl uses the following code to delete users: <%= link_to "delete", user, :method => :delete, :confirm => "You sure?", :title => "Delete #{user.name}" %> It doesn't work properly if you test it in the browser (chrome) and instead sends you to that user page. It is supposed to work if you include this: <%= javascript_include_tag :defaults %> but it fails

Rspec test should pass but fails

你说的曾经没有我的故事 提交于 2019-12-01 06:33:46
问题 I have this test from michael hartl book: require 'spec_helper' describe "Static pages" do let(:base_title) { "Ruby on Rails Tutorial Sample App" } describe "Home page" do it "should have the h1 'Sample App'" do visit '/static_pages/home' page.should have_selector('h1', :text => 'Sample App') end it "should have the title 'Home'" do visit '/static_pages/home' page.should have_selector('title', :text => "#{base_title} | Home") end end end And the view: <% provide(:title, 'Home') %> <h1>Sample

Why are my RSpec tests failing, but my app is working?

▼魔方 西西 提交于 2019-12-01 03:33:47
I just finished chapter 10 of the Ruby on Rails Tutorial , adding the ability to edit/update, index, and destroy users. Everything appears to be working properly in my app, but many of my tests are failing when I run RSpec. I have the users_controller_spec set up exactly as the book does it and my application code is the same as well. Could one issue may be that I am using Rails 3.1.1 as opposed to Rails 3.0 which he uses in the book? It hasn't really been an issue for previous tests, just occasionally for a few different lines of code. The issues started appearing after I started section 10.2

Rails 4 server fails, Ruby 2.0 segmentation fault, Abort trap 6

拟墨画扇 提交于 2019-12-01 02:12:42
问题 I just started going through railstutorial.org and getting my development environment setup. When I got to the section 1.2.5 to run rails server for the fist_app, I type the command and the following printed out: $ rails server /Users/aaronpflower/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/sqlite3- < 1.3.8/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-darwin13.2.0] Then followed by 500 lines of text 0 enumerator.so 1

Hartl's sample_app warning on config.serve_static_files, and test already defined

余生颓废 提交于 2019-12-01 00:01:27
I am trying to test Hartl's sample_app and this is message that I get after running bundle exec rake test : DEPRECATION WARNING: The configuration option `config.serve_static_assets` has been renamed to `config.serve_static_files` to clarify its role (it merely enables serving everything in the `public` folder and is unrelated to the asset pipeline). The `serve_static_assets` alias will be removed in Rails 5.0. Please migrate your configuration files accordingly. (called from block in <top (required)> at /home/aki/sample_app/config/environments/test.rb:16) rake aborted! test_should_be_valid is

railstutorial.org, Chapter 6. unknown attribute: password

假装没事ソ 提交于 2019-11-30 21:09:15
I have finished Chapter 6 of railstutorial but all my User model specs have started failing soon after I added password & password_confirmation with the following errors: Failures: 1) User Failure/Error: @user = User.new(name: "Example User", email: "user@example.com", ActiveRecord::UnknownAttributeError: unknown attribute: password # ./spec/models/user_spec.rb:17:in `new' # ./spec/models/user_spec.rb:17:in `block (2 levels) in <top (required)>' 2) User Failure/Error: @user = User.new(name: "Example User", email: "user@example.com", ActiveRecord::UnknownAttributeError: unknown attribute:

Hartl's sample_app warning on config.serve_static_files, and test already defined

坚强是说给别人听的谎言 提交于 2019-11-30 18:07:47
问题 I am trying to test Hartl's sample_app and this is message that I get after running bundle exec rake test : DEPRECATION WARNING: The configuration option `config.serve_static_assets` has been renamed to `config.serve_static_files` to clarify its role (it merely enables serving everything in the `public` folder and is unrelated to the asset pipeline). The `serve_static_assets` alias will be removed in Rails 5.0. Please migrate your configuration files accordingly. (called from block in <top