Skip to content

App to track your fantasy football teams across fantasy platforms

Notifications You must be signed in to change notification settings

harrisonmuskat/footballer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Footballer

This app allows you to keep track of your fantasy football teams across the numerous available fantasy sites.

External sources

Launch Academy's sinatra-activerecord-starter-kit

To use

  • Clone the repo
  • Change into the repo directory and run bundle

After bundling, rake commands should be available (run rake -T for the list) and you can build and seed the database with test data.

Flash Notices

Uses Sinatra Flash

Flash messages allow you to send information across page redirects. However, only short messages may be sent. Long messages or large objects tend to result in the Flash messages being cleared. In the /app/views/layout.erb, a message box for flash[:notice] has already been added.

Example:

# app.rb

post '/books' do
  # do some logic like save something to the database
  flash[:notice] = "Your book was saved!"

  redirect '/books/all'
end

get '/books/all' do
  # Some code or logic to get all books

  erb :'books/index'
  # Flash message will appear on this page
end

# HEADS UP - flash does not work if returning a view
get '/books/all' do
  flash[:notice] = "This will not appear on the page."

  erb :'/books/index'
  # No flash message will appear until you navigate to a new page or the page refreshes.
end

Shoulda Matchers

Uses Shoulda Matchers

Shoulda Matchers allow for easier testing of Model associations in your unit tests using RSpec.

Example:

# /spec/models/user_spec.rb

require 'spec_helper'
# In this example, a user can have many books,
# but may only belong to a single library.
describe User do
  it { should belong_to :library }
  it { should have_many :books }
end
# /app/models/user.rb

class User < ActiveRecord::Base
  # Note the difference in "belongs_to" here vs. "belong_to" in the spec test.
  belongs_to :library
  has_many :books
end

Valid Attribute

Uses Valid Attribute

Valid Attribute allows for the rapid development of tests for validations in your models.

Example:

# /spec/models/user_spec.rb

describe User do
  it { should have_valid(:username).when("valid_username", "another_valid_username") }
  it { should_not have_valid(:username).when('', nil) }
end
# /app/models/user.rb

class User < ActiveRecord::Base
  validates :username, presence: true
end

About

App to track your fantasy football teams across fantasy platforms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published