How do I mix live and "dead" content in my Elixir Phoenix LiveView app header? - http-headers

I changed my root.html.heex file to look like this:
<!DOCTYPE html>
<html lang="en">
<head>
...
</head>
<body>
<%= #inner_content %>
</body>
</html>
And moved the <header> element to be duplicated in app.html.heex:
<header>
<section class="container w-full m-5 p-3 bg-blue-200 text-blue-600 text-5xl font-bold">
<div class="text-2xl">
<a href="/">
<img class="float-left mt-1"
src={Routes.static_path(#conn, "/images/logo.png")} alt="LOGO"/>
<span class="flex text-4xl hover:text-blue-800">
<span class="font-medium nomargin">WEBSITE</span>
</span>
</a>
<span class="float-right flex -mt-8 font-normal">
<nav role="navigation">
<%= render "_user_menu.html", assigns %>
</nav>
</span>
</div>
</section>
</header>
<main class="container">
<p class="alert alert-info" role="alert"><%= get_flash(#conn, :info) %></p>
<p class="alert alert-danger" role="alert"><%= get_flash(#conn, :error) %></p>
<%= #inner_content %>
</main>
...and in live.html.heex.
But I can't render "_user_menu.html" in live.html.heex because (of course) it uses #current_user.
Is there a trick that allows me to somehow have live content on the float-left side of the header and the "_user_menu.html" fragment on the float-right side?

Generally if you need to mix "Live" and "Dead" views/templates, there is live_render/3 documented here. Been there, seen that [working] ;-)

Related

Rich results test detects error "missing field 'id'" while it is present

Following this guide from Google. I am adding Microdata to my website's breadcrumbs.
When testing my own code, I am getting the error that the field "id" is missing, while it is not from what I can see and understand. Am I missing something here or is it a bug in the test tool of Google?
You can test yourself at https://search.google.com/test/rich-results/result with below code.
<html>
<head>
<title>Microdata test</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-12 col-lg-10 offset-lg-1">
<nav aria-label="breadcrumb" class="breadcrumb top">
<ol class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" class="breadcrumb-item">
<a itemid="http://localhost/hikes-and-walks" href="http://localhost/hikes-and-walks" itemprop="item" itemscope itemtype="https://schema.org/WebPage"><span itemprop="name">Home</span></a> <meta itemprop="position" content="1" />
</li>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" class="breadcrumb-item">
<a itemid="http://localhost/hikes-and-walks/hikes/bulgaria" href="http://localhost/hikes-and-walks/hikes/bulgaria" itemprop="item" itemscope itemtype="https://schema.org/WebPage"><span itemprop="name">Bulgaria</span></a> <meta itemprop="position" content="2" />
</li>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" class="breadcrumb-item active" aria-current="page">
<span itemprop="name">Aleko hut to Zheleznitsa village</span>
<meta itemprop="position" content="3" />
</li>
</ol>
</nav>
</div>
</div>
</div>
</body>
</html>
It is giving the error "Missing field 'id'":
It's probably due to some internal validations that are hard to grasp. It looks like itemid requires a specific URL structure. In this case either relative or absolute URL (protocol+root+tld) work, i.e.changing "http://localhost" to "http://localhost.site" passes the test. Relative URLs also work.
So, change itemid URL to:
absolute URL:
itemid="http://localhost.site/hikes-and-walks"
or relative URL:
itemid="/hikes-and-walks"
Also, these (valid) examples won't work:
urn:isbn:9780307476463
file:///ada/Analytical%20Engine/README.md
ftp://file
Here's the working code:
<html>
<head>
<title>Microdata test</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-12 col-lg-10 offset-lg-1">
<nav aria-label="breadcrumb" class="breadcrumb top">
<ol class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" class="breadcrumb-item">
<a itemid="http://localhost.site/hikes-and-walks" href="http://localhost/hikes-and-walks" itemprop="item" itemscope itemtype="https://schema.org/WebPage"><span itemprop="name">Home</span></a> <meta itemprop="position" content="1" />
</li>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" class="breadcrumb-item">
<a itemid="http://localhost.site/hikes-and-walks/hikes/bulgaria" href="http://localhost/hikes-and-walks/hikes/bulgaria" itemprop="item" itemscope itemtype="https://schema.org/WebPage"><span itemprop="name">Bulgaria</span></a> <meta itemprop="position" content="2" />
</li>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" class="breadcrumb-item active" aria-current="page">
<span itemprop="name">Aleko hut to Zheleznitsa village</span>
<meta itemprop="position" content="3" />
</li>
</ol>
</nav>
</div>
</div>
</div>
</body>
</html>

Aggregate review is missing on Google SERP

Recently I've lost my star review on Google SERP. I know that reasons may be differents and various, but I would to be sure that I didn't made mistakes on code:
<div itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating" style="text-align:right;">
<b><span itemprop="ratingValue">5</span> on
<span itemprop="bestRating">5</span> based on <span itemprop="reviewCount">857</span> reviews</b>
</div>
Could Google have released an update?
The code snippet you provided in the main post: in isolation is not valid according to Google SDTT.
The review has no reviewed item specified
<div itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating" style="text-align:right;">
<b><span itemprop="ratingValue">5</span> on
<span itemprop="bestRating">5</span> based on <span itemprop="reviewCount">857</span> reviews</b>
</div>
This is fixed by adding in itemprop="itemreviewed"
<div itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating" style="text-align:right;">
<h3 itemprop="itemreviewed">Mario Bros service</h3>
<b><span itemprop="ratingValue">5</span> of
<span itemprop="bestRating">5</span> based on <span itemprop="reviewCount">857</span> reviews</b>
</div>
Instances of AggregateRating may appear as values for the following properties
Brand
CreativeWork
Event
Offer
Organization
Place
Product
Service
Source - http://schema.org/AggregateRating
Your full snippet in the comments (which I have simplified) is using the Organization schema http://schema.org/Organization and a different vocabulary for Review aggregate
<html itemscope itemtype="http://schema.org/Organization">
<body>
<div class="review">
<div itemprop="review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">
<img itemprop="rating" src="#" alt="173 recensioni" />
<span itemprop="count">173 recensioni</span>
</div>
</div>
</body>
</html>
Which has multiple errors.
The valid way would be:
Using data-vocabulary.org
<html itemscope itemtype="http://schema.org/Organization">
<body>
<div>
<h1 itemprop="name">Mario Bros</h1>
<div itemscope itemtype="http://data-vocabulary.org/Review-aggregate">
<h3 itemprop="itemreviewed">Mario Bros service</h3>
<p>
<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">
<em itemprop="average">5</em> out of <em itemprop="best"> 5 </em>
</span>
<b>based on</b>
<!-- How many people rated this item? -->
<em itemprop="votes">173</em> ratings.
</p>
<p>
<!-- How many people reviewed this item? -->
<em itemprop="count">45 </em> user reviews.
</p>
</div>
</div>
</body>
</html>
Using schema.org
<html itemscope itemtype="http://schema.org/Organization">
<body>
<div>
<h1 itemprop="name">Mario Bros</h1>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<em itemprop="ratingValue">5</em> out of <em itemprop="bestRating">5</em> based on <em itemprop="ratingCount">24</em> user ratings.
</div>
</div>
</body>
</html>
You also mentioned in comments that they are products:
products such as curtains, roll-up, etc
This is Google's example from the Products data type:
<div itemscope itemtype="http://schema.org/Product">
<img itemprop="image" src="dell-30in-lcd.jpg" />
<span itemprop="name">Dell UltraSharp 30" LCD Monitor</span>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue">87</span>
out of <span itemprop="bestRating">100</span>
based on <span itemprop="ratingCount">24</span> user ratings
</div>
</div>
Modified for your criteria would be:
<html itemscope itemtype="http://schema.org/Organization">
<body>
<div>
<h1 itemprop="name">Mario Bros</h1>
<div itemscope itemtype="http://schema.org/Product">
<img itemprop="image" src="curtains.jpg" />
<span itemprop="name">Acme brand Curtains</span>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<em itemprop="ratingValue">5</em> out of <em itemprop="bestRating">5</em> based on <em itemprop="ratingCount">173</em> reviews.
</div>
</div>
</div>
</body>
</html>
Enchanced further:
<html itemscope itemtype="http://schema.org/Organization">
<body>
<div>
<h1 itemprop="name">Mario Bros</h1>
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="brand">Acme brand</span>
<img itemprop="image" src="curtains.jpg" />
<span itemprop="name">Acme brand Curtains</span>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<em itemprop="ratingValue">5</em> out of <em itemprop="bestRating">5</em> based on <em itemprop="ratingCount">173</em> reviews.
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<!--price is 1000, a number, with locale-specific thousands separator and decimal mark, and the € character is marked up with the machine-readable code "EUR" -->
<span itemprop="priceCurrency" content="EUR">€</span>
<span itemprop="price" content="1000.00">1,000.00</span>
<link itemprop="availability" href="http://schema.org/InStock" />
<span>In stock</span>
</div>
</div>
</div>
</body>
</html>

Hidden column breaks layout of following row

I have a layout with three rows. I would like the first row to have one column that spans all 12 columns at the xs size. At larger sizes I would like two columns, one 9 columns wide and one 3 columns wide. I have attempted this by adding the second column and making it hidden at xs and visible and 3 wide at sm.
However, doing so breaks the layout of my second row at larger screen sizes for some reason. I'm not sure why.
Code working before adding hidden column:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="../styles/StyleSheet1.css" rel="stylesheet" />
<title></title>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-xs-12">
<div id="header">
<h1>This will be the page header</h1>
<ul class="nav nav-tabs">
<li class="active">Home</li>
<li>Page w/o Sidebar</li>
<li>Menu Item 3</li>
</ul>
</div>
</div>
</div>
<div class="row-fluid">
<div class="col-xs-6 col-sm-3 col-sm-push-9">
<div id="side-bar">
This is the side bar
<ul class="list-group">
<li class="list-group-item active">item a</li>
<li class="list-group-item">item b</li>
<li class="list-group-item">item c</li>
</ul>
</div>
</div>
<div class="col-xs-12 col-sm-9 col-sm-pull-3">
<div id="content">
<h2>This is the main content</h2>
</div>
</div>
</div>
<div class="row-fluid">
<div class="col-xs-12">
<div id="footer">
This is the footer
</div>
</div>
</div>
</div>
</body>
</html>
Code broken after adding hidden column:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="../styles/StyleSheet1.css" rel="stylesheet" />
<title></title>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-xs-12 col-sm-9">
<div id="header">
<h1>This will be the page header</h1>
<ul class="nav nav-tabs">
<li class="active">Home
</li>
<li>Page w/o Sidebar
</li>
<li>Menu Item 3
</li>
</ul>
</div>
</div>
<div class="hidden-xs col-sm-3 visible-sm ">
</div>
</div>
<div class="row-fluid">
<div class="col-xs-6 col-sm-3 col-sm-push-9">
<div id="side-bar">
This is the side bar
<ul class="list-group">
<li class="list-group-item active">item a</li>
<li class="list-group-item">item b</li>
<li class="list-group-item">item c</li>
</ul>
</div>
</div>
<div class="col-xs-12 col-sm-9 col-sm-pull-3">
<div id="content">
<h2>This is the main content</h2>
</div>
</div>
</div>
<div class="row-fluid">
<div class="col-xs-12">
<div id="footer">
This is the footer
</div>
</div>
</div>
</div>
</body>
</html>
I seem to have figured out the solution. I'm setting the column that I want hidden as visible on small, medium, and large, and setting it to 3 columns on small screens or larger.
I also added a div between the rows with the clearfix class.
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-xs-12 col-sm-9">
<div id="header">
<h1>This will be the page header</h1>
<ul class="nav nav-tabs">
<li class="active">Home
</li>
<li>Page w/o Sidebar
</li>
<li>Menu Item 3
</li>
</ul>
</div>
</div>
<div class="visible-sm visible-md visible-lg col-sm-3">
<div id="logo">
<p>This is the hidden area</p>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row-fluid">
<!-- rest of the code from before -->

Navbar not collapsing after clicking toggle button. Bootstrap 3 with django

I'm experiencing something strange, while trying out bootstrap with django. I copied the dashboard-example from the bootstrap-page (dashboard-example) into my django-project to play around a little bit. When I try to use the collapse navbar for smaller screen-sizes, the navbar is appearing, when I click the toggle-button. But if I click the toggle-button again, the navbar is not disappearing. I copied the example from bootstrap one-to-one. Why is the toggle-button not working as expected? Here is the generated html-code:
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Dashboard Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="/static/css/dashboardtest.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="/static/js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>Dashboard</li>
<li>Settings</li>
<li>Profile</li>
<li>Help</li>
</ul>
<form class="navbar-form navbar-right">
<input type="text" class="form-control" placeholder="Search...">
</form>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active">Overview <span class="sr-only">(current)</span></li>
<li>Reports</li>
<li>Analytics</li>
<li>Export</li>
</ul>
<ul class="nav nav-sidebar">
<li>Nav item</li>
<li>Nav item again</li>
<li>One more nav</li>
<li>Another nav item</li>
<li>More navigation</li>
</ul>
<ul class="nav nav-sidebar">
<li>Nav item again</li>
<li>One more nav</li>
<li>Another nav item</li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Dashboard</h1>
<div class="row placeholders">
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/sky" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/vine" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/sky" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/vine" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
</div>
<h2 class="sub-header">Section title</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Header</th>
<th>Header</th>
<th>Header</th>
<th>Header</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/docs.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="/static/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>
please put bootstrap CDN in that file:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>

Capybara and Rails, Why my link expected to return some thing?

I am trying to test that a link dose exist on the page,
I tried to check all the nesting tags that contain the link tag like that:
response.body.should have_selector("div.page_margins div.page div#nav div.hlist ul li#2")
and it passes correctly, but, if I added the link tag to the test like this:
response.body.should have_selector("div.page_margins div.page div#nav div.hlist ul li#2 a",:text => "Next")
I get the error:
expected css "div.page_margins div.page div#nav div.hlist ul li#2 a#next_page"
with text "Next" to return something
If I test it with have_link like this:
response.body.should have_link("div.page_margins div.page div#nav div.hlist ul li#2 a#next_page")
I get the error:
expected link "div.page_margins div.page div#nav div.hlist ul li#2
a#next_page" to return something
Can any body help please ? I love rails, but, I still need a hand to get along with testing ..
EDIT
Here is the page.html, I've noticed that the html in content_for in which the link is rendered is not rendered in yield
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-type">
<title></title>
<script src="/assets/application.js" type="text/javascript"></script><link href="/assets/application.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript">
//<![CDATA[
var auto_log_off = false;
//]]>
</script><script type="text/javascript">
//<![CDATA[
var student_logged = false;
//]]>
</script><script src="/assets/sessions.js" type="text/javascript"></script><!-- add your meta tags here --><link href="/assets/application_yaml/css/my_layout.css" rel="stylesheet" type="text/css">
<!--[if lte IE 7]> <![endif]--><link href="/assets/application_yaml/css/patch_my_layout.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="page_margins">
<div id="topnav">
<!-- start: skip link navigation -->
<a class="skip" href="#navigation" title="skip link">Skip to the navigation</a>
<span class="hideme">.</span>
<a class="skip" href="#content" title="skip link">Skip to the content</a>
<span class="hideme">.</span>
<!-- end: skip link navigation -->
</div>
<!-- start: skip link navigation -->
<!-- end: skip link navigation -->
<div class="page">
<div id="header">
<h1>Welcome to course builder!!</h1>
<p>Home</p>
</div>
<div id="nav">
<!-- skiplink anchor: navigation -->
<a id="navigation" name="navigation"></a>
<div class="hlist">
<!-- main navigation: horizontal list -->
<div class="quiz_review_buttons">
<!--
<ul>
<li class="active"><strong>Button 1</strong></li>
<li>Button 2</li>
<li>Button 3</li>
</ul>
-->
</div>
<!-- <ul> -->
<!-- <li class="active"><strong>Button 1</strong></li> -->
<!-- <li>Button 2</li> -->
<!-- <li>Button 3</li> -->
<!-- <li>Button 4</li> -->
<!-- <li>Button 5</li> -->
<!-- </ul> -->
</div>
</div>
<div id="main">
<div id="col1">
<div class="clearfix" id="col1_content">
<!-- add your content here -->
<div class="debug_div">
<p>
<b>
devise/sessions#new
</b>
</p>
</div>
</div>
</div>
<div id="col3">
<div class="clearfix" id="col3_content">
<!-- add your content here -->
<div class="alert" id="notice_alert">You need to sign in or sign up before continuing.</div>
<script type="text/javascript"></script><!-- <div style="clear:both"></div> --><h2>Sign in for student</h2>
<form accept-charset="UTF-8" action="/students/sign_in" class="student_new" id="student_new" method="post">
<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
<div>
<label for="student_email">Email</label><br><input id="student_email" name="student[email]" size="30" type="email" value="">
</div>
<div>
<label for="student_password">Password</label><br><input id="student_password" name="student[password]" size="30" type="password">
</div>
<div>
<input name="student[remember_me]" type="hidden" value="0"><input id="student_remember_me" name="student[remember_me]" type="checkbox" value="1"><label for="student_remember_me">Remember me</label>
</div>
<div><input name="commit" type="submit" value="Sign in"></div>
</form>
Sign up<br>Forgot your password?<br>
</div>
<!-- IE Column Clearing -->
<div id="ie_clearing"> </div>
</div>
</div>
<div id="footer">
Layout based on
YAML
</div>
</div>
</div>
</body>
</html>
"expected to return something" just means that capybara couldn't find the element it was looking for. Hard to say why without seeing the html that capybara is searching
Note that the argument to have_link is not a css selector, it should be the text, id, title, or image alt attribute of the link.
Also, in controller specs, make sure you call render_views when checking markup.
.