This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| User.delete_all | |
| Project.delete_all | |
| Task.delete_all | |
| Comment.delete_all | |
| Membership.delete_all | |
| admin = User.create!( | |
| first_name: 'Admin', | |
| last_name: 'User', | |
| email: 'admin@example.com', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rails_helper' | |
| describe TasksController do | |
| describe "#index" do | |
| before do | |
| @project = Project.create!(name: "Acme") | |
| @user = User.create!( | |
| first_name: "Joe", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= form_for(@project, html: {class: "form-horizontal"} do |f| %> | |
| <div class="form-group"> | |
| <%= f.label :description, class: "col-sm-2 control-label" %> | |
| <div class="col-sm-4"> | |
| <%= f.text_field :description, class: "form-control" %> | |
| </div> | |
| </div> | |
| <div class="form-group"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ProjectsController < ApplicationController | |
| before_action :set_project, only: [:show, :edit, :update, :destroy] | |
| def index | |
| @projects = Project.all | |
| end | |
| def new | |
| @project = Project.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| protect_from_forgery with: :exception | |
| def current_user | |
| User.find_by(id: session[:user_id]) | |
| end | |
| helper_method :current_user | |
| def ensure_logged_in_user |