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 | postmodern/ffi-hunspell | https://github.com/postmodern/ffi-hunspell | spec/dictionary_spec.rb | Ruby | mit | 49 | main | 4,275 | require 'spec_helper'
require 'ffi/hunspell/dictionary'
describe Hunspell::Dictionary do
subject { described_class }
let(:lang) { 'en_US' }
let(:affix_path) { File.join(Hunspell.directories.last,"#{lang}.aff") }
let(:dic_path) { File.join(Hunspell.directories.last,"#{lang}.dic") }
describe "#initialize" ... |
github | elia/dimensions-rails | https://github.com/elia/dimensions-rails | dimensions-rails.gemspec | Ruby | mit | 49 | master | 1,255 | # coding: utf-8
$:.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
require 'dimensions-rails/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |gem|
gem.authors = ['Elia Schito']
gem.email = ['elia@schito.me']
gem.description = %q{Use d... |
github | elia/dimensions-rails | https://github.com/elia/dimensions-rails | Rakefile | Ruby | mit | 49 | master | 240 | #!/usr/bin/env rake
require 'bundler/setup'
require 'bundler/gem_tasks'
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new :default |
github | elia/dimensions-rails | https://github.com/elia/dimensions-rails | spec/spec_helper.rb | Ruby | mit | 49 | master | 479 | # Configure Rails Environment
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../dummy/config/environment.rb', __FILE__)
Rails.backtrace_cleaner.remove_silencers!
# require 'rails/test_help'
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its s... |
github | elia/dimensions-rails | https://github.com/elia/dimensions-rails | spec/helper/dimensions-rails_spec.rb | Ruby | mit | 49 | master | 966 | require 'spec_helper'
describe ApplicationHelper, :type => :helper do
it 'adds size to images' do
tag = helper.image_tag('rails.png')
tag.should match('height="64"')
tag.should match('width="50"')
end
it "works with a missing image" do
tag = helper.image_tag('missing.png')
tag.should_not mat... |
github | elia/dimensions-rails | https://github.com/elia/dimensions-rails | spec/dummy/config/application.rb | Ruby | mit | 49 | master | 2,684 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require 'action_controller/railtie'
# require "action_mailer/railtie"
# require "active_resource/railtie"
require 'sprockets/railtie'
# require "rails/test_unit/railtie"
Bundler.require
require 'dimensions-... |
github | elia/dimensions-rails | https://github.com/elia/dimensions-rails | spec/dummy/config/environments/test.rb | Ruby | mit | 49 | master | 1,465 | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suit... |
github | elia/dimensions-rails | https://github.com/elia/dimensions-rails | spec/dummy/config/initializers/secret_token.rb | Ruby | mit | 49 | master | 496 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... |
github | elia/dimensions-rails | https://github.com/elia/dimensions-rails | lib/dimensions-rails.rb | Ruby | mit | 49 | master | 1,335 | require 'dimensions-rails/version'
require 'active_support/ordered_options'
require 'rails/railtie'
require 'dimensions'
require 'ostruct'
module Dimensions
module Rails
module Helper
# Use dimensions by @sstephenson to add automatic images size and improve browser rendering.
#
# How this imp... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | Gemfile | Ruby | mit | 49 | master | 824 | source 'https://rubygems.org'
ruby '2.6.3'
gem 'rails', '~>5.2.0'
gem 'autoprefixer-rails'
gem 'aws-sdk', '~> 2'
gem 'city-state'
gem 'clearance'
gem 'coffee-rails', '~> 4.2.0'
gem 'iso_country_codes'
gem 'date_validator'
gem 'jquery-rails'
gem 'letsencrypt-rails-heroku', group: 'production'
gem 'minitest-rails', '~... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | lib/report_exporter.rb | Ruby | mit | 49 | master | 5,580 | require 'csv'
module ReportExporter
def self.events_report
CSV.generate do |csv|
csv << [
"Event ID",
"Name",
"City",
"Country",
"Start Date",
"End Date",
"Application Process",
"Number of Tickets",
"Number of Applications"
]
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | lib/redirect_www.rb | Ruby | mit | 49 | master | 307 | class RedirectWWW
def initialize(app)
@app = app
end
def call(env)
if env["SERVER_NAME"] == "www.diversitytickets.org"
req = Rack::Request.new(env)
uri = "https://diversitytickets.org#{req.fullpath}"
return [301, {"Location" => uri}, []]
end
@app.call(env)
end
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | lib/tasks/users.rake | Ruby | mit | 49 | master | 796 | namespace :users do
desc "Event organizers get user accounts"
task give_accounts_to_accountless_organizers: :environment do
organizerless_events = Event.where(organizer_id: nil)
puts "Going to assign user accounts to event organizers that currently don't have one."
ActiveRecord::Base.transaction do
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | lib/tasks/admin.rake | Ruby | mit | 49 | master | 960 | namespace :admin do
namespace :mail do
desc "Send emails for upcoming deadlines to admins"
task :upcoming_deadline => :environment do
puts "Sending emails for upcoming deadlines to admins."
DeadlineMailService.send_deadline_mail
puts "Done."
end
desc "Send emails for upcoming deadli... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | lib/tasks/events.rake | Ruby | mit | 49 | master | 653 | namespace :events do
namespace :past_events do
desc "Deletes personal data from all event applications for events that took place during the last week"
task :delete_data => :environment do
puts "Deletes applications data..."
PastEventDateService.delete_application_data_after_event
puts "Dele... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | lib/tasks/twitter.rake | Ruby | mit | 49 | master | 240 | namespace :twitter do
namespace :announce do
desc "Tweets the next approved event"
task :event_approved => :environment do
puts "Tweeting..."
EventTweetService.tweet_approved_event
puts "Done."
end
end
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/redirect_www_test.rb | Ruby | mit | 49 | master | 1,176 | require 'test_helper'
require 'redirect_www'
class RedirectWWWTest < ActiveSupport::TestCase
describe 'incoming requests' do
it 'www.diversitytickets.org should redirect to diversitytickets.org' do
app = ->(env) { [200, {}, []] }
middleware = RedirectWWW.new(app)
env = Rack::MockRequest.env_for... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/test_helper.rb | Ruby | mit | 49 | master | 4,885 | # Use simplecov gem to track what code gets executed when tests
# are run and what doesn't: Run your tests, open up coverage/index.html
# in your browser and check out what you've missed so far.
require 'simplecov'
SimpleCov.start 'rails'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment',... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/controllers/sessions_controller_test.rb | Ruby | mit | 49 | master | 1,439 | require 'test_helper'
class SessionsControllerTest < ActionController::TestCase
describe '#create' do
it 'redirects back to the homepage when the user is authenticated' do
user = make_user
post :create, params: { referer: '/', session: { email: user.email, password: user.password } }
assert_r... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/controllers/users_controller_test.rb | Ruby | mit | 49 | master | 6,152 | require 'test_helper'
class UsersControllerTest < ActionController::TestCase
describe '#create' do
it 'creates a user with a name and email' do
put :create, params: { user: { email: "candela@test.de", password: "greatpassword", privacy_policy_agreement: "1" },
referer: '' }
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/controllers/applications_controller_test.rb | Ruby | mit | 49 | master | 8,844 | require 'test_helper'
class ApplicationsControllerTest < ActionController::TestCase
describe '#new' do
it 'adds a new application for the event' do
event = make_event
user = make_user
sign_in_as(user)
get :new, params: { event_id: event.id }
assert_response :success
end
i... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/controllers/drafts_controller_test.rb | Ruby | mit | 49 | master | 2,113 | require 'test_helper'
class DraftsControllerTest < ActionController::TestCase
describe '#create' do
it 'creates drafts for applications for a certain event' do
user = make_user
event = make_event
sign_in_as(user)
count = Application.all.count
get :create, params: { event_id: even... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/controllers/events_controller_test.rb | Ruby | mit | 49 | master | 15,752 | require 'test_helper'
class EventsControllerTest < ActionController::TestCase
before do
make_application_process_options_handler
end
describe '#create' do
it 'successfully creates event and sends expected emails' do
admin_user = make_admin
user = make_user
sign_in_as(user)
Actio... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/controllers/application_process_options_handlers_controller_test.rb | Ruby | mit | 49 | master | 619 | require 'test_helper'
class ApplicationProcessOptionsHandlersControllerTest < ActionController::TestCase
before do
@apoh = make_application_process_options_handler
end
describe '#update' do
it 'updates application_process_option selection_by_dt correctly' do
user = make_user(admin: true)
sig... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/controllers/admin/applications_controller_test.rb | Ruby | mit | 49 | master | 2,554 | require 'test_helper'
module Admin
class ApplicationsControllerTest < ActionController::TestCase
describe '#show' do
it 'redirects visitors' do
event = make_event
application = make_application(event)
get :show, params: { event_id: event.id, id: application.id }
assert_red... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/controllers/admin/tags_controller_test.rb | Ruby | mit | 49 | master | 2,222 | require 'test_helper'
module Admin
class TagsControllerTest < ActionController::TestCase
describe '#index' do
it 'shows all Tags already created to admins' do
setup do
3.times { make_tag(name: "New event", category_id: 1) }
end
admin = make_user(admin: true)
sign_... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/controllers/admin/events_controller_test.rb | Ruby | mit | 49 | master | 7,404 | require 'test_helper'
module Admin
class EventsControllerTest < ActionController::TestCase
before do
make_application_process_options_handler
end
describe '#index' do
it 'protect admin index from anonymous visitors, redirects to sign in' do
get :index
assert_redirected_to si... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/lib/report_exporter_test.rb | Ruby | mit | 49 | master | 5,494 | require 'test_helper'
require 'report_exporter'
class ReportExporterTest < ActiveSupport::TestCase
describe 'events report' do
before do
@event = make_event(
start_date: Date.new(2017,9,13),
end_date: Date.new(2017,9,14),
deadline: Date.new(2017,9,3),
approved: true,
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/workers/twitter_worker_test.rb | Ruby | mit | 49 | master | 917 | require 'test_helper'
class TwitterWorkerTest < ActiveSupport::TestCase
include ApplicationHelper
it 'sends a tweet with name if event has no twitter handle' do
event = make_event(
name: 'Awesome Event',
id: 101
)
event.reload
TWITTER_CLIENT.expects(:update).once
TwitterWorker.a... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/helpers/application_helper_test.rb | Ruby | mit | 49 | master | 804 | require 'test_helper'
class ApplicationHelperTest < ActiveSupport::TestCase
include ApplicationHelper
describe 'format_date' do
it 'returns formatted date for 2016-10-08' do
assert_equal 'October 8th, 2016', format_date('2016-10-08'.to_date)
end
end
describe 'format_date_range' do
it 'retur... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/applications_continue_as_guest_page_test.rb | Ruby | mit | 49 | master | 1,667 | require 'test_helper'
feature 'Application Edit' do
def setup
@user = make_user
@event = make_event(name: 'The Event', approved: true)
end
test 'that buttons for "Continue as guest", "Sign me in" and "Create an account" are present' do
visit events_path
click_button('Apply')
assert_current... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/sign_in_test.rb | Ruby | mit | 49 | master | 1,305 | require 'test_helper'
feature 'User Sign In' do
def setup
make_application_process_options_handler
@user = make_user
@admin = make_admin
end
test 'redirects the user to the previous allowed page they were browing' do
visit events_path
click_link 'Sign in'
fill_in 'Email', with: 'awesom... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/draft_edit_page_test.rb | Ruby | mit | 49 | master | 1,484 | require 'test_helper'
feature 'Draft Edit' do
def setup
@user = make_user
@event = make_event(name: 'The Event', approved: true)
@draft = make_draft(
@event,
applicant_id: @user.id,
attendee_info_1: 'I would like to learn Ruby',
attendee_info_2: 'I can not ... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/events_overview_test.rb | Ruby | mit | 49 | master | 1,819 | require 'test_helper'
feature 'Event Overview' do
def setup
@user = make_user
@admin = make_admin
end
test 'shows a link to Apply if the user did not apply or create a draft for the event' do
event = make_event(approved: true)
sign_in_as_user
visit events_path
click_button("Apply")
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/admin_event_details_test.rb | Ruby | mit | 49 | master | 4,635 | require 'test_helper'
include ApplicationHelper
feature 'Admin Event Details' do
def setup
make_application_process_options_handler
@admin = make_admin
@event = make_event
@application_1 = make_application(@event, name: 'Peter', status: 'pending')
@application_2 = make_application(@event, name: '... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/user_events_page_test.rb | Ruby | mit | 49 | master | 950 | require 'test_helper'
feature 'User Events Page' do
def setup
@user = make_user
@event = make_event(
name: 'Applicants event',
approved: true,
organizer_id: @user.id,
application_process: 'selection_by_organizer',
)
@application = make_application(@event, applicant_id: @user.i... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/user_delete_account_page_test.rb | Ruby | mit | 49 | master | 1,023 | require 'test_helper'
feature 'User Delete Account Page' do
def setup
@user = make_user
end
test 'that admins can not access the delete account page of other users' do
admin = make_admin
sign_in_as_admin
visit delete_account_path(@user)
assert page.text.include?("We're sorry. You don't hav... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/user_settings_page_test.rb | Ruby | mit | 49 | master | 3,205 | require 'test_helper'
feature 'User Settings Page' do
def setup
@user = make_user
end
test 'that name input field is present in settings page and updates users name' do
sign_in_as_user
visit root_path
assert page.text.include?("Your account")
page.find("#dropdown").click
click_link '... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/application_page_test.rb | Ruby | mit | 49 | master | 2,409 | require 'test_helper'
feature 'Application Page' do
def setup
@user = make_user
@event = make_event(name: 'The Event', approved: true)
@application = make_application(
@event,
applicant_id: @user.id,
attendee_info_1: 'I would like to learn Ruby',
attendee_info_2: 'I can not afford... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/home_page_test.rb | Ruby | mit | 49 | master | 314 | require 'test_helper'
feature 'Home Page' do
scenario 'Visit home page' do
visit root_path
page.must_have_content 'We help events reach a more diverse audience. And we help you to find these events.'
click_link 'Attendees'
page.must_have_content 'We currently have no events lined up'
end
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/new_application_test.rb | Ruby | mit | 49 | master | 6,466 | require 'test_helper'
feature 'New Application' do
def setup
@admin = make_admin
@user = make_user
@event = make_event(organizer_id: @admin.id, approved: true)
end
test 'creates an application for logged-out user' do
visit event_path(@event.id)
click_button "Apply"
click_link "Continue... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/user_confirm_delete_page_test.rb | Ruby | mit | 49 | master | 555 | require 'test_helper'
feature 'User Confirm Delete Page' do
def setup
@user = make_user
end
test 'that back- and delete-links are being shown correctly' do
sign_in_as_user
visit root_path
assert page.text.include?("Your account")
page.find("#dropdown").click
click_link 'Account settin... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/event_page_test.rb | Ruby | mit | 49 | master | 2,661 | require 'test_helper'
feature 'Event' do
def setup
@user = make_user
@admin = make_admin
@event = make_event(organizer_id: @user.id, approved: true)
end
test 'does not show a Delete button if the Event is still open' do
sign_in_as_user
visit event_path(@event.id)
assert_not page.has_link... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/application_edit_page_test.rb | Ruby | mit | 49 | master | 2,343 | require 'test_helper'
feature 'Application Edit' do
def setup
@user = make_user
@event = make_event(name: 'The Event', approved: true)
@event2 = make_event(name: 'Second Event', approved: true)
@application = make_application(
@event,
applicant_id: @user.id,
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/user_applications_page_test.rb | Ruby | mit | 49 | master | 1,584 | require 'test_helper'
feature 'User Applications Page' do
def setup
@user = make_user
@event = make_event(name: 'Applicants event')
@event2 = make_event(name: 'Second Event')
@application = make_application(@event, applicant_id: @user.id)
@draft = make_draft(@event2, applicant_id: @user.id)
end... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/application_draft_page_test.rb | Ruby | mit | 49 | master | 1,951 | require 'test_helper'
feature 'Application draft' do
def setup
@user = make_user
@admin = make_admin
@event = make_event(name: 'The Event', approved: true)
@draft = make_draft(
@event,
applicant_id: @user.id,
email: @user.email,
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/integration/admin_events_test.rb | Ruby | mit | 49 | master | 1,056 | require 'test_helper'
feature 'Admin Events' do
before do
make_application_process_options_handler
end
scenario 'Approve and unapprove event' do
click_link 'Admin'
within(approved_events_box) do
refute page.text.include?('The event')
end
within(unapproved_events_box) do
assert ... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/services/deadline_mail_service_test.rb | Ruby | mit | 49 | master | 2,709 | require 'test_helper'
class DeadlineMailServiceTest < ActiveSupport::TestCase
describe 'sending emails about events with upcoming deadlines to admins' do
it 'send emails about right events to the right people' do
make_event(deadline: 3.days.from_now, approved: true, name: 'Valid Event')
make_event(d... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/services/deadline_passed_mail_service_test.rb | Ruby | mit | 49 | master | 2,257 | require 'test_helper'
class DeadlinePassedMailServiceTest < ActiveSupport::TestCase
describe 'sending emails about events with passed deadlines to admins' do
it 'send emails about right events to the right people' do
make_event(deadline: 1.days.ago, approved: true, name: 'Valid Event')
make_event(dea... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/services/event_search_service_test.rb | Ruby | mit | 49 | master | 4,446 | require 'test_helper'
class EventSearchServiceTest < ActiveSupport::TestCase
describe 'filtering events by tags' do
describe 'with no events' do
it 'returns no events' do
tag = Tag.create!(name: 'Ruby', category: Category.create!(name: 'Programming language'))
assert_equal EventSearchServ... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/services/create_categories_service_test.rb | Ruby | mit | 49 | master | 552 | require 'test_helper'
class CreateCategoriesServiceTest < ActiveSupport::TestCase
describe 'creates categories and categories described in the category yaml' do
it 'generates the categories and tags' do
CreateCategoriesService.create_categories
first_category = File.open("config/categories.yml").to... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/services/event_tweet_service_test.rb | Ruby | mit | 49 | master | 1,137 | require 'test_helper'
class EventTweetServiceTest < ActiveSupport::TestCase
describe 'tweets about upcoming open events' do
it 'if they are approved' do
event = make_event(deadline: 2.days.from_now, approved: true, name: 'Valid Event')
TWITTER_CLIENT.expects(:update).once
EventTweetService.t... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/services/past_event_date_service_test.rb | Ruby | mit | 49 | master | 5,004 | require 'test_helper'
class PastEventDateServiceTest < ActiveSupport::TestCase
describe 'deletes application data for events that took place yesterday' do
it 'overwrites correct applications' do
past_event = make_event(approved: true, name: 'Yesterdays Event')
old_past_event = make_event(approved: t... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/mailers/admin_mailer_test.rb | Ruby | mit | 49 | master | 1,142 | require 'test_helper'
class AdminMailerTest < ActionMailer::TestCase
def setup
@event = make_event
@admin = make_admin
end
test "submitted_event" do
email = AdminMailer.submitted_event(@event, @admin.email)
assert_emails 1 do
email.deliver_now
end
assert_equal ['info@diversitytic... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/mailers/user_notifications_mailer_test.rb | Ruby | mit | 49 | master | 814 | require 'test_helper'
class UserNotificationsMailerTest < ActionMailer::TestCase
def setup
@event = make_event
@user = make_user
end
test "new_local_event" do
email = UserNotificationsMailer.new_local_event(@event, @user)
assert_emails 1 do
email.deliver_now
end
assert_equal ['in... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/mailers/applicant_mailer_test.rb | Ruby | mit | 49 | master | 880 | require 'test_helper'
class ApplicantMailerTest < ActionMailer::TestCase
def setup
@event = make_event
@draft = make_draft(@event)
end
test "application_received" do
@application = make_application(@event)
email = ApplicantMailer.application_received(@application)
assert_emails 1 do
e... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/mailers/organizer_mailer_test.rb | Ruby | mit | 49 | master | 753 | require 'test_helper'
class OrganizerMailerTest < ActionMailer::TestCase
def setup
@event = make_event
end
test "submitted_event" do
email = OrganizerMailer.submitted_event(@event)
assert_emails 1 do
email.deliver_now
end
assert_equal ['info@diversitytickets.org'], email.from
ass... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/models/application_process_test.rb | Ruby | mit | 49 | master | 2,205 | require 'test_helper'
class ApplicationProcessTest < ActiveSupport::TestCase
describe 'handling application process' do
it 'is valid if its value is allowed' do
choice = ApplicationProcess::Choice.new('selection_by_organizer')
assert_equal true, choice.valid?
end
it 'is not valid if its val... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/models/event_test.rb | Ruby | mit | 49 | master | 7,434 | require 'test_helper'
class EventTest < ActiveSupport::TestCase
describe 'checking the deadline' do
it 'returns true when the deadline is in the future' do
event = Event.new(deadline: 1.week.from_now)
assert_equal true, event.open?
end
it 'returns false when the deadline is in the past' do
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | test/models/user_test.rb | Ruby | mit | 49 | master | 393 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
describe '.admin' do
it 'only retrieves admins from the database' do
make_user(admin: true, email: 'admin@example.com')
make_user(admin: false, email: 'hallo@example.com')
admins = User.admin
assert_equal 1, admins.count
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/routes.rb | Ruby | mit | 49 | master | 2,745 | Rails.application.routes.draw do
scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
resources :passwords, controller: 'clearance/passwords', only: [:create, :new]
resource :session, controller: 'sessions', only: [:create]
resources :users, controller: 'users', only: [:create, :show, :edi... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/application.rb | Ruby | mit | 49 | master | 1,405 | require File.expand_path('../boot', __FILE__)
require 'csv'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module DiversityTicketing
class Application < Rails::Application
# Settings in config/... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/puma.rb | Ruby | mit | 49 | master | 454 | workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/environments/test.rb | Ruby | mit | 49 | master | 2,256 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
ENV['DT_USERNAME'] = 'monster'
ENV['DT_PASSWORD'] = 'hello'
#this sets a default locale for the tests to pass
Rails.application.routes.default_url_options = {locale: :en}
# The test environ... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/environments/production.rb | Ruby | mit | 49 | master | 4,087 | require 'redirect_www'
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/environments/development.rb | Ruby | mit | 49 | master | 1,735 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
ENV['DT_USERNAME'] = 'monster'
ENV['DT_PASSWORD'] = 'hello'
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect f... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/initializers/twitter.rb | Ruby | mit | 49 | master | 323 | TWITTER_CLIENT = Twitter::REST::Client.new do |config|
config.consumer_key = ENV.fetch("TWITTER_CONSUMER_KEY")
config.consumer_secret = ENV.fetch("TWITTER_CONSUMER_SECRET")
config.access_token = ENV.fetch("TWITTER_ACCESS_TOKEN")
config.access_token_secret = ENV.fetch("TWITTER_ACCESS_SECRET")
e... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/initializers/test_config.rb | Ruby | mit | 49 | master | 221 | if Rails.env.test? || Rails.env.development?
ENV['TWITTER_CONSUMER_KEY'] ||= '123456'
ENV['TWITTER_CONSUMER_SECRET'] ||= '123456'
ENV['TWITTER_ACCESS_TOKEN'] ||= '1234556'
ENV['TWITTER_ACCESS_SECRET'] ||= '123456'
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/initializers/new_framework_defaults.rb | Ruby | mit | 49 | master | 969 | # Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Rails.application.config.action_c... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/initializers/aws.rb | Ruby | mit | 49 | master | 369 | if Rails.env.test? || Rails.env.development?
ENV['AWS_ACCESS_KEY_ID'] ||= '123456'
ENV['AWS_SECRET_ACCESS_KEY'] ||= '123456'
ENV['S3_BUCKET'] ||= '1234556'
end
Aws.config.update({
region: 'eu-central-1',
credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']),
})
S3_BUCKET ... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | config/initializers/clearance.rb | Ruby | mit | 49 | master | 256 | Clearance.configure do |config|
config.routes = false
config.mailer_sender = "info@diversitytickets.org"
config.cookie_domain = ".diversitytickets.org"
config.secure_cookie = true
config.httponly = true
config.rotate_csrf_on_sign_in = true
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/schema.rb | Ruby | mit | 49 | master | 4,858 | # 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 source for your
# dat... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20150720182838_create_applications.rb | Ruby | mit | 49 | master | 200 | class CreateApplications < ActiveRecord::Migration[5.1]
def change
create_table :applications do |t|
t.string :name
t.string :email
t.timestamps null: false
end
end
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20160118193813_add_checkboxes_to_applicants.rb | Ruby | mit | 49 | master | 344 | class AddCheckboxesToApplicants < ActiveRecord::Migration[5.1]
def change
add_column :applications, :ticket_needed, :boolean, null: false, default: false
add_column :applications, :travel_needed, :boolean, null: false, default: false
add_column :applications, :accommodation_needed, :boolean, null: false, d... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20151226115116_add_attendee_information_to_applications.rb | Ruby | mit | 49 | master | 205 | class AddAttendeeInformationToApplications < ActiveRecord::Migration[5.1]
def change
add_column :applications, :attendee_info_1, :text
add_column :applications, :attendee_info_2, :text
end
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20190926090956_create_application_process_options_handler.rb | Ruby | mit | 49 | master | 238 | class CreateApplicationProcessOptionsHandler < ActiveRecord::Migration[5.2]
def change
create_table :application_process_options_handlers do |t|
t.boolean :selection_by_dt_enabled, default: true, null: false
end
end
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20150720200122_add_columns_to_applications.rb | Ruby | mit | 49 | master | 226 | class AddColumnsToApplications < ActiveRecord::Migration[5.1]
def change
add_column :applications, :answer_1, :text
add_column :applications, :answer_2, :text
add_column :applications, :answer_3, :text
end
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20150720184109_create_events.rb | Ruby | mit | 49 | master | 347 | class CreateEvents < ActiveRecord::Migration[5.1]
def change
create_table :events do |t|
t.string :organizer_name
t.string :organizer_email
t.text :description
t.text :name
t.date :date
t.text :question_1
t.text :question_2
t.text :question_3
t.timestamps nul... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20151028145014_add_columns_to_events.rb | Ruby | mit | 49 | master | 461 | class AddColumnsToEvents < ActiveRecord::Migration[5.1]
def change
change_table :events do |t|
t.text :website
t.text :code_of_conduct
t.string :city
t.string :country
t.date :deadline
t.integer :number_of_tickets
t.boolean :ticket_funded, default: false, null: false
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20151213171240_remove_question_and_answer_columns_from_events_and_applications.rb | Ruby | mit | 49 | master | 357 | class RemoveQuestionAndAnswerColumnsFromEventsAndApplications < ActiveRecord::Migration[5.1]
def change
remove_column :events, :question_1
remove_column :events, :question_2
remove_column :events, :question_3
remove_column :applications, :answer_1
remove_column :applications, :answer_2
remove_colum... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20160125184846_create_users.rb | Ruby | mit | 49 | master | 408 | class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
t.timestamps null: false
t.string :email, null: false
t.string :encrypted_password, limit: 128, null: false
t.string :confirmation_token, limit: 128
t.string :remember_token, limit: 128, null: fals... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | db/migrate/20161107202301_create_taggings.rb | Ruby | mit | 49 | master | 224 | class CreateTaggings < ActiveRecord::Migration[5.1]
def change
create_table :taggings do |t|
t.belongs_to :event, index: true
t.belongs_to :tag, index: true
t.timestamps null: false
end
end
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/workers/twitter_worker.rb | Ruby | mit | 49 | master | 1,205 | class TwitterWorker
include Sidekiq::Worker
extend ApplicationHelper
def self.announce_event(event)
event_url = routes.event_url(event, locale: "en")
perform_async(event.name, format_date(event.deadline), event_url, event.twitter_handle, event.number_of_tickets)
Tweet.create(event_id: event.id, publi... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/helpers/application_helper.rb | Ruby | mit | 49 | master | 1,718 | module ApplicationHelper
def navbar_link_to(name, url, classes = [])
link_to_unless_current(name, url, class: classes) {
content_tag(:span, name, class: 'active')
}
end
def span_for_funded(title, funded)
content_tag(:span, title, class: funded ? 'funded' : 'not-funded')
end
def join_messag... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/helpers/events_helper.rb | Ruby | mit | 49 | master | 446 | module EventsHelper
def event_image(event)
if event.logo && event.logo != ''
image_tag event.logo, skip_pipeline: true
else
image_tag "event-default.png"
end
end
#Used in events/edit and events/show:
def breadcrumb_locals_according_to_user_status
if current_user && @event.organizer_... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/form_builders/form_builder.rb | Ruby | mit | 49 | master | 1,157 | class FormBuilder < ActionView::Helpers::FormBuilder
include ActionView::Helpers::CaptureHelper
def form_field(field_type, attribute, name, options = {})
class_option = options.delete(:class)
t = @template
t.content_tag(:div, class: css_classes(class_option, attribute)) do
t.capture do
t... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/services/past_event_date_service.rb | Ruby | mit | 49 | master | 504 | class PastEventDateService
# Looks for all events in the past week to overwrite applications for security
# just in case the task does not always run properly:
def self.delete_application_data_after_event
events = Event.approved.where('end_date < ? AND end_date > ?', Time.zone.now, 1.week.ago)
events.map ... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/services/create_categories_service.rb | Ruby | mit | 49 | master | 547 | class CreateCategoriesService
def self.create_categories
categories = YAML.load_file("config/categories.yml")
categories.each do |category_name, tag_names|
category = Category.find_or_create_by(name: category_name)
tag_names.each do |tag_name|
tag = Tag.find_or_create_by(name: tag_name, ca... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/services/countries_statistics.rb | Ruby | mit | 49 | master | 1,096 | class CountriesStatistics
def initialize(events)
@events = events
end
def to_json
countries.each_with_object({}) do |country, memo|
next if key(country).nil?
memo[key(country)] = [events_count(country), tickets_count(country), country_score(country)]
end.to_json
end
def country_rank
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/services/event_tweet_service.rb | Ruby | mit | 49 | master | 368 | class EventTweetService
def self.tweet_approved_event
events = Event.open.approved.order("deadline ASC").ids
do_not_publish = Tweet.all.pluck(:event_id)
remaining_events = events - do_not_publish
return if remaining_events.empty?
event_to_announce = Event.find(remaining_events[0])
TwitterWor... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/services/event_search_service.rb | Ruby | mit | 49 | master | 950 | #Defines event keyword search and filter option on the events index pages:
class EventSearchService
def initialize(params)
params[:query] = [] if params[:query] == nil
params[:filter] = {tag_ids:[]} if params[:filter] == nil
@query = params[:query]
@tag_ids = params[:filter][:tag_ids].reject(&:empty?... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/services/deadline_passed_mail_service.rb | Ruby | mit | 49 | master | 291 | class DeadlinePassedMailService
def self.send_deadline_passed_mail
Event.approved.application_via_diversitytickets.deadline_yesterday.each do |event|
User.admin.each do |user|
AdminMailer.passed_event_deadline(event, user.email).deliver_later
end
end
end
end |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/services/deadline_mail_service.rb | Ruby | mit | 49 | master | 519 | class DeadlineMailService
def self.send_deadline_mail
Event.approved.deadline_in_three_days.each do |event|
User.admin.each do |user|
AdminMailer.upcoming_event_deadline(event, user.email).deliver_later
end
end
end
def self.send_deadline_reminder_applicants
Event.approved.deadline... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/controllers/events_controller.rb | Ruby | mit | 49 | master | 4,702 | class EventsController < ApplicationController
before_action :set_s3_direct_post, only: [:new, :preview, :edit, :create, :update]
before_action :get_event, only: [:show, :edit, :update, :destroy, :delete_event_data, :delete_event_applications_data]
before_action :set_approved_tickets_count, only: [:show]
skip_b... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/controllers/application_controller.rb | Ruby | mit | 49 | master | 791 | class ApplicationController < ActionController::Base
include Clearance::Controller
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :set_locale
before_action :require_login
def default_url_options
... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/controllers/sessions_controller.rb | Ruby | mit | 49 | master | 683 | class SessionsController < Clearance::SessionsController
def create
if User.find_by(email:params[:session][:email]).nil?
redirect_to sign_up_path, flash: { :alert => t('.account_not_found')}
elsif User.find_by(email: params[:session][:email]).encrypted_password == 'x'
redirect_to new_password_pa... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/controllers/applications_controller.rb | Ruby | mit | 49 | master | 3,743 | #This controller manages the applications for a specific event
class ApplicationsController < ApplicationController
before_action :get_event
before_action :get_application, except: [:new, :create, :continue_as_guest]
before_action :ensure_correct_user, only: [:show, :edit]
skip_before_action :require_login, onl... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/controllers/application_process_options_handlers_controller.rb | Ruby | mit | 49 | master | 762 | #This controller manages the enabling and disabling of selection process by DT
class ApplicationProcessOptionsHandlersController < ApplicationController
before_action :require_admin
def update
@application_process_options_handler = ApplicationProcessOptionsHandler.find(1)
if @application_process_options_ha... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/controllers/users_controller.rb | Ruby | mit | 49 | master | 3,255 | require "report_exporter"
class UsersController < Clearance::UsersController
before_action :ensure_correct_user, except: [:new, :create]
def show
@categorized_user_events = {
approved: @user.events.approved.upcoming,
unapproved: @user.events.unapproved.upcoming,
past: @user.events.past
}... |
github | rubymonsters/diversity_ticketing | https://github.com/rubymonsters/diversity_ticketing | app/controllers/drafts_controller.rb | Ruby | mit | 49 | master | 1,634 | #Drafts are all applications where submitted == 'false'. Only storable if applicant
#is registered user.
class DraftsController < ApplicationController
before_action :get_event
def show
get_draft
end
def edit
get_draft
end
def create
set_applicant_id
@draft = Application.new(application_p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.