source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
dannnylo/sidekiq-belt
https://github.com/dannnylo/sidekiq-belt
lib/sidekiq/belt/ent/periodic_run.rb
Ruby
mit
19
main
2,407
# frozen_string_literal: true require "sidekiq/web/helpers" module Sidekiq module Belt module Ent module PeriodicRun def run args = begin JSON.parse(options)["args"] rescue StandardError {} end Module.const_get(klass).perform_async(*...
github
dannnylo/sidekiq-belt
https://github.com/dannnylo/sidekiq-belt
lib/sidekiq/belt/ent/periodic_pause.rb
Ruby
mit
19
main
1,475
# frozen_string_literal: true require "sidekiq/web/helpers" module Sidekiq module Belt module Ent module PeriodicPause module SidekiqLoopsPeriodicPause PAUSE_BUTTON = <<~ERB name="pause" data-confirm="Pause the job <%= loup.klass %>? <%= t('AreYouSure') %>" ERB ...
github
dannnylo/sidekiq-belt
https://github.com/dannnylo/sidekiq-belt
lib/sidekiq/belt/ent/periodic_sort.rb
Ruby
mit
19
main
585
# frozen_string_literal: true require "sidekiq/web/helpers" module Sidekiq module Belt module Ent module PeriodicSort module SidekiqLoopsPeriodicSort def each(&block) @lids.map { |lid| Sidekiq::Periodic::Loop.new(lid) }.sort_by(&:klass).each(&block) end end ...
github
dannnylo/sidekiq-belt
https://github.com/dannnylo/sidekiq-belt
lib/sidekiq/belt/pro/failed_batch_remove.rb
Ruby
mit
19
main
1,525
# frozen_string_literal: true require "sidekiq/web/helpers" module Sidekiq module Belt module Pro module FailedBatchRemove module SidekiqFailedBatchRemove REMOVE_BUTTON = <<~ERB <form action="<%= root_path %>batches/<%= bid %>/remove" method="post"> <%= csrf_tag...
github
dannnylo/sidekiq-belt
https://github.com/dannnylo/sidekiq-belt
lib/sidekiq/belt/pro/force_batch_callback.rb
Ruby
mit
19
main
1,972
# frozen_string_literal: true require "sidekiq/web/helpers" module Sidekiq module Belt module Pro module ForceBatchCallback module SidekiqForceBatchCallback def self.action_button(action) <<~ERB <form action="<%= root_path %>batches/<%= @batch.bid %>/force_callb...
github
dannnylo/sidekiq-belt
https://github.com/dannnylo/sidekiq-belt
lib/sidekiq/belt/pro/files.rb
Ruby
mit
19
main
573
# frozen_string_literal: true require "sidekiq" require_relative "failed_batch_remove" require_relative "force_batch_callback" module Sidekiq module Belt module Pro module Files def self.use!(options = [:all]) return unless Sidekiq.pro? all = options.include?(:all) ...
github
yoshoku/magro
https://github.com/yoshoku/magro
Rakefile
Ruby
bsd-3-clause
19
main
509
# frozen_string_literal: true require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) require 'rubocop/rake_task' RuboCop::RakeTask.new require 'rake/extensiontask' task build: :compile # rubocop:disable Rake/Desc desc 'Run clang-format' task 'clang-format' do sh 'clang-form...
github
yoshoku/magro
https://github.com/yoshoku/magro
magro.gemspec
Ruby
bsd-3-clause
19
main
1,831
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'magro/version' Gem::Specification.new do |spec| spec.name = 'magro' spec.version = Magro::VERSION spec.authors = ['yoshoku'] spec.email = ['yoshoku...
github
yoshoku/magro
https://github.com/yoshoku/magro
Gemfile
Ruby
bsd-3-clause
19
main
447
# frozen_string_literal: true source 'https://rubygems.org' # Specify your gem's dependencies in magro.gemspec gemspec gem 'rake', '~> 13.0' gem 'rake-compiler', '~> 1.0' gem 'rbs', '~> 1.2' gem 'rspec', '~> 3.0' gem 'rubocop', '~> 1.24' gem 'rubocop-performance', '~> 1.14' gem 'rubocop-rake', '~> 0.7' gem 'rubocop-...
github
yoshoku/magro
https://github.com/yoshoku/magro
lib/magro/transform.rb
Ruby
bsd-3-clause
19
main
2,743
# frozen_string_literal: true module Magro # Transform module provide functions of image transfom. module Transform module_function # Resizes an image with bilinear interpolation method. # # @example # require 'numo/narray' # require 'magro' # # image = Numo::UInt8.new(16, 16...
github
yoshoku/magro
https://github.com/yoshoku/magro
lib/magro/io.rb
Ruby
bsd-3-clause
19
main
3,194
# frozen_string_literal: true require 'open-uri' require 'tempfile' module Magro # IO module provides functions for input and output of image file. module IO module_function # Loads an image from file. # @param filename [String] File path or URL of image file to be loaded. # Currently, the foll...
github
yoshoku/magro
https://github.com/yoshoku/magro
lib/magro/filter.rb
Ruby
bsd-3-clause
19
main
4,891
# frozen_string_literal: true module Magro # Filter module provides functions for image filtering. module Filter module_function # Applies box filter to image. # This method performs zero padding as a preprocessing. # # @example # image = Magro::IO.imread('foo.png') # kernel = Numo...
github
yoshoku/magro
https://github.com/yoshoku/magro
spec/spec_helper.rb
Ruby
bsd-3-clause
19
main
624
# frozen_string_literal: true require 'simplecov' SimpleCov.start require 'bundler/setup' require 'magro' if defined?(GC.verify_compaction_references) == 'method' # Calling this method will help to find object movement bugs. GC.verify_compaction_references(double_heap: true, toward: :empty) end RSpec.configure ...
github
yoshoku/magro
https://github.com/yoshoku/magro
spec/magro/io_spec.rb
Ruby
bsd-3-clause
19
main
7,909
# frozen_string_literal: true RSpec.describe Magro::IO do let(:img_red) do Numo::UInt8[[255, 255, 255, 0, 0], [255, 255, 255, 0, 0], [255, 255, 0, 128, 128], [0, 0, 0, 255, 255], [0, 0, 0, 255, 255]] end let(:img_green) do Numo::UInt8[[0, 0,...
github
yoshoku/magro
https://github.com/yoshoku/magro
spec/magro/filter_spec.rb
Ruby
bsd-3-clause
19
main
2,031
# frozen_string_literal: true RSpec.describe Magro::Filter do context 'when given image is grayscale image' do let(:image) do # rubocop:disable Layout/ExtraSpacing, Layout/SpaceInsideArrayLiteralBrackets Numo::UInt8[ [ 0, 32, 0, 32, 0], [32, 0, 128, 0, 32], [ 0, 128, ...
github
yoshoku/magro
https://github.com/yoshoku/magro
spec/magro/transform_spec.rb
Ruby
bsd-3-clause
19
main
2,509
# frozen_string_literal: true RSpec.describe Magro::Transform do describe '#resize' do let(:small) do Numo::UInt8[[56, 8], [8, 32]] end let(:large) do Numo::UInt8[[56, 44, 20, 8], [44, 37, 22, 14], [20, 22, 25, 26], [8, ...
github
yoshoku/magro
https://github.com/yoshoku/magro
ext/magro/extconf.rb
Ruby
bsd-3-clause
19
main
1,069
require 'mkmf' require 'numo/narray' $LOAD_PATH.each do |lp| if File.exist?(File.join(lp, 'numo/numo/narray.h')) $INCFLAGS = "-I#{lp}/numo #{$INCFLAGS}" break end end abort 'numo/narray.h not found.' unless have_header('numo/narray.h') if RUBY_PLATFORM =~ /mswin|cygwin|mingw/ $LOAD_PATH.each do |lp| ...
github
PecanProject/bety
https://github.com/PecanProject/bety
Rakefile
Ruby
bsd-3-clause
19
develop
270
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) require 'rake' BetyRails5::Application.load_tasks
github
PecanProject/bety
https://github.com/PecanProject/bety
Gemfile
Ruby
bsd-3-clause
19
develop
2,651
source "http://rubygems.org" gem "rails", "5.2.4.6" # needed for rails 3.1 and above until we phase out prototype: ## gem 'prototype-rails', github: 'rails/prototype-rails', branch: '4.2' # see https://github.com/rails/prototype-rails/issues/37 gem "nokogiri" gem "narray", "0.6.0.4" gem "choice", "0.1.6" gem "comma", ...
github
PecanProject/bety
https://github.com/PecanProject/bety
script/insert_managements.rb
Ruby
bsd-3-clause
19
develop
10,242
#!/usr/bin/env ruby # -*- coding: utf-8 -*- # define constants REQUIRED_HEADINGS = ['citation_author', 'citation_title', 'citation_year', 'treatment_name', 'mgmttype'] OPTIONAL_HEADINGS = [ 'date', 'dateloc', 'level', 'units', 'notes' ] RECOGNIZED_HEADINGS = REQUIRED_HEADINGS + OPTIONAL_HEADINGS MANAGEMENT_INSERT_TE...
github
PecanProject/bety
https://github.com/PecanProject/bety
script/db_maintenance/find_missing_constraints.rb
Ruby
bsd-3-clause
19
develop
5,936
#!/usr/bin/env ruby # coding: utf-8 USAGE_DETAILS = <<'EOS' DESCRIPTION This script attempts to find missing foreign-key constraints by finding column names of the form "xxx_id" and checking to see if there is an existing corresponding foreign-key constraint. Certain columns with names of the form "xxx_id" that are ...
github
PecanProject/bety
https://github.com/PecanProject/bety
script/db_maintenance/validate_constraints.rb
Ruby
bsd-3-clause
19
develop
7,635
#!/usr/bin/env ruby # coding: utf-8 USAGE_DETAILS = <<'EOS' DESCRIPTION This script attempts to validate existing CHECK and/or FOREIGN KEY constraints and prints out the results of the attempt. BACKGROUND AND EXPLANATION OF OPTIONS A constraint added to an existing table may be marked NOT VALID when it is added in...
github
PecanProject/bety
https://github.com/PecanProject/bety
script/db_maintenance/fix_database.rb
Ruby
bsd-3-clause
19
develop
4,089
#!/usr/bin/env ruby # coding: utf-8 USAGE_DETAILS = <<'EOS' DESCRIPTION This script generates a file of SQL statements to fix the sequence objects and table ids in the public schema of the specified BETYdb database. It assumes id numbers were mis-allocated in the 99 billion range and that rows having ids in that ra...
github
PecanProject/bety
https://github.com/PecanProject/bety
script/db_maintenance/lib/id_fixer.rb
Ruby
bsd-3-clause
19
develop
6,273
require_relative 'enhanced_connection' class IdFixer < EnhancedConnection WrongMachineId = 99 PublicSequenceQuery = <<PSQ SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = 'public' PSQ SequenceInfoQuery = <<SIQ SELECT sequence_name, last_value, is_called FROM %s SIQ ...
github
PecanProject/bety
https://github.com/PecanProject/bety
script/db_maintenance/lib/postgres_helpers.rb
Ruby
bsd-3-clause
19
develop
1,771
module PostgresHelpers ConnectionSpecFileName = 'connection_specification.yml' # Convenience method for prompting. # Returns chomped response, or default if given and response is empty def prompt(prompt_string = "?", default = "") print "#{prompt_string} (#{default}) " response = gets response.cho...
github
PecanProject/bety
https://github.com/PecanProject/bety
script/db_maintenance/lib/enhanced_connection.rb
Ruby
bsd-3-clause
19
develop
1,280
require 'pg' require 'yaml' require_relative 'postgres_helpers' class EnhancedConnection < PG::Connection include PostgresHelpers PublicTableQuery = <<PTQ SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND is_insertable_into = 'YES' PTQ # Initialize the ...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/simple_search.rb
Ruby
bsd-3-clause
19
develop
6,518
# Add SEARCH_INCLUDES & SEARCH_FIELDS to your class to narrow the search scope. # # Not adding them will search all fields in your class, but not other classes. # _Must_ include SEARCH_FIELDS if you want to search related classes using SEARCH_INCLUDES. # # Searches entire day range (00:00 -> 23:59) when doing date sear...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/authenticated_test_helper.rb
Ruby
bsd-3-clause
19
develop
400
module AuthenticatedTestHelper # Sets the current user in the session from the user fixtures. def login_as(user) @request.session[:user_id] = user ? (user.is_a?(User) ? user.id : users(user).id) : nil end def authorize_as(user) @request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentic...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/data_access.rb
Ruby
bsd-3-clause
19
develop
1,842
module DataAccess # Limit search results according to the current user's data access # permissions, or, if no user is logged in, limit access to checked # data of access level 4. # # Administrators (that is, users with page_access_level 1) have view # access to all data, checked or not. Managers can access...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/symbolize_helper.rb
Ruby
bsd-3-clause
19
develop
789
# This code is from http://apidock.com/rails/Hash/deep_symbolize_keys # To be able to call Hash#deep_symbolize_keys, first call # # using SymbolizeHelper # # Rails 4.02 defines a slightly less powerful version of deep_symbolize_keys. # It doesn't symbolize hashes in nested arrays, but it may suffice for our # purpose...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/mercator.rb
Ruby
bsd-3-clause
19
develop
1,857
module Mercator #MercatorProjection code from: http://ym4r.rubyforge.org/ #Structure that contains configuration data for the WMS tiler FurthestZoom = Struct.new(:ul_corner, :zoom, :tile_size) #Contains LatLon coordinates LatLng = Struct.new(:lat,:lng) #Contain projected coordinates (in pixel or meter...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/advanced_search.rb
Ruby
bsd-3-clause
19
develop
3,241
# A module to be used inside models to facilitate searching. Since we # want the ::advanced_search method to be a class method, use # # <tt>extend AdvancedSearch</tt> # # at the class level. module AdvancedSearch # Given the string +search+, which will usually be one or more words # or parts of words, generates a...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/authenticated_system.rb
Ruby
bsd-3-clause
19
develop
22,657
module AuthenticatedSystem protected # Returns the numeric level of access for each user id # or 100 as each level will contain at least the rights # of the level below it. #def access_level(user_id) # #Access levels # admin = [1,2,3,4,5,6] # data_managers = [] # ebi_collaborators ...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/coordinate_search.rb
Ruby
bsd-3-clause
19
develop
751
module CoordinateSearch # degrees lat ~ miles/69.1 # degrees lng ~ miles/53.0 (at the 40th parallels) def coordinate_search(params) if (params[:mapDisplayed] == "true" && (params[:mapSearchMode] == "by site" || params[:mapSearchMode] == "by region")) lat = params[:lat][/-?\d+\.?\d*/].to_f ...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/tasks/databases-hack.rake
Ruby
bsd-3-clause
19
develop
1,658
=begin # An incompatibility between the active-record-3.2.21 and # activerecord-postgis-adapter-0.6.6 rails3 rake files makes these # hacks necessary. # The definition of db:test:load_structure given at # "gems/activerecord-3.2.21/lib/active_record/railties/databases.rake:501" # runs its prerequisite (db:test:purge) a...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/tasks/document_db_schema.rake
Ruby
bsd-3-clause
19
develop
10,087
namespace :bety do ### METHODS ### # Things we may want to run more than once are defined as methods. def run_schema_spy ensure_parameters_are_set host = @config["host"] database = @config["database"] username = @config["username"] password = @config["password"] sh "#{@java} -jar ...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/tasks/document_betydb.rake
Ruby
bsd-3-clause
19
develop
1,634
# This test is needed because we don't load YARD in all environments: if defined? YARD # Define the "yard" task: YARD::Rake::YardocTask.new do |t| # Most options are set in the .yardopts file under the Rails root # directory rather than here. # Uncomment this to get a report of all undocumented methods...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/tasks/databases.rake
Ruby
bsd-3-clause
19
develop
2,749
# Task for ensuring script/load.bety.sh exists file "script/load.bety.sh" do puts "downloading load.bety.sh" url = "https://raw.githubusercontent.com/PecanProject/pecan/master/scripts/load.bety.sh" `cd script && curl -LOs #{url}` # curl may create a load.bety.sh file with contents "Not Found" if we get a 404 e...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/tasks/change_logger_to_stdout.rake
Ruby
bsd-3-clause
19
develop
428
desc <<DESCRIPTION Change logger to STDOUT When this task is listed command line, tasks following it will be logged to STDOUT instead of to the default log file. In particular, using this with the migration task ("rake log db:migrate") will display what SQL commands are run to effect the migra...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/tasks/schemaSpyConfigTemplate.rb
Ruby
bsd-3-clause
19
develop
3,253
# In order to generate the SchemaSpy documentation of the BETYdb database schema # (rake task "bety:dbdocs"), you have to specify an output directory and the # locations of the Java executatable and the required Jar files. This may # either be done by creating a configuration file "schemaSpyConfig.rb" in this # direct...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/tasks/make_keys.rake
Ruby
bsd-3-clause
19
develop
332
namespace :bety do desc "create api key for users without one" task :make_keys => :environment do users = User.where("apikey is NULL") users.each do |user| user.create_apikey if user.save ContactMailer::apikey_email(user).deliver end end puts "api key created for every use...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/tasks/update_comments.rake
Ruby
bsd-3-clause
19
develop
6,186
namespace :bety do namespace :db do # This is a subsidiary task. It should be a prerequisite for any # task that calls the table_2_model method. It loads each model # found in the app/models directory. task :load_models => :environment do Dir.foreach(Rails.root.join("app", "models")) do ...
github
PecanProject/bety
https://github.com/PecanProject/bety
lib/tasks/notes.rake
Ruby
bsd-3-clause
19
develop
1,446
### This is modified from sample code at http://crypt.codemancers.com/posts/2013-07-12-redefine-rake-routes-to-add-your-own-custom-tag-in-Rails/ ### ### It is intended so users may spell "TODO" annotations in various ways. It also adds some additional search tags and search directories. # This block redefines SourceA...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/rails_helper.rb
Ruby
bsd-3-clause
19
develop
3,346
# This file is copied to spec/ when you run 'rails generate rspec:install' 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? requ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/views/treatments/show.html.erb_spec.rb
Ruby
bsd-3-clause
19
develop
255
describe "treatments/show" do before(:each) do @treatment = assign(:treatment, Treatment.first) end it "renders attributes in <p>" do render # Run the generator again with the --webrat flag if you want to use webrat matchers end end
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/views/treatments/new.html.erb_spec.rb
Ruby
bsd-3-clause
19
develop
358
describe "treatments/new" do before(:each) do assign(:treatment, Treatment.new) assign(:current_user, User.new) end it "renders new treatment form" do render # Run the generator again with the --webrat flag if you want to use webrat matchers assert_select "form[action=?][method=?]", treatmen...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/views/treatments/edit.html.erb_spec.rb
Ruby
bsd-3-clause
19
develop
430
describe "treatments/edit" do before(:each) do @treatment = assign(:treatment, Treatment.first) assign(:management, Management.new) assign(:current_user, User.new) end it "renders the edit treatment form" do render # Run the generator again with the --webrat flag if you want to use webrat ma...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/controllers/sessions_controller_spec.rb
Ruby
bsd-3-clause
19
develop
2,610
describe SessionsController do describe "GET 'login'" do it "should be successful" do get 'create' expect(response).to be_success end # it "should have 'Log In'" do # get 'create' # puts "####" # puts response # response.should have_content('Log In') ## response.should...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/controllers/bulk_upload_controller_spec.rb
Ruby
bsd-3-clause
19
develop
8,690
describe BulkUploadController, :type => :controller do class BulkUploadController # override the login requirement for testing: before_action :login_required, only: [] end describe "display csv file" do before(:each) do get 'start_upload' end context "test general" do it "shou...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/controllers/treatments_controller_spec.rb
Ruby
bsd-3-clause
19
develop
6,897
# This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to specify the controller code that # was generated by Rails when you ran the scaffold generator. # # It assumes that the implementation code is generated by the rails scaffold # generator. If you ar...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/controllers/traits_controller_spec.rb
Ruby
bsd-3-clause
19
develop
3,156
describe TraitsController do let(:session) { {user_id: 512127716} } let(:valid_attr){ {:mean => '2'} } let(:invalid_attr){ {:mean => "-1",:stat => "a"} } let(:valid_covariate){ [{'variable_id' => '404','level' =>'10'}] } let(:invalid_covariate){ [{'variable_id' => '404','level' =>'50'}] ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/controllers/users_controller_spec.rb
Ruby
bsd-3-clause
19
develop
529
describe UsersController do # describe "GET 'login'" do # it "should be successful" do # get 'create' # response.should be_success # end # end # # # context 'User login with captcha' do # it 'should login with correct recaptcha' do # SessionsController.any_instance.expects(:verify_recapt...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/pft_integration_spec.rb
Ruby
bsd-3-clause
19
develop
3,921
require 'support/helpers' include LoginHelper feature 'Pfts features work works' do before :each do login_test_user end context 'GET /pfts' do before :each do visit '/pfts' end it 'should have "Listing pfts" ' do expect(page).to have_content 'Listing PFTs' end # tests for ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/user_integration_spec.rb
Ruby
bsd-3-clause
19
develop
1,474
require 'support/helpers' include LoginHelper feature 'Users index works' do before :each do login_test_user end context 'GET /users' do it 'should have "Listing Users" ' do visit '/users' expect(page).to have_content 'Listing Users' end context 'clicking view user button' do i...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/input_integration_spec.rb
Ruby
bsd-3-clause
19
develop
1,271
require 'support/helpers' include LoginHelper feature 'Inputs features work' do before :each do login_test_user visit '/inputs/' end specify 'The input edit page should be accessible' do first(:xpath, './/a[@alt = "edit"]').click expect(page).to have_content 'Editing Input' end context 'Edi...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/bulk_upload_integration_2_spec.rb
Ruby
bsd-3-clause
19
develop
28,422
require 'support/helpers' include LoginHelper include BulkUploadHelper feature 'Bulk Data Upload' do before :each do login_test_user end context 'Non-strictly matching DOI is OK' do before :all do f = File.new("spec/tmp/yield_by_doi.csv", "w") f.write <<CSV yield,citation_doi 4.23,10.213...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/sitegroup_integration_spec.rb
Ruby
bsd-3-clause
19
develop
6,577
require 'support/helpers' include LoginHelper # Override the default path "#{::Rails.root}/spec/fixtures" RSpec.configure do |config| config.fixture_path = "#{::Rails.root}/test/fixtures" end feature 'Authorization:' do fixtures :sitegroups let(:private_sitegroup) { sitegroups(:private_sitegroup) } let(:pu...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/variable_integration_spec.rb
Ruby
bsd-3-clause
19
develop
1,368
require 'support/helpers' include LoginHelper feature 'Variables index works' do before :each do login_test_user end context 'GET /variables' do it 'should have "Listing variables" ' do visit '/variables' expect(page).to have_content 'Listing Variables' end it 'should allow creation...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/citation_integration_spec.rb
Ruby
bsd-3-clause
19
develop
3,953
require 'support/helpers' include LoginHelper feature 'Citation features work' do before :each do login_test_user end context 'GET /citations/new', :type => :feature do it 'should have "New Citation" ' do visit '/citations/new' expect(page).to have_content 'New Citation' end ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/management_integration_spec.rb
Ruby
bsd-3-clause
19
develop
3,731
require 'support/helpers' include LoginHelper feature 'Management features work' do before :each do login_test_user visit '/managements/' end context 'GET /managements' do it 'should have "Listing Managements" ' do expect(page).to have_content 'Listing Managements' end it 'should allo...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/cultivars_integration_spec.rb
Ruby
bsd-3-clause
19
develop
2,100
require 'support/helpers' include LoginHelper feature 'Cultivars index works' do before :each do login_test_user end context 'GET /cultivars' do it 'should have "Listing Cultivars" ' do visit '/cultivars' expect(page).to have_content 'Listing Cultivars' end end context 'GET /cultiva...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/format_integration_spec.rb
Ruby
bsd-3-clause
19
develop
1,263
require 'support/helpers' include LoginHelper feature 'Formats index works' do before :each do login_test_user end context 'GET /formats/new' do it 'should have "New Format" ' do visit '/formats/new' expect(page).to have_content 'New Format' end it 'should allow creation of new form...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/static_integration_spec.rb
Ruby
bsd-3-clause
19
develop
211
feature 'Citation index works' do context 'Visiting root_path' do it 'should result in current_path equaling "/"' do visit root_path expect(current_path).to eq '/' end end end
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/model_integration_spec.rb
Ruby
bsd-3-clause
19
develop
1,527
require 'support/helpers' include LoginHelper feature 'Models features work' do before :each do login_test_user end specify 'The model edit page should be accessible' do visit '/models/' first(:xpath, './/a[@alt = "edit"]').click expect(page).to have_content 'Editing Model' end context 'Edi...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/trait_integration_spec.rb
Ruby
bsd-3-clause
19
develop
5,108
require 'support/helpers' include LoginHelper, AutocompletionHelper feature 'Traits index works' do before :each do login_test_user end context 'GET /traits' do it 'should have "Listing Traits" ' do visit '/traits' expect(page).to have_content 'Listing Traits' end context 'clicking ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/treatment_integration_spec.rb
Ruby
bsd-3-clause
19
develop
4,043
require 'support/helpers' include LoginHelper feature 'Treatment features work' do before :each do login_test_user end context 'New Treatments' do it 'should have a "New Treatment" page' do visit '/treatments/new' expect(page).to have_content 'New Treatment' end it 'should al...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/entitiy_integration_spec.rb
Ruby
bsd-3-clause
19
develop
1,669
require 'support/helpers' include LoginHelper feature 'Entities index works' do before :each do login_test_user end context 'GET /entities' do it 'should have "Listing Entities" ' do visit '/entities' expect(page).to have_content 'Listing Entities' end it 'should have "New Entity" '...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/prior_integration_spec.rb
Ruby
bsd-3-clause
19
develop
2,606
require 'support/helpers' include LoginHelper, AutocompletionHelper feature 'Priors index works' do before :each do login_test_user end context 'GET /priors' do it 'should have "Listing Priors" ' do visit '/priors' expect(page).to have_content 'Listing Priors' end it 'should allow c...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/site_integration_spec.rb
Ruby
bsd-3-clause
19
develop
2,777
require 'support/helpers' include LoginHelper feature 'Sites index works' do before :each do login_test_user end context 'GET /sites' do it 'should have "Listing Sites" ' do visit '/sites' expect(page).to have_content 'Listing Sites' end it 'should allow creation of new sites' do ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/work_flow_spec.rb
Ruby
bsd-3-clause
19
develop
582
# the test for the work_flow page require 'support/helpers' include LoginHelper feature 'Work_flow index works' do before :each do login_test_user end subject { page} context 'GET /workflows' do it 'should have "Listing Workflows" ' do visit workflows_path expect(page).to have_content 'Li...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/ensemble_integration_spec.rb
Ruby
bsd-3-clause
19
develop
952
require 'support/helpers' include LoginHelper feature 'Ensembles work' do before :each do login_test_user end context 'GET /ensembles' do it 'should have "Listing Ensembles" ' do visit '/ensembles' expect(page).to have_content 'Listing Ensembles' end # to-do: move this to a routing ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/user_creation_spec.rb
Ruby
bsd-3-clause
19
develop
1,349
describe "Signup page", :type => :request do describe "GET /signup" do it "should return a valid response" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get "/signup" expect(response.status).to be(200) end end end feature 'User creation w...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/session_integration_spec.rb
Ruby
bsd-3-clause
19
develop
1,256
describe "Login page", :type => :request do describe "GET /login" do it "should return a valid response" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get "/login" expect(response.status).to be(200) end end end feature 'Login works' do ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/covariate_integration_spec.rb
Ruby
bsd-3-clause
19
develop
493
require 'support/helpers' include LoginHelper feature 'Covariate pages work' do before :each do login_test_user end context 'GET /covariates' do it 'should have "Listing Covariates" ' do visit '/covariates' expect(page).to have_content 'Listing Covariates' end end specify 'Individua...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/yield_integration_spec.rb
Ruby
bsd-3-clause
19
develop
7,031
require 'support/helpers' include LoginHelper feature 'Yields pages work' do context 'Logged on as Administrator' do before :each do login_test_user end # it 'should have "Listing Yields" ' do # visit '/yields' # page.should have_content 'Listing Yields' # end it 'should forward ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/method_integration_spec.rb
Ruby
bsd-3-clause
19
develop
1,513
require 'support/helpers' include LoginHelper feature 'Methods index works' do before :each do login_test_user end context 'GET /methods' do it 'should have "Listing Methods" ' do visit '/methods' expect(page).to have_content 'Listing Methods' end it 'should allow creation of new me...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/posterior_search_spec.rb
Ruby
bsd-3-clause
19
develop
714
# test for redmine task #1908 require 'support/helpers' include LoginHelper feature 'Posteriors search' do before :each do login_test_user end it 'should list posteriors' do visit '/posteriors' expect(page).to have_content 'Listing Posteriors' end context 'search on posteriors' do it 'sh...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/bulk_upload_integration_spec.rb
Ruby
bsd-3-clause
19
develop
3,307
require 'support/helpers' include LoginHelper include BulkUploadHelper feature 'CSV file upload works' do before :each do login_test_user end context 'GET /bulk_upload/start_upload' do it 'should upload the given file' do visit '/bulk_upload/start_upload' attach_file 'CSV file', Rails.roo...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/features/specie_integration_spec.rb
Ruby
bsd-3-clause
19
develop
1,916
require 'support/helpers' include LoginHelper feature 'Species pages work' do before :each do login_test_user end context 'GET /species' do it 'should have "Listing Species" ' do visit '/species' expect(page).to have_content 'Listing Species' end end context 'GET /species/new' do ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/helpers/static_helper_spec.rb
Ruby
bsd-3-clause
19
develop
385
# Specs in this file have access to a helper object that includes # the StaticHelper. For example: # # describe StaticHelper do # describe "string concat" do # it "concats two strings with spaces" do # helper.concat_strings("this","that").should == "this that" # end # end # end describe StaticHelper d...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/helpers/test_helper.rb
Ruby
bsd-3-clause
19
develop
723
# Transactional fixtures do not work with Selenium tests, because Capybara # uses a separate server thread, which the transactions would be hidden # from. We hence use DatabaseCleaner to truncate our test database. DatabaseCleaner.strategy = :truncation class ActionDispatch::IntegrationTest # Make the Capybara DSL a...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/helpers/sessions_helper_spec.rb
Ruby
bsd-3-clause
19
develop
391
# Specs in this file have access to a helper object that includes # the SessionsHelper. For example: # # describe SessionsHelper do # describe "string concat" do # it "concats two strings with spaces" do # helper.concat_strings("this","that").should == "this that" # end # end # end describe SessionsHe...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/routing/pfts_routing_spec.rb
Ruby
bsd-3-clause
19
develop
425
require "spec_helper" describe PftsController do describe "routing" do it "allows posting to /pfts/1/edit2_pfts_species" do expect(post("/pfts/1/edit2_pfts_species")).to route_to("pfts#edit2_pfts_species", { "id" => "1" }) end it "allows getting /pfts/1/edit2_pfts_species" do expect(get("/p...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/routing/species_routing_spec.rb
Ruby
bsd-3-clause
19
develop
519
require "spec_helper" describe SpeciesController do describe "routing" do it "routes the species removal action" do expect(get("/species/rem_pfts_species")).to route_to("species#rem_pfts_species") end it "routes the the edit associated pfts action" do expect(get("/species/add_pfts_species")...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/routing/treatments_routing_spec.rb
Ruby
bsd-3-clause
19
develop
881
require "spec_helper" describe TreatmentsController do describe "routing" do it "routes to #index" do expect(get("/treatments")).to route_to("treatments#index") end it "routes to #new" do expect(get("/treatments/new")).to route_to("treatments#new") end it "routes to #show" do ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/routing/traits_routing_spec.rb
Ruby
bsd-3-clause
19
develop
410
require "spec_helper" describe TraitsController do describe "routing" do specify "There is a route for GET /traits/trait_search." do expect(post("/traits/trait_search")).to route_to("traits#trait_search") end it "There is a route for GET /traits/unlink_covariate." do expect(get("/traits/2/u...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/routing/inputs_routing_spec.rb
Ruby
bsd-3-clause
19
develop
752
require "spec_helper" describe InputsController do describe "routing" do it "There is a route for GET /inputs/edit_inputs_files" do expect(get("/inputs/edit_inputs_files")).to route_to("inputs#edit_inputs_files") end it "There is a route for GET /inputs/edit_inputs_variables" do expect(get(...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/routing/models_routing_spec.rb
Ruby
bsd-3-clause
19
develop
438
require "spec_helper" describe ModelsController do describe "routing" do it "There is a route for GET /models/:id/edit_models_files" do expect(get("/models/1/edit_models_files")).to route_to("models#edit_models_files", id: "1") end it "There is a route for POST /models/:id/edit_models_files" do ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/support/helpers.rb
Ruby
bsd-3-clause
19
develop
1,906
module LoginHelper def login_test_user visit root_path fill_in 'Login', :with => 'test_admin_user' fill_in 'Password', :with => 'Ciuleandra' click_button 'Log in' end def login_nonadmin_test_user visit root_path fill_in 'Login', :with => 'robben_yang' fill_in 'Password', :with =...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/models/user_spec.rb
Ruby
bsd-3-clause
19
develop
289
describe User do before { @user = User.new(login => "carlcrott", email => "user@gmail.com") } subject { @user } # it { should respond_to(:login) } # it { should respond_to(:email) } # it { should respond_to(:page_access_level) } # it { should respond_to(:access_level) } end
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/models/trait_spec.rb
Ruby
bsd-3-clause
19
develop
507
describe Trait do it 'should be invalid if no attributes are given' do t = Trait.new expect(t.invalid?).to eq(true) end it 'should be valid if a valid mean, variable_id, and access_level are given' do t = Trait.new mean: 6, access_level: 1, variable_id: 1 expect(t.invalid?).to eq(false) end ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/models/bulk_upload_data_set_spec.rb
Ruby
bsd-3-clause
19
develop
25,460
describe BulkUploadDataSet do describe "Minimal requirements for instantiating BulkUploadDataSet" do let (:upload_io) { Struct.new("Upload", :original_filename, :path) path = Proc.new do f = File.new("spec/tmp/my_upload_file.csv", "w") f.write "yield\n5.1\n" f.close f....
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/models/database/sites_cultivars_invariants.rb
Ruby
bsd-3-clause
19
develop
4,886
require 'spec_helper' RSpec.configure do |config| config.fixture_path = "#{::Rails.root}/test/fixtures" end RSpec.describe "Site-Cultivar-Species invariants" do fixtures(:traits) context "A new trait is being inserted" do let(:t) { Trait.new access_level: 4, mean: 3, variable_id: 5 } # CASE 1 ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/api/trait_and_yield_access_spec.rb
Ruby
bsd-3-clause
19
develop
1,619
require 'spec_helper' RSpec.describe "Trait GET API" do shared_examples "testing access levels" do |access_level| let(:apikey) { '4' * 36 + access_level.to_s * 4 } specify <<-MESSAGE do For users with a data access level of #{access_level}, traits having a data access level having a lower...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/api/trait_insertion_api_spec.rb
Ruby
bsd-3-clause
19
develop
7,626
# -*- coding: utf-8 -*- require 'spec_helper' RSpec.describe "Trait insertion API:" do RSpec.shared_examples "format" do |data_file, type, format_extension, content_type, num_new_traits = 1, num_new_entities = 1, ...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/api/unit/trait_creation_support_lib_spec.rb
Ruby
bsd-3-clause
19
develop
4,613
require 'spec_helper' class EncapsulatedTraitCreationSupportModule include Api::TraitCreationSupport def initialize @new_trait_ids = [] @structure_validation_errors = [] @lookup_errors = [] @model_validation_errors = [] @database_insertion_errors = [] @date_data_errors = [] end # s...
github
PecanProject/bety
https://github.com/PecanProject/bety
spec/api/unit/csv_handler_spec.rb
Ruby
bsd-3-clause
19
develop
5,174
require 'spec_helper' def compare_xml_docs(doc1, doc2) strip_text_nodes(doc1).canonicalize == strip_text_nodes(doc2).canonicalize end class Nokogiri::XML::Document # Our documents don't contain text nodes of significance. This # facilitates comparing ignoring whitespace text nodes. def strip_blank_text_node...
github
PecanProject/bety
https://github.com/PecanProject/bety
docker/config.ru
Ruby
bsd-3-clause
19
develop
221
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) map (ENV['RAILS_RELATIVE_URL_ROOT'] || "") + "/" do run BetyRails5::Application end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/helpers/sites_helper.rb
Ruby
bsd-3-clause
19
develop
2,381
module SitesHelper # Generate a text field control for form "site_form" for submitting the value # of attribute "attribute" of the Site model being edited. Use options passed # in "common_options", but disable the control if the Site "@site" is not a # point. def geometry_aware_text_field(site_form, attribu...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/helpers/traits_helper.rb
Ruby
bsd-3-clause
19
develop
625
module TraitsHelper def checked_status_list(trait) if ( current_user.access_level < trait.access_level ) or ( trait.user_id == current_user.id ) or ( current_user.page_access_level <= 2 ) if trait.checked == -1 and current_user.page_access_level > 2 "<td>Failed QA/QC check</td>" else ...