repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/authenticated_user_serializer.rb
app/serializers/authenticated_user_serializer.rb
class AuthenticatedUserSerializer < ActiveModel::Serializer attributes :name, :email, :created_at, :picture, :sha, :editor, :admin, :has_papers_as_submittor, :has_papers_as_reviewer, :has_papers_as_ed...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/assignment_serializer.rb
app/serializers/assignment_serializer.rb
class AssignmentSerializer < BaseSerializer attributes :sha, :role, :public, :completed, :reviewer_accept has_one :user, serializer:PublicUserSerializer private def filter(*) results = super results = results - [:user] unless object.m...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/paper_serializer.rb
app/serializers/paper_serializer.rb
class PaperSerializer < BaseSerializer attributes :typed_provider_id, :doi, :user_permissions, :state, :submitted_at, :title, :authors, :pending_issues_count has_one :submittor, serializer:BasicUserSerializer def subm...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/full_paper_serializer.rb
app/serializers/full_paper_serializer.rb
class FullPaperSerializer < PaperSerializer attributes :paper_id, :document_location has_many :assigned_users has_many :versions, each_serializer: BasicPaperSerializer def paper_id object.id end def versions object.all_versions end def assigned_users object.assignments ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/base_serializer.rb
app/serializers/base_serializer.rb
class BaseSerializer < ActiveModel::Serializer def current_user scope end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/basic_paper_serializer.rb
app/serializers/basic_paper_serializer.rb
class BasicPaperSerializer < BaseSerializer attributes :typed_provider_id, :version end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/user_serializer.rb
app/serializers/user_serializer.rb
class UserSerializer < BaseSerializer # Make sure that a user is never fully serialized because that would # Expose too much public information def initialize(*) raise "No serializer supplied for user" end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/public_user_serializer.rb
app/serializers/public_user_serializer.rb
class PublicUserSerializer < BasicUserSerializer attributes :email, :created_at, :picture, :sha end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/annotation_serializer.rb
app/serializers/annotation_serializer.rb
class AnnotationSerializer < BaseSerializer attributes :id, :paper_id, :state, :parent_id, :body, :assignment, :created_at, :page, :xStart, :xEnd, :yStart, :yEnd has_many :...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/preview_paper_serializer.rb
app/serializers/preview_paper_serializer.rb
# Serialize a Paper in the format for previewing documents class PreviewPaperSerializer < BaseSerializer attributes :typed_provider_id, :title, :summary, :document_location, :authors, :is_existing, :is_self_owned def is_self_owned ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/helpers/sessions_helper.rb
app/helpers/sessions_helper.rb
module SessionsHelper end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/helpers/comments_helper.rb
app/helpers/comments_helper.rb
module CommentsHelper end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/helpers/users_helper.rb
app/helpers/users_helper.rb
module UsersHelper end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/helpers/application_helper.rb
app/helpers/application_helper.rb
module ApplicationHelper def current_user_roles user = current_user if (!user) '' elsif user.admin? && user.editor? ' (Admin, Editor)' elsif user.admin? ' (Admin)' elsif user.editor? ' (Editor)' else '' end end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/helpers/papers_helper.rb
app/helpers/papers_helper.rb
module PapersHelper def state_badge_for(paper) return image_tag('badges/unknown.svg') unless paper case paper.state when "submitted" image_tag('badges/submitted.svg') when "under_review" image_tag('badges/review.svg') when "review_completed" image_tag('badges/co...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/helpers/home_helper.rb
app/helpers/home_helper.rb
module HomeHelper end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/home_controller.rb
app/controllers/home_controller.rb
class HomeController < ApplicationController before_filter :authentication_required, only: [:index_with_auth] def index render :index end def index_with_auth render :index end def temp_home papers = Paper.published render 'temp_home', locals: { papers: papers } end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/papers_controller.rb
app/controllers/papers_controller.rb
class PapersController < ApplicationController respond_to :json def badge if stale?(paper) respond_to do |format| format.html { @paper = paper; render layout:false } format.json { render json: { state: paper.state } } end end end private def paper @paper ||= Paper...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/admin_controller.rb
app/controllers/admin_controller.rb
class AdminController < ApplicationController respond_to :json layout false before_filter :require_admin def index end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/feed_controller.rb
app/controllers/feed_controller.rb
class FeedController < ApplicationController # arXiv metadata https://arxiv.org/help/bib_feed def arxiv papers = Paper.published .where(provider_type: Provider::ArxivProvider.type) .where('updated_at >= ?', 3.months.ago) attributes = papers.map { |paper| arx...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
require 'open-uri' class SessionsController < ApplicationController def new end def create logger.debug("#create") user = User.from_omniauth(env["omniauth.auth"]) #FIXME this needs to go in a worker (or better still, come back in the OAuth hash...) name = orcid_name_for(user.uid) user.upda...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/application_controller.rb
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. # protect_from_forgery with: :exception # before_filter :require_user class HttpError < StandardError def initialize(status_code, text) @status...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/api/v1/users_controller.rb
app/controllers/api/v1/users_controller.rb
class Api::V1::UsersController < Api::V1::ApplicationController respond_to :json before_filter :require_user, except: [ :show ] before_filter :require_editor, only: [ :lookup ] def show if current_user respond_with current_user, serializer:AuthenticatedUserSerializer else render json:{...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/api/v1/annotations_controller.rb
app/controllers/api/v1/annotations_controller.rb
class Api::V1::AnnotationsController < Api::V1::ApplicationController respond_to :json before_filter :require_user, except: [:index, :all] before_filter :require_editor, only: [:update] # Root issues def index if can? :view_annotations, paper render json: paper.issues else render...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/api/v1/papers_controller.rb
app/controllers/api/v1/papers_controller.rb
class Api::V1::PapersController < Api::V1::ApplicationController respond_to :json before_filter :require_user, except: [ :recent, :search, :index, :show, :versions ] before_filter :require_editor, only: [ :destroy, :transition ] def index recent end def show #@todo # ability = ability_wit...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/api/v1/assignments_controller.rb
app/controllers/api/v1/assignments_controller.rb
class Api::V1::AssignmentsController < Api::V1::ApplicationController respond_to :json before_filter :require_user, except: [ :index ] before_filter :require_editor, only: [ :create, :destroy ] def index render json:paper.assignments, status: :ok, location: paper_review_url(paper) end def create ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/controllers/api/v1/application_controller.rb
app/controllers/api/v1/application_controller.rb
class Api::V1::ApplicationController < ApplicationController end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/models/provider.rb
app/models/provider.rb
# Lookup class for Providers class Provider SEPARATOR = ':' class << self def parse_identifier(identifier) raise Error::InvalidIdentifier.new unless identifier.present? provider_type, identifier = identifier.split(SEPARATOR, 2) raise Error::InvalidIdentifier.new unless identifier.present? ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/models/annotation.rb
app/models/annotation.rb
class Annotation < ActiveRecord::Base include AASM belongs_to :paper, inverse_of: :annotations belongs_to :assignment, inverse_of: :annotations has_many :responses, class_name:'Annotation', foreign_key:'parent_id' belongs_to :parent, class_name:'Annotation', foreign_key:'parent_id' scope :root_...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/models/ability.rb
app/models/ability.rb
class Ability include CanCan::Ability def initialize(user, paper=nil, annotation=nil) # HEADS UP - ordering matters here because of how CanCan defines abilities if user initialize_annotation(user, annotation) initialize_author(user, paper) initialize_collaborator(user, paper) initi...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/models/assignment.rb
app/models/assignment.rb
class Assignment < ActiveRecord::Base belongs_to :user, inverse_of: :assignments belongs_to :paper, inverse_of: :assignments has_many :annotations, inverse_of: :assignment # set when the paper is being updated from an original attr_accessor :copied validates :role, inclusion:{ ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/models/paper.rb
app/models/paper.rb
class Paper < ActiveRecord::Base include AASM has_many :annotations, inverse_of: :paper, dependent: :destroy has_many :assignments, inverse_of: :paper, dependent: :destroy do def for_user(user, role=nil) if role where(user:user, role:role).first else where(user:user).first ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/models/user.rb
app/models/user.rb
class User < ActiveRecord::Base has_many :assignments, inverse_of: :user has_many :assignments_as_collaborator, -> { where(role:'collaborator') }, class_name:'Assignment', inverse_of: :user has_many :assignments_as_reviewer, -> { where(role:'reviewer') }, class_name:'Assignment', inverse_of: :user has_m...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/models/provider/arxiv_provider.rb
app/models/provider/arxiv_provider.rb
class Provider class ArxivProvider < BaseProvider self.type = :arxiv self.version_separator = 'v' class << self def get_attributes(id) manuscript = Arxiv.get(id.to_s) attributes_from_manuscript(manuscript) rescue Arxiv::Error::ManuscriptNotFound => ex raise Error::...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/models/provider/test_provider.rb
app/models/provider/test_provider.rb
# Used for running specs class Provider class TestProvider < BaseProvider self.type = :test self.version_separator = '-' class << self def get_attributes(id) parsed = parse_identifier(id) { provider_type: self.type, provider_id: parsed[:provider...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/models/provider/base_provider.rb
app/models/provider/base_provider.rb
class Provider class BaseProvider class_attribute :type class_attribute :version_separator class << self def full_identifier(**params) result = params[:provider_id].dup result << "#{version_separator}#{params[:version]}" if params[:version] result end def pars...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/mailers/notification_mailer.rb
app/mailers/notification_mailer.rb
class NotificationMailer < ApplicationMailer def notification(user, paper, text, subject='Paper Updated') @paper = paper @link = paper_review_url(paper) @text = text subject = "#{paper.title} - #{subject}" mail to:user, subject:subject end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/mailers/application_mailer.rb
app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base layout 'mailer' def mail(headers = {}, &block) set_users(headers) @subject = headers[:subject] = "[TheOJ] #{headers[:subject]}" super unless headers[:to].empty? end def full_email_for_user(user) if user.name.present? && user.email.present? %...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/seeds.rb
db/seeds.rb
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/schema.rb
db/schema.rb
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sou...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150210150759_unique_paper_indexes.rb
db/migrate/20150210150759_unique_paper_indexes.rb
class UniquePaperIndexes < ActiveRecord::Migration def up remove_index :papers, ["arxiv_id"] add_index :papers, ["arxiv_id"], unique:true remove_index :papers, ["sha"] add_index :papers, ["sha"], unique:true end def down remove_index :papers, ["arxiv_id"] add_index :papers, [...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20140515135144_rename_comments.rb
db/migrate/20140515135144_rename_comments.rb
class RenameComments < ActiveRecord::Migration def change rename_table :comments, :annotations Annotation.reset_column_information remove_index("annotations", :name => "index_comment_user_id") remove_index("annotations", :name => "index_comment_paper_id") remove_index("annotations", :nam...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20140712015520_add_assigned_user_to_paper.rb
db/migrate/20140712015520_add_assigned_user_to_paper.rb
class AddAssignedUserToPaper < ActiveRecord::Migration def change add_column :papers, :fao_id, :integer add_index :papers, ["fao_id"] end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20161228023050_reviewer_accept_to_string.rb
db/migrate/20161228023050_reviewer_accept_to_string.rb
class ReviewerAcceptToString < ActiveRecord::Migration def change change_column :assignments, :reviewer_accept, :string, limit: 20 end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150626190052_remove_paper_sha.rb
db/migrate/20150626190052_remove_paper_sha.rb
class RemovePaperSha < ActiveRecord::Migration def change remove_index :papers, name: "index_papers_on_sha" remove_column :papers, :sha end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150512025202_add_sha_to_assignment.rb
db/migrate/20150512025202_add_sha_to_assignment.rb
class AddShaToAssignment < ActiveRecord::Migration def change add_column :assignments, :sha, :string reversible do |dir| dir.up do Assignment.find_each do |a| a.update_attributes!(sha:SecureRandom.hex) end end end change_column_null :assignments, :sha, false ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150505233549_add_email_to_user.rb
db/migrate/20150505233549_add_email_to_user.rb
class AddEmailToUser < ActiveRecord::Migration def change add_column :users, :email, :string, limit:255 end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150626190032_change_from_arxiv_id_to_source_id.rb
db/migrate/20150626190032_change_from_arxiv_id_to_source_id.rb
class ChangeFromArxivIdToSourceId < ActiveRecord::Migration def change remove_index :papers, name: "index_papers_on_arxiv_id_and_version" rename_column :papers, :arxiv_id, :provider_id add_column :papers, :provider_type, :string, limit:10 reversible do |dir| dir.up do execute('DE...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150224004849_fix_annotation_state.rb
db/migrate/20150224004849_fix_annotation_state.rb
class FixAnnotationState < ActiveRecord::Migration def up Annotation.all.where(state:'new').update_all(state:'unresolved') end def down Annotation.all.where(state:'unresolved').update_all(state:'new') end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20140211220942_create_users.rb
db/migrate/20140211220942_create_users.rb
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :provider t.string :uid t.string :name t.boolean :admin, :default => false t.boolean :editor, :default => false t.timestamps end add_index "users", ["provider"], :name => "index...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150526184138_add_arxiv_id_index.rb
db/migrate/20150526184138_add_arxiv_id_index.rb
class AddArxivIdIndex < ActiveRecord::Migration def change remove_index :papers, name: "index_papers_on_arxiv_id" add_index :papers, [:arxiv_id, :version], unique: true end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20140212012504_create_papers.rb
db/migrate/20140212012504_create_papers.rb
class CreatePapers < ActiveRecord::Migration def change create_table :papers do |t| t.integer :user_id t.string :location t.string :state t.datetime :submitted_at t.string :title t.integer :version, :default => 1 t.timestamps end add_index "papers", ["user_id...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20161009043324_add_doi_to_paper.rb
db/migrate/20161009043324_add_doi_to_paper.rb
class AddDoiToPaper < ActiveRecord::Migration def change add_column :papers, :doi, :string end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150201224917_add_arxiv_details_to_paper.rb
db/migrate/20150201224917_add_arxiv_details_to_paper.rb
class AddArxivDetailsToPaper < ActiveRecord::Migration def change add_column :papers, :arxiv_id, :string add_column :papers, :summary, :text add_column :papers, :author_list, :text add_index :papers, ["arxiv_id"] end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150525171135_create_fks_and_refactor.rb
db/migrate/20150525171135_create_fks_and_refactor.rb
class CreateFksAndRefactor < ActiveRecord::Migration def change delete_data refactor_columns create_foreign_keys create_assignees end def delete_data Annotation.delete_all Assignment.delete_all end def refactor_columns remove_index :annotations, name:'index_annotation_user_id'...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150202233833_add_location_data_to_annotation.rb
db/migrate/20150202233833_add_location_data_to_annotation.rb
class AddLocationDataToAnnotation < ActiveRecord::Migration def change add_column :annotations, :page, :integer add_column :annotations, :xStart, :float add_column :annotations, :yStart, :float add_column :annotations, :xEnd, :float add_column :annotations, :yEnd, :float end...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20140430233202_create_assignments.rb
db/migrate/20140430233202_create_assignments.rb
class CreateAssignments < ActiveRecord::Migration def change create_table :assignments do |t| t.integer :user_id t.integer :paper_id t.string :role t.integer :assignee_id t.timestamps end add_index "assignments", ["user_id"], :name => "index_assignment_user_id" add_i...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20140212023345_create_comments.rb
db/migrate/20140212023345_create_comments.rb
class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| t.integer :user_id t.integer :paper_id t.string :state t.integer :parent_id t.string :category t.text :body t.timestamps end add_index "comments", ["user_id"], :name => "i...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20140609021717_add_sha_to_user.rb
db/migrate/20140609021717_add_sha_to_user.rb
class AddShaToUser < ActiveRecord::Migration def change add_column :users, :sha, :string add_index :users, ["sha"] end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150404222351_remove.rb
db/migrate/20150404222351_remove.rb
class Remove < ActiveRecord::Migration def up execute <<-SQL UPDATE Papers SET state='submitted' WHERE state='pending' SQL end def down execute <<-SQL UPDATE Papers SET state='pending' WHERE state='submitted' SQL end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150630032056_rename_to_document_location_and_authors.rb
db/migrate/20150630032056_rename_to_document_location_and_authors.rb
class RenameToDocumentLocationAndAuthors < ActiveRecord::Migration def change rename_column :papers, :location, :document_location rename_column :papers, :author_list, :authors end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150607033009_remove_submitted_at_field.rb
db/migrate/20150607033009_remove_submitted_at_field.rb
class RemoveSubmittedAtField < ActiveRecord::Migration def change remove_column :papers, :submitted_at end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150808025904_add_complete_status_to_assignment.rb
db/migrate/20150808025904_add_complete_status_to_assignment.rb
class AddCompleteStatusToAssignment < ActiveRecord::Migration def change add_column :assignments, :reviewer_accept, :boolean, null:true, default:nil end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20140608024335_add_sha_to_paper.rb
db/migrate/20140608024335_add_sha_to_paper.rb
class AddShaToPaper < ActiveRecord::Migration def change add_column :papers, :sha, :string add_index :papers, ["sha"] end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20140211223942_add_oauth_tokens_to_users.rb
db/migrate/20140211223942_add_oauth_tokens_to_users.rb
class AddOauthTokensToUsers < ActiveRecord::Migration def change add_column :users, :oauth_token, :string add_column :users, :oauth_expires_at, :datetime add_column :users, :extra, :text add_column :users, :picture, :string add_index :users, ["oauth_token"] end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/db/migrate/20150616041205_add_public_and_completed_to_assignments.rb
db/migrate/20150616041205_add_public_and_completed_to_assignments.rb
class AddPublicAndCompletedToAssignments < ActiveRecord::Migration def change add_column :assignments, :public, :boolean, null:false, default:false add_column :assignments, :completed, :boolean, null:false, default:false reversible do |dir| dir.up do Assignment.reset_column_information ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/rails_helper.rb
spec/rails_helper.rb
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' require 'spec_helper' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'cancan/matchers' require 'action_controller/serialization_test_case' # Requires supporting ruby file...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/spec_helper.rb
spec/spec_helper.rb
# This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause this # file to always be loaded, without a need to explicitly require ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/support/spec_helpers.rb
spec/support/spec_helpers.rb
module SpecHelpers def fixture_path File.joing(__FILE__, '../../..', 'fixtures') end def fixture(filename) filename = File.join(fixture_path, filename) File.open(filename, 'r') end def fixture_text(filename) fixture(filename).readlines.join end def hash_from_json(json) return JSON....
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/support/has_sent_mail_patch.rb
spec/support/has_sent_mail_patch.rb
# Existing matchers don't check multipart emails correctly module Mail module Matchers class HasSentEmailMatcher def matches_on_body?(delivery) delivery.body == @body || delivery.body.encoded == @body end def matches_on_body_matcher?(delivery) (@body_matcher.match delivery.bo...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/support/controller_spec_helpers.rb
spec/support/controller_spec_helpers.rb
require 'active_support/concern' module ControllerSpecHelpers extend ActiveSupport::Concern attr_reader :current_user def authenticate(user=nil) if user.is_a?(Symbol) user = create(user) elsif user.nil? user = create(:user) end allow(controller).to receive(:current_user).and_return(...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/serializers/basic_paper_serializer_spec.rb
spec/serializers/basic_paper_serializer_spec.rb
require "rails_helper" describe BasicPaperSerializer do it "should initialize properly" do paper = build(:paper, document_location:"https://example.com", title:"Teh awesomeness") serializer = BasicPaperSerializer.new(paper) hash = hash_from_json(serializer.to_json) expect(hash.keys).to contain_exac...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/serializers/public_user_serializer_spec.rb
spec/serializers/public_user_serializer_spec.rb
require "rails_helper" describe PublicUserSerializer do it "should have the correct keys" do user = create(:user) serializer = PublicUserSerializer.new(user) hash = hash_from_json(serializer.to_json) expect(hash.keys).to contain_exactly("name", "email", "created_at", "picture", "sha") end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/serializers/authenticated_user_serializer_spec.rb
spec/serializers/authenticated_user_serializer_spec.rb
require "rails_helper" describe AuthenticatedUserSerializer do it "should have the correct keys" do user = create(:user) serializer = AuthenticatedUserSerializer.new(user) hash = hash_from_json(serializer.to_json) expect(hash.keys).to contain_exactly("name", "email", ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/serializers/assignment_serializer_spec.rb
spec/serializers/assignment_serializer_spec.rb
require "rails_helper" describe AssignmentSerializer do it "should initialize properly" do assignment = create(:assignment) serializer = AssignmentSerializer.new(assignment) hash = hash_from_json(serializer.to_json) expect(hash.keys).to contain_exactly('role', 'sha', 'user', 'public') end it "...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/serializers/basic_user_serializer_spec.rb
spec/serializers/basic_user_serializer_spec.rb
require "rails_helper" describe BasicUserSerializer do it "should have the correct keys" do user = create(:user) serializer = BasicUserSerializer.new(user) hash = hash_from_json(serializer.to_json) expect(hash.keys).to contain_exactly('name') end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/serializers/paper_serializer_spec.rb
spec/serializers/paper_serializer_spec.rb
require "rails_helper" describe PaperSerializer do it "should serialize properly" do user = create(:user) paper = build(:paper, document_location:"https://example.com", title:"Teh awesomeness", submittor:user) serializer = PaperSerializer.new(paper) hash = hash_from_json(serializer.to_json) ex...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/serializers/full_paper_serializer_spec.rb
spec/serializers/full_paper_serializer_spec.rb
require "rails_helper" describe FullPaperSerializer do it "should initialize properly" do user = create(:user) paper = create(:paper, document_location:"https://example.com", title:"Teh awesomeness", submittor:user) serializer = FullPaperSerializer.new(paper) hash = hash_from_json(serializer.to_jso...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/serializers/annotation_serializer_spec.rb
spec/serializers/annotation_serializer_spec.rb
require "rails_helper" describe AnnotationSerializer do it "should initialize properly" do annotation = create(:annotation) serializer = AnnotationSerializer.new(annotation) hash = hash_from_json(serializer.to_json) expect(hash).to include('id', 'paper_id', 'state', 'parent_id', ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/serializers/preview_paper_serializer_spec.rb
spec/serializers/preview_paper_serializer_spec.rb
require "rails_helper" describe PreviewPaperSerializer do it "should initialize properly" do current_user = create(:user) user = create(:user) paper = build(:paper, document_location:"https://example.com", title:"Teh awesomeness", submittor:user) serializer = PreviewPaperSerializer.new(paper, scop...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/factories/annotation.rb
spec/factories/annotation.rb
FactoryGirl.define do factory :annotation do body "You know, this really isn't good enough" created_at { Time.now } updated_at { Time.now } ignore do user nil paper nil parent nil state nil end factory :root, aliases:[:issue] factory...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/factories/assignment.rb
spec/factories/assignment.rb
FactoryGirl.define do factory :assignment do user paper role 'collaborator' created_at { Time.now } updated_at { Time.now } trait :collaborator do role 'collaborator' end trait :reviewer do role 'reviewer' end trait :editor do role 'editor...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/factories/paper.rb
spec/factories/paper.rb
FactoryGirl.define do factory :paper do document_location "https://example.com/1234" state "submitted" title "My awesome paper" summary "Summary of my awesome paper" authors "John Smith, Paul Adams, Ella Fitzgerald" association :submittor,...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/factories/user.rb
spec/factories/user.rb
FactoryGirl.define do factory :user do provider 'orcid' name 'John Doe' created_at { Time.now } admin false editor false factory :admin do name 'John Admin' admin true end factory :editor do name 'John the Editor' editor true end end end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/controllers/sessions_controller_spec.rb
spec/controllers/sessions_controller_spec.rb
require "rails_helper" describe SessionsController do describe "#orcid_name_for" do it "queries the ORCID API for the username based upon the ORCID ID" do stub_request(:get, "https://pub.orcid.org/v1.1/0000-0001-7857-2795/orcid-bio"). with(headers: {'Accept'=>'application/orcid+json'}). t...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/controllers/admin_controller_spec.rb
spec/controllers/admin_controller_spec.rb
require "rails_helper" describe AdminController do end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/controllers/home_controller_spec.rb
spec/controllers/home_controller_spec.rb
require "rails_helper" describe HomeController do # Testing all the things end
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/controllers/papers_controller_spec.rb
spec/controllers/papers_controller_spec.rb
require "rails_helper" describe PapersController do describe "GET #badge" do render_views it "WITHOUT USER responds successfully with an HTTP 200 status code and response" do paper = create(:paper, :review_completed) get :badge, identifier:paper.typed_provider_id, format:'html' expect(r...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/controllers/feed_controller_spec.rb
spec/controllers/feed_controller_spec.rb
require "rails_helper" describe FeedController do describe 'GET #arxiv' do let(:a_date) { Time.new(2015, 1, 2, 12, 4, 5) } def create_paper(attributes={}) attributes = { state: 'published', provider_type: 'arxiv', created_at: a_date }.merge(attributes)...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/controllers/api/v1/users_controller_spec.rb
spec/controllers/api/v1/users_controller_spec.rb
require "rails_helper" describe Api::V1::UsersController do describe "GET #show" do context "when no user is authenticated" do it "responds successfully with an HTTP 200 status code" do get :show, :format => :json expect(response).to have_http_status(:ok) end it "should ret...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/controllers/api/v1/papers_controller_spec.rb
spec/controllers/api/v1/papers_controller_spec.rb
require "rails_helper" describe Api::V1::PapersController do let(:arxiv_doc) { { provider_type: :arxiv, provider_id: "1311.1653", version: 2, authors: "Mar Álvarez-Álvarez, Angeles I. Díaz", document_location: "https://arxiv.org/pdf/1311.165...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/controllers/api/v1/annotations_controller_spec.rb
spec/controllers/api/v1/annotations_controller_spec.rb
require "rails_helper" describe Api::V1::AnnotationsController do describe "POST #create" do it "should succeed" do user = authenticate paper = create(:paper, :under_review, submittor:user) post :create, paper_identifier:paper.typed_provider_id, annotation: { body:'An is...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/controllers/api/v1/assignments_controller_spec.rb
spec/controllers/api/v1/assignments_controller_spec.rb
require "rails_helper" describe Api::V1::AssignmentsController do describe "GET #index" do it "should return the list of reviewers" do paper = create(:paper) get :index, paper_identifier:paper.typed_provider_id, format: :json expect(response.content_type).to eq("application/json") exp...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/models/provider_spec.rb
spec/models/provider_spec.rb
require "rails_helper" describe Provider do describe "[]" do it "should return a provider" do expect( Provider[:arxiv] ).to be(Provider::ArxivProvider) end it "should not be case sensitive" do expect( Provider[:Arxiv] ).to be(Provider::ArxivProvider) end it "should accept a strin...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/models/paper_spec.rb
spec/models/paper_spec.rb
require "rails_helper" describe Paper do let(:arxiv_doc) do { provider_type: :arxiv, provider_id: "1311.1653", version: 2, authors: "Mar Álvarez-Álvarez, Angeles I. Díaz", document_location: "https://arxiv.org/pdf/1311.1653v2.pdf", ti...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/models/annotation_spec.rb
spec/models/annotation_spec.rb
require "rails_helper" describe Annotation do describe '#responses' do it "should return responses" do paper = create(:paper, :submitted) first_annotation = create(:annotation, paper:paper) second_annotation = create(:annotation, paper:paper, parent:first_annotation) first_annotatio...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/models/user_spec.rb
spec/models/user_spec.rb
require "rails_helper" describe User do it "should initialize properly" do user = create(:user) assert !user.sha.nil? expect(user.sha.length).to eq(32) end describe "validation" do describe "email" do it "should validate nil" do u = build(:user, email:nil) expect(u).to ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/models/assignment_spec.rb
spec/models/assignment_spec.rb
require "rails_helper" describe Assignment do let(:arxiv_doc) do { provider_type: :arxiv, provider_id: "1311.1653", version: 2, authors: "Mar Álvarez-Álvarez, Angeles I. Díaz", document_location: "https://arxiv.org/pdf/1311.1653v2.pdf", ...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/models/provider/arxiv_provider_spec.rb
spec/models/provider/arxiv_provider_spec.rb
require_relative 'shared_provider_specs' require "rails_helper" describe Provider::ArxivProvider do def stub_document stub_request(:get, "http://export.arxiv.org/api/query?id_list=1311.1653v2").to_return(fixture('arxiv/1311.1653v2.xml')) end def stub_document_without_version stub_request(:get, "http://...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false
openjournals/theoj
https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/spec/models/provider/shared_provider_specs.rb
spec/models/provider/shared_provider_specs.rb
require "rails_helper" shared_examples 'All providers' do def provider; described_class; end it "should have the required class interface" do expect(provider).to respond_to(:type).with(0).arguments expect(provider).to respond_to(:get_attributes).with(1).argument expect(provider).to respond_to(:full_i...
ruby
MIT
73c6acccc0aefe64b0030c818f405b25b7e7b589
2026-01-04T17:49:58.613320Z
false