Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Started GET "/signup" for 33.33.33.1 at 2017-05-09 16:54:38 +0000
- Cannot render console from 33.33.33.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
- ActiveRecord::SchemaMigration Load (1.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
- Processing by ChefsController#new as HTML
- Rendering chefs/new.html.erb within layouts/application
- Rendered shared/_page_title.html.erb (0.9ms)
- Rendered shared/_errors.html.erb (1.6ms)
- Rendered chefs/new.html.erb within layouts/application (61.2ms)
- Rendered layouts/_navigation.html.erb (1.7ms)
- Rendered layouts/_messages.html.erb (2.0ms)
- Rendered layouts/_footer.html.erb (1.0ms)
- Completed 200 OK in 2750ms (Views: 2688.6ms | ActiveRecord: 10.1ms)
- Started POST "/chefs" for 33.33.33.1 at 2017-05-09 16:55:31 +0000
- Cannot render console from 33.33.33.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
- Processing by ChefsController#create as HTML
- Parameters: {"utf8"=>"✓", "authenticity_token"=>"IyvuDTHgojOl5TbzhbFUIdoKuPAgT8bNRZbNUXMSu1vW0O6Adv9m11lvUNyiyxZ66TGPHS5QIc4sv1k+D73z4g==", "chef"=>{"chefname"=>"Rosey", "email"=>"rosey@email.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create my account"}
- No template found for ChefsController#create, rendering head :no_content
- Completed 204 No Content in 119ms (ActiveRecord: 0.0ms)
- Started GET "/signup" for 33.33.33.1 at 2017-05-09 16:47:26 +0000
- Cannot render console from 33.33.33.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
- ActiveRecord::SchemaMigration Load (1.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
- Processing by ChefsController#new as HTML
- Rendering chefs/new.html.erb within layouts/application
- Rendered shared/_page_title.html.erb (0.6ms)
- Rendered shared/_errors.html.erb (1.4ms)
- Rendered chefs/new.html.erb within layouts/application (55.2ms)
- Rendered layouts/_navigation.html.erb (2.0ms)
- Rendered layouts/_messages.html.erb (1.6ms)
- Rendered layouts/_footer.html.erb (1.3ms)
- Completed 200 OK in 2715ms (Views: 2658.1ms | ActiveRecord: 10.2ms)
- Started POST "/chefs" for 33.33.33.1 at 2017-05-09 16:47:44 +0000
- Cannot render console from 33.33.33.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
- Processing by ChefsController#create as HTML
- Parameters: {"utf8"=>"✓", "authenticity_token"=>"iemTuDyzszxzGbyGIJebE4PVcNyqPByufC4UPfH4dc98EpM1e6x32I+T2qkH7dlIsO5HMaQj+60VB4BSjVc9dg==", "chef"=>{"chefname"=>"hilma", "email"=>"", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create my account"}
- No template found for ChefsController#create, rendering head :no_content
- Completed 204 No Content in 123ms (ActiveRecord: 0.0ms)
- $ rails test
- Running via Spring preloader in process 3082
- Run options: --seed 41146
- # Running:
- ........................F
- Failure:
- ChefsSignupTest#test_accept_valid_signup [/vagrant/ketokitchen/test/integration/chefs_signup_test.rb:22]:
- "Chef.count" didn't change by 1.
- Expected: 1
- Actual: 0
- bin/rails test test/integration/chefs_signup_test.rb:20
- F
- Failure:
- ChefsSignupTest#test_reject_an_invalid_signup [/vagrant/ketokitchen/test/integration/chefs_signup_test.rb:15]:
- expecting <"chefs/new"> but rendering with <[]>
- bin/rails test test/integration/chefs_signup_test.rb:9
- 30 runs, 73 assertions, 2 failures, 0 errors, 0 skips
- > @chef = Chef.new
- => #<Chef id: nil, chefname: nil, email: nil, created_at: nil, updated_at: nil, password_digest: nil>
- > @chef = Chef.new(chefname: "test", email: "test@example.com", password: "secretpswd", password_confirmation: "secretpswd")
- => #<Chef id: nil, chefname: "test", email: "test@example.com", created_at: nil, updated_at: nil, password_digest: "$2a$10$oyThgQldfqvhIlLvDhMRLOoCQZXW81qneuXjzDKYxTH...">
- > @chef
- => #<Chef id: nil, chefname: "test", email: "test@example.com", created_at: nil, updated_at: nil, password_digest: "$2a$10$oyThgQldfqvhIlLvDhMRLOoCQZXW81qneuXjzDKYxTH...">
- > @chef.save
- (0.8ms) BEGIN
- Chef Exists (6.0ms) SELECT 1 AS one FROM "chefs" WHERE LOWER("chefs"."email") = LOWER($1) LIMIT $2 [["email", "test@example.com"], ["LIMIT", 1]]
- SQL (4.8ms) INSERT INTO "chefs" ("chefname", "email", "created_at", "updated_at", "password_digest") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["chefname", "test"], ["email", "test@example.com"], ["created_at", 2017-05-09 17:05:58 UTC], ["updated_at", 2017-05-09 17:05:58 UTC], ["password_digest", "$2a$10$oyThgQldfqvhIlLvDhMRLOoCQZXW81qneuXjzDKYxTHNMUj5kVPAm"]]
- (1.4ms) COMMIT
- => true
- > @chef.chefname
- => "test"
- > Chef.all
- Chef Load (4.2ms) SELECT "chefs".* FROM "chefs"
- => #<ActiveRecord::Relation [#<Chef id: 1, chefname: "Dean", email: "deananes@gmail.com",
- created_at: "2017-04-15 18:59:09", updated_at: "2017-05-01 22:59:14", password_digest: nil>,
- #<Chef id: 2, chefname: "jen diamond", email: "thejendiamond@gmail.com",
- created_at: "2017-04-29 03:57:22", updated_at: "2017-05-05 18:57:25",
- password_digest: "$2a$10$YVJthUQoAU2kD.O3zECHMu/74BmOPzmjRSPupJJXe.n...">,
- #<Chef id: 3, chefname: "Toby", email: "toby@email.com", created_at: "2017-05-08 23:10:55",
- updated_at: "2017-05-08 23:10:55",
- password_digest: "$2a$10$4FEv0WCKHpmWGD4Iwxh5mOrRSRNULA2bZlRsvDUDsSs...">,
- #<Chef id: 4, chefname: "test", email: "test@example.com", created_at: "2017-05-09 17:05:58",
- updated_at: "2017-05-09 17:05:58",
- password_digest: "$2a$10$oyThgQldfqvhIlLvDhMRLOoCQZXW81qneuXjzDKYxTH...">]>
- > @chef = Chef.find(1)
- Chef Load (0.7ms) SELECT "chefs".* FROM "chefs" WHERE "chefs"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
- => #<Chef id: 1, chefname: "Dean", email: "deananes@gmail.com",
- created_at: "2017-04-15 18:59:09", updated_at: "2017-05-01 22:59:14",
- password_digest: nil> > @chef
- > @chef.destroy
- (1.0ms) BEGIN
- SQL (0.7ms) DELETE FROM "chefs" WHERE "chefs"."id" = $1 [["id", 1]]
- (0.8ms) COMMIT
- => #<Chef id: 1, chefname: "Dean", email: "deananes@gmail.com", created_at: "2017-04-15 18:59:09", updated_at: "2017-05-01 22:59:14", password_digest: nil>
- > Chef.all
- Chef Load (1.0ms) SELECT "chefs".* FROM "chefs"
- => #<ActiveRecord::Relation [
- #<Chef id: 2, chefname: "jen diamond",
- email: "thejendiamond@gmail.com", created_at: "2017-04-29 03:57:22",
- updated_at: "2017-05-05 18:57:25",
- password_digest: "$2a$10$YVJthUQoAU2kD.O3zECHMu/74BmOPzmjRSPupJJXe.n...">,
- #<Chef id: 3, chefname: "Toby", email: "toby@email.com",
- created_at: "2017-05-08 23:10:55", updated_at: "2017-05-08 23:10:55",
- password_digest: "$2a$10$4FEv0WCKHpmWGD4Iwxh5mOrRSRNULA2bZlRsvDUDsSs...">,
- #<Chef id: 4, chefname: "test", email: "test@example.com",
- created_at: "2017-05-09 17:05:58", updated_at: "2017-05-09 17:05:58",
- password_digest: "$2a$10$oyThgQldfqvhIlLvDhMRLOoCQZXW81qneuXjzDKYxTH...">]>
- Rails.application.routes.draw do
- root 'pages#home'
- get 'pages/home', to: 'pages#home'
- resources :recipes
- get '/signup', to: 'chefs#new'
- resources :chefs, except: [:new]
- end
- class Chef < ApplicationRecord
- has_many :recipes
- validates :chefname, presence: true, length: { maximum: 30 }
- VALID_EMAIL_REGEX = /A([w+-].?)+@[a-zd-]+(.[a-z]+)*.[a-z]+z/i
- validates :email, presence: true, length: { maximum: 50 }, uniqueness: {case_sensitive: false},
- format: { with: VALID_EMAIL_REGEX}
- validates :password, presence: true, length: { minimum: 8 }
- has_secure_password
- end
- class ChefsController < ApplicationController
- def index
- @chefs = Chef.all
- end
- def new
- @chef = Chef.new
- end
- def create
- @chef = Chef.new(chef_params)
- if @chef.save
- flash[:success] = "Welcome #{@chef.chefname} to MyRecipes App!"
- redirect_to chef_path(@chef)
- else
- render 'new'
- end
- end
- def show
- @chef = Chef.find(params[:id])
- end
- private
- def chef_params
- params.require(:chef).permit(:chefname, :email,
- :password, :password_confirmation)
- end
- end
- <%= render 'shared/page_title', title: 'Sign up' %>
- <%= render 'shared/errors', obj: @chef %>
- <div class="row">
- <div class="col-md-12">
- <%= form_for(@chef, :html => {class: "form-horizontal", role: "form"}) do |f| %>
- <div class="form-group">
- <div class="control-label col-md-2">
- <%= f.label :chefname, "Choose Chefname" %>
- </div>
- <div class="col-md-8">
- <%= f.text_field :chefname, class: "form-control",
- placeholder: "Enter your name", autofocus: true %>
- </div>
- </div>
- <div class="form-group">
- <div class="control-label col-md-2">
- <%= f.label :email %>
- </div>
- <div class="col-md-8">
- <%= f.email_field :email, class: "form-control",
- placeholder: "Enter your email" %>
- </div>
- </div>
- <div class="form-group">
- <div class="control-label col-md-2">
- <%= f.label :password %>
- </div>
- <div class="col-md-8">
- <%= f.password_field :password, class: "form-control",
- placeholder: "Choose a password" %>
- </div>
- </div>
- <div class="form-group">
- <div class="control-label col-md-2">
- <%= f.label :password_confirmation, "Confirm Password" %>
- </div>
- <div class="col-md-8">
- <%= f.password_field :password_confirmation, class: "form-control",
- placeholder: "Confirm password" %>
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-offset-2 col-md-10">
- <%= f.submit "Create my account", class: "btn btn-primary btn-lg btn-xlarge" %>
- </div>
- </div>
- <% end %>
- <div class="col-md-4 col-md-offset-4 colormatch">
- [ <%= link_to "Cancel request and return to recipes listing", recipes_path %> ]
- </div>
- </div>
- </div>
- <p><%= @chef.chefname %></p>
- require 'test_helper'
- class ChefsSignupTest < ActionDispatch::IntegrationTest
- test 'should get the signup path' do
- get signup_path
- assert_response :success
- end
- test 'reject an invalid signup' do
- get signup_path
- assert_no_difference "Chef.count" do
- post chefs_path, params: { chef: { chefname: " ", email: " ",
- password: "password", password_confirmation: " " } }
- end
- assert_template 'chefs/new'
- assert_select 'h2.panel-title'
- assert_select 'div.panel-body'
- end
- test 'accept valid signup' do
- get signup_path
- assert_difference 'Chef.count', 1 do
- post chefs_path, params: {chef: {chefname: 'Jen', email: 'thejendiamond@gmail.com',
- password: 'secretpswd', password_confirmation: 'secretpswd'}}
- end
- follow_redirect!
- assert_template 'chefs/show'
- assert_not flash.empty?
- end
- end
- ActiveRecord::Schema.define(version: 20170505183354) do
- # These are extensions that must be enabled in order to support this database
- enable_extension "plpgsql"
- create_table "chefs", force: :cascade do |t|
- t.string "chefname"
- t.string "email"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "password_digest"
- end
- create_table "recipes", force: :cascade do |t|
- t.string "name"
- t.text "description"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "chef_id"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement