During our session, we'll learn how to test model validations.
Clone this app: git clone -b model-testing git@github.com:turingschool-examples/belibery.git
.
public
folder within app
. This is where you will store your css, javascripts, and imagesapplication.css
within app/public
. This is where you will put your custom CSS.app/views
, create a file layout.erb
. This will automatically render around any other .erb
file that you specify to render in your route block. Add the following code to the layout.erb
file:<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/application.css">
My Sinatra Application
var person = { | |
firstName: 'Steve', | |
lastName: 'Kinney', | |
updateName: function () { | |
$.getJson('/api/vi/person', function () { | |
this.firstName = 'Wes' | |
}.bind(this)); | |
} | |
}; |
def is_fibonacci?(i) | |
tester1 = Math.sqrt((5*(i*i)) + 4) | |
tester2 = Math.sqrt((5*(i*i)) - 4) | |
if (tester1 - tester1.to_i) == 0 or (tester2 - tester2.to_i) == 0 | |
return true | |
else | |
return false | |
end | |
end |
### PART 1 (write tests) | |
class Car | |
@@WHEELS = 4 | |
def initialize(args) | |
@color = args[:color] | |
@wheels = @@WHEELS | |
end | |
def drive | |
@status = :driving |
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
def find_submissions(course) | |
@course_category_submissions = Hash.new([]) | |
self.submissions.each do |submission| | |
cat = "#{submission.assignment.assignment_category.name}" | |
weight = submission.assignment.assignment_category.weight | |
@course_category_submissions[[cat, weight]] = [] | |
end | |
self.submissions.each do |submission| | |
cat = "#{submission.assignment.assignment_category.name}" | |
weight = submission.assignment.assignment_category.weight |
Started PUT "/admin/student_profiles/155" for 127.0.0.1 at 2013-09-22 19:35:39 -0700 | |
Processing by Admin::StudentProfilesController#update as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Ms4TZwzD3X2729++CmQSRompltCRrTDQS96/NYn0HAw=", "student"=>{"birthday"=>"1985-05-05", "gender"=>"male", "grade_level"=>"7", "ccsd_id"=>"3333488", "email"=>"gudhsgiuh@gnodjsgh.com"}, "identity"=>{"username"=>"gracealtenwerth", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Update", "id"=>"155"} | |
Identity Load (0.3ms) SELECT "identities".* FROM "identities" WHERE "identities"."id" = 402 LIMIT 1 | |
Admin Load (0.3ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = 1 LIMIT 1 | |
Student Load (0.2ms) SELECT "students".* FROM "students" WHERE "students"."id" = $1 LIMIT 1 [["id", "155"]] | |
Identity Load (0.4ms) SELECT "identities".* FROM "identities" WHERE "identities"."student_id" = 155 LIMIT 1 | |
(0.1ms) BEGIN | |
Identity Exists (0.3ms) SELECT 1 AS one FROM "identities" WHERE ("ide |
Watch https://www.youtube.com/watch?v=7_-qWlvQQtY
Questions:
What are IP addresses for?
What has been done to prevent running out of IP addresses?
Optional: Check out IPv6: https://www.fcc.gov/guides/internet-protocol-version-6-ipv6-consumers, then test your IPv6 connectivity at http://test-ipv6.com/