From 4199062a9ce8f49d24a0a1aa3ebedcd9845cf5d9 Mon Sep 17 00:00:00 2001 From: Luke Barratt Date: Wed, 26 Mar 2014 11:09:39 +0000 Subject: [PATCH] Initial article text code Added model annotations --- app/models/article.rb | 17 +++++++ app/models/ban.rb | 17 +++++++ app/models/bracket.rb | 12 +++++ app/models/bracketer.rb | 14 ++++++ app/models/category.rb | 12 +++++ app/models/challenge.rb | 21 ++++++++ app/models/comment.rb | 14 ++++++ app/models/contest.rb | 24 ++++++++++ app/models/contester.rb | 18 +++++++ app/models/data_file.rb | 17 +++++++ app/models/directory.rb | 14 ++++++ app/models/forum.rb | 13 +++++ app/models/forumer.rb | 12 +++++ app/models/gather.rb | 20 ++++++++ app/models/gather_map.rb | 10 ++++ app/models/gather_server.rb | 12 +++++ app/models/gatherer.rb | 13 +++++ app/models/group.rb | 11 +++++ app/models/grouper.rb | 12 +++++ app/models/issue.rb | 17 +++++++ app/models/lock.rb | 11 +++++ app/models/log.rb | 18 +++++++ app/models/log_event.rb | 12 +++++ app/models/log_file.rb | 12 +++++ app/models/map.rb | 14 ++++++ app/models/match.rb | 29 +++++++++++ app/models/matcher.rb | 13 +++++ app/models/message.rb | 16 +++++++ app/models/movie.rb | 20 ++++++++ app/models/option.rb | 12 +++++ app/models/poll.rb | 13 +++++ app/models/post.rb | 13 +++++ app/models/prediction.rb | 14 ++++++ app/models/profile.rb | 56 ++++++++++++++++++++++ app/models/round.rb | 17 +++++++ app/models/rounder.rb | 16 +++++++ app/models/server.rb | 33 +++++++++++++ app/models/shoutmsg.rb | 13 +++++ app/models/team.rb | 19 ++++++++ app/models/teamer.rb | 13 +++++ app/models/topic.rb | 13 +++++ app/models/tweet.rb | 11 +++++ app/models/user.rb | 23 +++++++++ app/models/view_count.rb | 12 +++++ app/models/vote.rb | 11 +++++ app/models/week.rb | 14 ++++++ config/locales/en.yml | 2 + spec/factories/article.rb | 14 ++++++ spec/features/articles/new_article_spec.rb | 14 ++++++ 49 files changed, 778 insertions(+) create mode 100644 spec/factories/article.rb create mode 100644 spec/features/articles/new_article_spec.rb diff --git a/app/models/article.rb b/app/models/article.rb index b82a24e..d8ac2c1 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: articles +# +# id :integer not null, primary key +# title :string(255) +# status :integer not null +# category_id :integer +# text :text +# user_id :integer +# created_at :datetime +# updated_at :datetime +# version :integer +# text_parsed :text +# text_coding :integer default(0), not null +# + require File.join(Rails.root, 'vendor', 'plugins', 'has_view_count', 'init.rb') require 'rbbcode' diff --git a/app/models/ban.rb b/app/models/ban.rb index 84c4fa6..0771729 100644 --- a/app/models/ban.rb +++ b/app/models/ban.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: bans +# +# id :integer not null, primary key +# steamid :string(255) +# user_id :integer +# addr :string(255) +# server_id :integer +# expiry :datetime +# reason :string(255) +# created_at :datetime +# updated_at :datetime +# ban_type :integer +# ip :string(255) +# + class Ban < ActiveRecord::Base include Extra diff --git a/app/models/bracket.rb b/app/models/bracket.rb index d055b19..3c771e5 100644 --- a/app/models/bracket.rb +++ b/app/models/bracket.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: brackets +# +# id :integer not null, primary key +# contest_id :integer +# slots :integer +# created_at :datetime +# updated_at :datetime +# name :string(255) +# + class Bracket < ActiveRecord::Base include Extra diff --git a/app/models/bracketer.rb b/app/models/bracketer.rb index 0c79931..cb5c4ea 100644 --- a/app/models/bracketer.rb +++ b/app/models/bracketer.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: bracketers +# +# id :integer not null, primary key +# bracket_id :integer +# column :integer +# row :integer +# match_id :integer +# team_id :integer +# created_at :datetime +# updated_at :datetime +# + class Bracketer < ActiveRecord::Base include Exceptions include Extra diff --git a/app/models/category.rb b/app/models/category.rb index 6bc7ef1..263b7aa 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: categories +# +# id :integer not null, primary key +# name :string(255) +# sort :integer +# created_at :datetime +# updated_at :datetime +# domain :integer +# + class Category < ActiveRecord::Base include Extra diff --git a/app/models/challenge.rb b/app/models/challenge.rb index 601faa8..c55b289 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -1,3 +1,24 @@ +# == Schema Information +# +# Table name: challenges +# +# id :integer not null, primary key +# contester1_id :integer +# contester2_id :integer +# match_time :datetime +# default_time :datetime +# mandatory :boolean +# server_id :integer +# user_id :integer +# details :string(255) +# response :string(255) +# created_at :datetime +# updated_at :datetime +# map1_id :string(255) +# map2_id :string(255) +# status :integer default(0), not null +# + class Challenge < ActiveRecord::Base include Extra diff --git a/app/models/comment.rb b/app/models/comment.rb index a2d42ad..5335c40 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: comments +# +# id :integer not null, primary key +# text :text +# user_id :integer +# commentable_type :string(255) +# commentable_id :integer +# created_at :datetime +# updated_at :datetime +# text_parsed :text +# + require 'rbbcode' class Comment < ActiveRecord::Base diff --git a/app/models/contest.rb b/app/models/contest.rb index 1d21c63..bb2ebf2 100644 --- a/app/models/contest.rb +++ b/app/models/contest.rb @@ -1,3 +1,27 @@ +# == Schema Information +# +# Table name: contests +# +# id :integer not null, primary key +# name :string(255) +# start :datetime +# end :datetime +# status :integer +# created_at :datetime +# updated_at :datetime +# default_time :time +# contest_type :integer default(0), not null +# winner_id :integer +# demos_id :integer +# short_name :string(255) +# weight :integer +# modulus_base :integer +# modulus_even :float +# modulus_3to1 :float +# modulus_4to0 :float +# rules_id :integer +# + class Contest < ActiveRecord::Base include Extra diff --git a/app/models/contester.rb b/app/models/contester.rb index 879d770..cffa308 100644 --- a/app/models/contester.rb +++ b/app/models/contester.rb @@ -1,3 +1,21 @@ +# == Schema Information +# +# Table name: contesters +# +# id :integer not null, primary key +# team_id :integer +# created_at :datetime +# updated_at :datetime +# score :integer default(0), not null +# win :integer default(0), not null +# loss :integer default(0), not null +# draw :integer default(0), not null +# contest_id :integer +# trend :integer not null +# extra :integer not null +# active :boolean default(TRUE), not null +# + class Contester < ActiveRecord::Base include Extra diff --git a/app/models/data_file.rb b/app/models/data_file.rb index 864fed1..3786b92 100644 --- a/app/models/data_file.rb +++ b/app/models/data_file.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: data_files +# +# id :integer not null, primary key +# name :string(255) +# description :string(255) +# path :string(255) +# size :integer not null +# md5 :string(255) +# created_at :datetime +# updated_at :datetime +# directory_id :integer +# related_id :integer +# article_id :integer +# + require File.join(Rails.root, 'vendor', 'plugins', 'acts_as_rateable', 'init.rb') require 'digest/md5' diff --git a/app/models/directory.rb b/app/models/directory.rb index cd6f29d..3f6ca86 100644 --- a/app/models/directory.rb +++ b/app/models/directory.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: directories +# +# id :integer not null, primary key +# name :string(255) +# description :string(255) +# path :string(255) +# created_at :datetime +# updated_at :datetime +# parent_id :integer +# hidden :boolean default(FALSE), not null +# + class Directory < ActiveRecord::Base include Extra diff --git a/app/models/forum.rb b/app/models/forum.rb index ab02013..0eb9c3a 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: forums +# +# id :integer not null, primary key +# title :string(255) +# description :string(255) +# category_id :integer +# created_at :datetime +# updated_at :datetime +# position :integer +# + class Forum < ActiveRecord::Base include Extra BANS = 8 diff --git a/app/models/forumer.rb b/app/models/forumer.rb index 5c392ea..1f767c1 100644 --- a/app/models/forumer.rb +++ b/app/models/forumer.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: forumers +# +# id :integer not null, primary key +# forum_id :integer +# group_id :integer +# access :integer +# created_at :datetime +# updated_at :datetime +# + class Forumer < ActiveRecord::Base ACCESS_READ = 0 ACCESS_REPLY = 1 diff --git a/app/models/gather.rb b/app/models/gather.rb index db5a2d7..21507a2 100644 --- a/app/models/gather.rb +++ b/app/models/gather.rb @@ -1,3 +1,23 @@ +# == Schema Information +# +# Table name: gathers +# +# id :integer not null, primary key +# status :integer +# captain1_id :integer +# captain2_id :integer +# map1_id :integer +# map2_id :integer +# server_id :integer +# created_at :datetime +# updated_at :datetime +# turn :integer +# lastpick1 :datetime +# lastpick2 :datetime +# votes :integer default(0), not null +# category_id :integer +# + class Gather < ActiveRecord::Base STATE_RUNNING = 0 STATE_VOTING = 3 diff --git a/app/models/gather_map.rb b/app/models/gather_map.rb index c73902d..5aba394 100644 --- a/app/models/gather_map.rb +++ b/app/models/gather_map.rb @@ -1,3 +1,13 @@ +# == Schema Information +# +# Table name: gather_maps +# +# id :integer not null, primary key +# gather_id :integer +# map_id :integer +# votes :integer +# + class GatherMap < ActiveRecord::Base scope :ordered, :order => "votes DESC, id DESC" diff --git a/app/models/gather_server.rb b/app/models/gather_server.rb index 4ff9fe5..48f7362 100644 --- a/app/models/gather_server.rb +++ b/app/models/gather_server.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: gather_servers +# +# id :integer not null, primary key +# gather_id :integer +# server_id :integer +# votes :integer +# created_at :datetime +# updated_at :datetime +# + class GatherServer < ActiveRecord::Base scope :ordered, :order => "votes DESC" diff --git a/app/models/gatherer.rb b/app/models/gatherer.rb index 0685ae2..06bf570 100644 --- a/app/models/gatherer.rb +++ b/app/models/gatherer.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: gatherers +# +# id :integer not null, primary key +# user_id :integer +# gather_id :integer +# team :integer +# created_at :datetime +# updated_at :datetime +# votes :integer default(0), not null +# + class Gatherer < ActiveRecord::Base IDLE_TIME = 600 EJECT_VOTES = 4 diff --git a/app/models/group.rb b/app/models/group.rb index 6bd90ec..63487f3 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: groups +# +# id :integer not null, primary key +# name :string(255) +# created_at :datetime +# updated_at :datetime +# founder_id :integer +# + class Group < ActiveRecord::Base include Extra diff --git a/app/models/grouper.rb b/app/models/grouper.rb index c7ba80d..8d12162 100644 --- a/app/models/grouper.rb +++ b/app/models/grouper.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: groupers +# +# id :integer not null, primary key +# group_id :integer +# user_id :integer +# task :string(255) +# created_at :datetime +# updated_at :datetime +# + class Grouper < ActiveRecord::Base attr_protected :id, :created_at, :updated_at attr_accessor :username diff --git a/app/models/issue.rb b/app/models/issue.rb index 5caa40a..9718cbc 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: issues +# +# id :integer not null, primary key +# title :string(255) +# status :integer +# assigned_id :integer +# category_id :integer +# text :text +# author_id :integer +# created_at :datetime +# updated_at :datetime +# solution :text +# text_parsed :text +# + require File.join(Rails.root, 'vendor', 'plugins', 'acts-as-readable', 'init.rb') require 'rbbcode' diff --git a/app/models/lock.rb b/app/models/lock.rb index 87114f3..f852e01 100644 --- a/app/models/lock.rb +++ b/app/models/lock.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: locks +# +# id :integer not null, primary key +# lockable_id :integer +# lockable_type :string(255) +# created_at :datetime +# updated_at :datetime +# + class Lock < ActiveRecord::Base include Extra belongs_to :lockable, :polymorphic => true diff --git a/app/models/log.rb b/app/models/log.rb index aa6e81a..4a24f5f 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -1,3 +1,21 @@ +# == Schema Information +# +# Table name: logs +# +# id :integer not null, primary key +# server_id :integer +# text :text +# domain :integer +# created_at :datetime +# round_id :integer +# details :string(255) +# actor_id :integer +# target_id :integer +# specifics1 :string(255) +# specifics2 :string(255) +# log_file_id :integer +# + class Log < ActiveRecord::Base include Extra attr_accessor :text diff --git a/app/models/log_event.rb b/app/models/log_event.rb index 70152cd..65b0b4f 100644 --- a/app/models/log_event.rb +++ b/app/models/log_event.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: log_events +# +# id :integer not null, primary key +# name :string(255) +# description :string(255) +# team :integer +# created_at :datetime +# updated_at :datetime +# + class LogEvent < ActiveRecord::Base def self.get search, team = nil if f = first({:conditions => {:name => search}}) diff --git a/app/models/log_file.rb b/app/models/log_file.rb index 989ddab..f430d05 100644 --- a/app/models/log_file.rb +++ b/app/models/log_file.rb @@ -1,4 +1,16 @@ # encoding: US-ASCII +# == Schema Information +# +# Table name: log_files +# +# id :integer not null, primary key +# name :string(255) +# md5 :string(255) +# size :integer +# server_id :integer +# updated_at :datetime +# + require 'digest/md5' diff --git a/app/models/map.rb b/app/models/map.rb index 2e0e8b6..870b7b2 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: maps +# +# id :integer not null, primary key +# name :string(255) +# download :string(255) +# created_at :datetime +# updated_at :datetime +# deleted :boolean default(FALSE), not null +# picture :string(255) +# category_id :integer +# + class Map < ActiveRecord::Base include Extra diff --git a/app/models/match.rb b/app/models/match.rb index 94cdd80..821f1c8 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -1,3 +1,32 @@ +# == Schema Information +# +# Table name: matches +# +# id :integer not null, primary key +# contester1_id :integer +# contester2_id :integer +# score1 :integer +# score2 :integer +# match_time :datetime +# challenge_id :integer +# contest_id :integer +# report :text +# created_at :datetime +# updated_at :datetime +# map1_id :integer +# map2_id :integer +# server_id :integer +# motm_id :integer +# demo_id :integer +# week_id :integer +# referee_id :integer +# forfeit :boolean +# diff :integer +# points1 :integer +# points2 :integer +# hltv_id :integer +# + class Match < ActiveRecord::Base include Extra diff --git a/app/models/matcher.rb b/app/models/matcher.rb index f935b36..21da011 100644 --- a/app/models/matcher.rb +++ b/app/models/matcher.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: matchers +# +# id :integer not null, primary key +# match_id :integer not null +# user_id :integer not null +# contester_id :integer not null +# created_at :datetime +# updated_at :datetime +# merc :boolean not null +# + class Matcher < ActiveRecord::Base include Extra diff --git a/app/models/message.rb b/app/models/message.rb index 69c3644..0444be7 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -1,3 +1,19 @@ +# == Schema Information +# +# Table name: messages +# +# id :integer not null, primary key +# sender_type :string(255) +# sender_id :integer +# recipient_type :string(255) +# recipient_id :integer +# title :string(255) +# text :text +# created_at :datetime +# updated_at :datetime +# text_parsed :text +# + require 'rbbcode' class Message < ActiveRecord::Base diff --git a/app/models/movie.rb b/app/models/movie.rb index 4ac1f81..77f005f 100644 --- a/app/models/movie.rb +++ b/app/models/movie.rb @@ -1,3 +1,23 @@ +# == Schema Information +# +# Table name: movies +# +# id :integer not null, primary key +# name :string(255) +# content :string(255) +# format :string(255) +# user_id :integer +# file_id :integer +# created_at :datetime +# updated_at :datetime +# picture :string(255) +# preview_id :integer +# length :integer +# match_id :integer +# status :integer +# category_id :integer +# + require 'data_file' class Movie < ActiveRecord::Base diff --git a/app/models/option.rb b/app/models/option.rb index 5ad41d8..c52d448 100644 --- a/app/models/option.rb +++ b/app/models/option.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: options +# +# id :integer not null, primary key +# option :string(255) +# poll_id :integer +# created_at :datetime +# updated_at :datetime +# votes :integer default(0), not null +# + class Option < ActiveRecord::Base include Extra diff --git a/app/models/poll.rb b/app/models/poll.rb index 47056ef..802235b 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: polls +# +# id :integer not null, primary key +# question :string(255) +# end_date :datetime +# user_id :integer +# created_at :datetime +# updated_at :datetime +# votes :integer default(0), not null +# + class Poll < ActiveRecord::Base include Extra diff --git a/app/models/post.rb b/app/models/post.rb index 9d13796..5058240 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: posts +# +# id :integer not null, primary key +# text :text +# topic_id :integer +# user_id :integer +# created_at :datetime +# updated_at :datetime +# text_parsed :text +# + require 'rbbcode' require 'bb-ruby' diff --git a/app/models/prediction.rb b/app/models/prediction.rb index 617bd2c..f8aeea4 100644 --- a/app/models/prediction.rb +++ b/app/models/prediction.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: predictions +# +# id :integer not null, primary key +# match_id :integer +# user_id :integer +# score1 :integer +# score2 :integer +# created_at :datetime +# updated_at :datetime +# result :integer +# + class Prediction < ActiveRecord::Base include Extra diff --git a/app/models/profile.rb b/app/models/profile.rb index b7e09b9..cc78c03 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -1,3 +1,59 @@ +# == Schema Information +# +# Table name: profiles +# +# id :integer not null, primary key +# user_id :integer +# msn :string(255) +# icq :string(255) +# irc :string(255) +# web :string(255) +# town :string(255) +# singleplayer :string(255) +# multiplayer :string(255) +# food :string(255) +# beverage :string(255) +# hobby :string(255) +# music :string(255) +# book :string(255) +# movie :string(255) +# tvseries :string(255) +# res :string(255) +# sensitivity :string(255) +# monitor_hz :string(255) +# scripts :string(255) +# cpu :string(255) +# gpu :string(255) +# ram :string(255) +# psu :string(255) +# motherboard :string(255) +# soundcard :string(255) +# hdd :string(255) +# case :string(255) +# monitor :string(255) +# mouse :string(255) +# mouse_pad :string(255) +# keyboard :string(255) +# head_phones :string(255) +# speakers :string(255) +# achievements :text +# updated_at :datetime +# signature :string(255) +# avatar :string(255) +# clan_search :string(255) +# notify_news :boolean +# notify_articles :boolean +# notify_movies :boolean +# notify_gather :boolean +# notify_own_match :boolean +# notify_any_match :boolean +# notify_pms :boolean default(TRUE), not null +# notify_challenge :boolean default(TRUE), not null +# steam_profile :string(255) +# achievements_parsed :string(255) +# signature_parsed :string(255) +# + require 'rbbcode' class Profile < ActiveRecord::Base diff --git a/app/models/round.rb b/app/models/round.rb index 9497d14..3263114 100644 --- a/app/models/round.rb +++ b/app/models/round.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: rounds +# +# id :integer not null, primary key +# server_id :integer +# start :datetime +# end :datetime +# winner :integer +# match_id :integer +# commander_id :integer +# team1_id :integer +# team2_id :integer +# map_name :string(255) +# map_id :integer +# + class Round < ActiveRecord::Base scope :basic, :include => [:commander, :map, :server, :team1, :team2], :order => "start DESC" scope :team_stats, diff --git a/app/models/rounder.rb b/app/models/rounder.rb index f5b2f65..0914f5d 100644 --- a/app/models/rounder.rb +++ b/app/models/rounder.rb @@ -1,3 +1,19 @@ +# == Schema Information +# +# Table name: rounders +# +# id :integer not null, primary key +# round_id :integer +# user_id :integer +# team :integer +# roles :string(255) +# kills :integer +# deaths :integer +# name :string(255) +# steamid :string(255) +# team_id :integer +# + class Rounder < ActiveRecord::Base attr_accessor :lifeform diff --git a/app/models/server.rb b/app/models/server.rb index 2e2ec5b..5154198 100644 --- a/app/models/server.rb +++ b/app/models/server.rb @@ -1,3 +1,36 @@ +# == Schema Information +# +# Table name: servers +# +# id :integer not null, primary key +# name :string(255) +# description :string(255) +# dns :string(255) +# ip :string(255) +# port :string(255) +# rcon :string(255) +# password :string(255) +# irc :string(255) +# user_id :integer +# official :boolean +# created_at :datetime +# updated_at :datetime +# map :string(255) +# players :integer +# max_players :integer +# ping :string(255) +# version :integer +# domain :integer default(0), not null +# reservation :string(255) +# recording :string(255) +# idle :datetime +# default_id :integer +# active :boolean default(TRUE), not null +# recordable_type :string(255) +# recordable_id :integer +# category_id :integer +# + require "rcon" require "yaml" diff --git a/app/models/shoutmsg.rb b/app/models/shoutmsg.rb index ccf72b0..60e0d59 100644 --- a/app/models/shoutmsg.rb +++ b/app/models/shoutmsg.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: shoutmsgs +# +# id :integer not null, primary key +# user_id :integer +# text :string(255) +# created_at :datetime +# updated_at :datetime +# shoutable_type :string(255) +# shoutable_id :integer +# + class Shoutmsg < ActiveRecord::Base include Extra diff --git a/app/models/team.rb b/app/models/team.rb index cb03049..44eca06 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -1,3 +1,22 @@ +# == Schema Information +# +# Table name: teams +# +# id :integer not null, primary key +# name :string(255) +# irc :string(255) +# web :string(255) +# tag :string(255) +# country :string(255) +# comment :string(255) +# created_at :datetime +# updated_at :datetime +# logo :string(255) +# founder_id :integer +# active :boolean default(TRUE), not null +# recruiting :string(255) +# + class Team < ActiveRecord::Base include Extra diff --git a/app/models/teamer.rb b/app/models/teamer.rb index df287b9..54361ca 100644 --- a/app/models/teamer.rb +++ b/app/models/teamer.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: teamers +# +# id :integer not null, primary key +# team_id :integer not null +# user_id :integer not null +# comment :string(255) +# rank :integer not null +# created_at :datetime +# updated_at :datetime +# + class Teamer < ActiveRecord::Base include Extra diff --git a/app/models/topic.rb b/app/models/topic.rb index 051b63d..a68c9ea 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: topics +# +# id :integer not null, primary key +# title :string(255) +# user_id :integer +# forum_id :integer +# created_at :datetime +# updated_at :datetime +# state :integer default(0), not null +# + class Topic < ActiveRecord::Base POSTS_PAGE = 30 STATE_NORMAL = 0 diff --git a/app/models/tweet.rb b/app/models/tweet.rb index 06af912..6e34819 100644 --- a/app/models/tweet.rb +++ b/app/models/tweet.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: tweets +# +# id :integer not null, primary key +# msg :string(255) +# link :string(255) +# created_at :datetime +# updated_at :datetime +# + class Tweet < ActiveRecord::Base include Extra diff --git a/app/models/user.rb b/app/models/user.rb index 425ea71..27b73ca 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,26 @@ +# == Schema Information +# +# Table name: users +# +# id :integer not null, primary key +# username :string(255) +# password :string(255) +# firstname :string(255) +# lastname :string(255) +# email :string(255) +# steamid :string(255) +# team_id :integer +# lastvisit :datetime +# created_at :datetime +# updated_at :datetime +# lastip :string(255) +# country :string(255) +# birthdate :date +# time_zone :string(255) +# version :integer +# public_email :boolean default(FALSE), not null +# + require 'country_code_select/countries' require 'digest/md5' require File.join(Rails.root, 'vendor', 'plugins', 'acts_as_versioned', 'lib', 'acts_as_versioned.rb') diff --git a/app/models/view_count.rb b/app/models/view_count.rb index 459e3cc..4944415 100644 --- a/app/models/view_count.rb +++ b/app/models/view_count.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: view_counts +# +# id :integer not null, primary key +# viewable_id :integer +# viewable_type :string(255) +# ip_address :string(255) +# logged_in :boolean +# created_at :date +# + class ViewCount < ActiveRecord::Base belongs_to :viewable, :polymorphic => true validates_uniqueness_of :ip_address, :scope => [ :viewable_id, :viewable_type ] diff --git a/app/models/vote.rb b/app/models/vote.rb index 4916487..9031172 100644 --- a/app/models/vote.rb +++ b/app/models/vote.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: votes +# +# id :integer not null, primary key +# user_id :integer +# votable_id :integer +# poll_id :integer +# votable_type :string(255) +# + class Vote < ActiveRecord::Base include Extra diff --git a/app/models/week.rb b/app/models/week.rb index 0abc693..993b202 100644 --- a/app/models/week.rb +++ b/app/models/week.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: weeks +# +# id :integer not null, primary key +# name :string(255) +# start_date :date +# contest_id :integer +# map1_id :integer +# map2_id :integer +# created_at :datetime +# updated_at :datetime +# + class Week < ActiveRecord::Base include Extra diff --git a/config/locales/en.yml b/config/locales/en.yml index 4e6c92c..7d2eb7e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -79,6 +79,8 @@ en: weeks_create: "Week was successfully created." weeks_update: "Week was successfully updated." votes_success: "Voted successfully." + error: "error" + prohibited: "prohibited" errors: template: header: "Please review the following errors:" diff --git a/spec/factories/article.rb b/spec/factories/article.rb new file mode 100644 index 0000000..e841838 --- /dev/null +++ b/spec/factories/article.rb @@ -0,0 +1,14 @@ +FactoryGirl.define do + sequence :title do |n| + "Article #{n}" + end + + sequence :text do |n| + (0..100).map{ (0...8).map { (65 + rand(26)).chr }.join }.join(" ") + end + + factory :article do + title + text + end +end \ No newline at end of file diff --git a/spec/features/articles/new_article_spec.rb b/spec/features/articles/new_article_spec.rb new file mode 100644 index 0000000..5eb8b4e --- /dev/null +++ b/spec/features/articles/new_article_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +feature 'User creates new article' do + let(:user) { create(:user) } + let(:article) { attributes_for(:article) } + + before do + visit new_article_path + end + + describe 'with valid Title, Content: ' do + describe '' + end +end