Update for rails 4

Mostly tests
This commit is contained in:
Ari Timonen 2019-10-17 21:29:15 +03:00
parent fc94c8b8e7
commit 758dfda988
29 changed files with 46 additions and 33 deletions

View file

@ -1,5 +1,5 @@
RACK_ENV=development
RAILS_ENV=development
RACK_ENV=test
RAILS_ENV=test
APP_SECRET=fe837ea72667ec3d8ecb94cfba1a1bba
DEPLOY_PATH=/var/www

7
.gitignore vendored
View file

@ -12,9 +12,10 @@
*.rbc
*.sassc
# MySQL
db_data/
db_data*/
# Database and files
db_data*
db_data/*
!db_data/.placeholder
# OS X
.DS_Store

View file

@ -67,8 +67,8 @@ class Challenge < ActiveRecord::Base
belongs_to :map2, :class_name => "Map"
belongs_to :user
belongs_to :server
belongs_to :contester1, :class_name => "Contester", :include => 'team'
belongs_to :contester2, :class_name => "Contester", :include => 'team'
belongs_to :contester1, :class_name => "Contester"
belongs_to :contester2, :class_name => "Contester"
def statuses
{STATUS_PENDING => "Pending response",

View file

@ -28,7 +28,7 @@ class DataFile < ActiveRecord::Base
scope :recent, -> { order("created_at DESC").limit(8) }
scope :demos, -> { order("created_at DESC").where("directory_id IN (SELECT id FROM directories WHERE parent_id = ?)", Directory::DEMOS) }
scope :ordered, -> { order("created_at DESC") }
scope :movies, -> { order("created_at DESC", :conditions => {:directory_id => Directory::MOVIES}
scope :movies, -> { order("created_at DESC").where({:directory_id => Directory::MOVIES}) }
scope :not, -> (file) { where.not(id: file.id) }
scope :unrelated, -> { where("related_id is null") }
@ -47,7 +47,7 @@ class DataFile < ActiveRecord::Base
after_create :create_movie, :if => Proc.new {|file| file.directory_id == Directory::MOVIES and !file.location.include?("_preview.mp4") }
after_save :update_relations, :if => Proc.new { |file| file.related_id_changed? and related_files.count > 0 }
acts_as_rateable
# acts_as_rateable
mount_uploader :name, FileUploader
def to_s

View file

@ -16,6 +16,9 @@ services:
- memcached
# - redis
db:
# Debug
# command: bash
#tty: true
command: mysqld_safe --skip-grant-tables
image: mariadb:latest
volumes:

View file

@ -1,4 +1,9 @@
require 'spec_helper'
require 'rails_helper'
module Api
module V1
end
end
describe Api::V1::MapsController do
before do
@ -6,7 +11,7 @@ describe Api::V1::MapsController do
end
describe '#index' do
let!(:map) { create :map }
let!(:map) { Map.new() }
it 'returns a list of maps' do
get :index

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
describe Api::V1::ServersController do
before do

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
describe Api::V1::UsersController do
before do

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
describe PluginController do
render_views

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature 'User creates new article', js: :true do
let!(:category) { create(:category, domain: Category::DOMAIN_NEWS) }

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature 'Gathers', js: true do
let!(:user) { create :user }

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature 'Issues' do
let!(:user) { create :user }

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature 'Message creation' do
let!(:sender) { create :user }

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature 'Server Administration' do
let!(:admin) { create :user, :admin }

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature 'User created servers' do
let!(:user) { create :user }

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature 'Shoutbox', js: true do
let!(:user) { create :user }

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature 'Case insensitive login', js: :true do
let(:username) { "CaSe_InSeNsItIvE" }

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
feature 'Visitor signs up', js: :true do
let(:user) { attributes_for(:user) }

View file

@ -15,7 +15,7 @@
# ip :string(255)
#
require "spec_helper"
require "rails_helper"
describe Ban do
let!(:user) { create :user }

View file

@ -11,7 +11,7 @@
# position :integer
#
require "spec_helper"
require "rails_helper"
describe Forum do
let!(:user) { create :user }

View file

@ -10,7 +10,7 @@
# updated_at :datetime
#
require "spec_helper"
require "rails_helper"
describe Forumer do
describe "create" do

View file

@ -15,7 +15,7 @@
# text_parsed :text
#
require "spec_helper"
require "rails_helper"
describe "User" do
describe "Permissions" do

View file

@ -14,7 +14,7 @@
# text_parsed :text
#
require "spec_helper"
require "rails_helper"
describe Message do
let!(:user) { create :user }

View file

@ -11,7 +11,7 @@
# text_parsed :text
#
require "spec_helper"
require "rails_helper"
describe Post do
let!(:user) { create :user }

View file

@ -30,7 +30,7 @@
# category_id :integer
#
require "spec_helper"
require "rails_helper"
describe Server do
describe "create" do

View file

@ -22,7 +22,7 @@
# salt :string(255)
#
require 'spec_helper'
require 'rails_helper'
describe User do
let!(:user) { create :user }

View file

@ -3,7 +3,7 @@ ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
require 'rails_helper'
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!

View file

@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
describe Api::V1::UsersCollection do
let(:collection) { Api::V1::UsersCollection.new }

View file

@ -0,0 +1,4 @@
# spec/support/factory_girl.rb
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end