repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
nsingh/apm-agent-ruby | spec/elastic_apm/spies/dynamo_db_spec.rb | <reponame>nsingh/apm-agent-ruby
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "Lic... |
nsingh/apm-agent-ruby | lib/elastic_apm/span.rb | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... |
nsingh/apm-agent-ruby | spec/elastic_apm/transport/filters/hash_sanitizer_spec.rb | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... |
nsingh/apm-agent-ruby | lib/elastic_apm/spies/dynamo_db.rb | <filename>lib/elastic_apm/spies/dynamo_db.rb
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version ... |
fidor/fidor_api | spec/lib/fidor_api/token_spec.rb | require 'spec_helper'
module FidorApi
RSpec.describe Token do
let(:instance) { described_class.new(attributes) }
let(:attributes) do
{
access_token: 'access-token',
expires_in: 900,
token_type: 'Bearer',
refresh_token: '<PASSWORD>-<PASSWORD>'
}
end
... |
corpitsysadmins/bind-formula | test/integration/default/controls/zones_spec.rb | <reponame>corpitsysadmins/bind-formula<gh_stars>0
# Set defaults, use debian as base
conf_user = 'bind'
conf_group = 'bind'
keys_user = 'root'
keys_group = conf_group
logs_user = 'root'
logs_group = conf_group
named_directory = '/var/cache/bind'
zones_directory = '/var/cache/bind/zones... |
DouweBos/DJBExtensionKit | DJBExtensionKit.podspec | <gh_stars>0
#
# Be sure to run `pod lib lint DJBExtensionKit.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name ... |
osu-cascades/bethlehem-inn-inkeeper | db/seeds.rb | <filename>db/seeds.rb
User.create(
email: '<EMAIL>',
password: 'password',
password_confirmation: 'password',
first_name: 'Developer',
last_name: 'Admin',
role: :admin
)
puts "Default admin user created with email '<EMAIL>' and password 'password'."
|
evendis/gmail_cli | spec/unit/imap_spec.rb | <filename>spec/unit/imap_spec.rb
require 'spec_helper'
describe GmailCli do
let(:options) { {} }
describe "##imap_connection" do
subject { GmailCli.imap_connection(options) }
it "returns a connected GmailCli::Imap" do
expect_any_instance_of(GmailCli::Imap).to receive(:connect!).and_return('result!')... |
evendis/gmail_cli | spec/unit/logger_spec.rb | <reponame>evendis/gmail_cli
require 'spec_helper'
describe GmailCli::Logger do
let(:logger) { GmailCli::Logger }
let(:trace_something) { logger.trace 'somthing', 'bogative' }
it "does not log when verbose mode not enabled" do
expect($stderr).to receive(:puts).never
trace_something
end
it "logs when... |
evendis/gmail_cli | spec/unit/oauth2_helper_spec.rb | <reponame>evendis/gmail_cli
require 'spec_helper'
describe GmailCli::Oauth2Helper do
let(:resource_class) { GmailCli::Oauth2Helper }
let(:instance) { resource_class.new(options) }
let(:options) { {} }
let(:expected) { 'canary' }
before do
# silence echo
allow_any_instance_of(resource_class).to recei... |
evendis/gmail_cli | lib/gmail_cli/imap.rb | <gh_stars>1-10
require 'net/imap'
require 'net/http'
require 'uri'
require 'gmail_xoauth'
module GmailCli
# Command: convenience method to return IMAP connection given +options+
def self.imap_connection(options={})
GmailCli::Imap.new(options).connect!
end
class Imap
include GmailCli::LoggerSupport
... |
evendis/gmail_cli | lib/gmail_cli/oauth2_helper.rb | <reponame>evendis/gmail_cli
require 'google/api_client'
class GmailCli::Oauth2Helper
include GmailCli::LoggerSupport
class << self
# Command: convenience class method to invoke authorization phase
def authorize!(options={})
new(options).authorize!
rescue Interrupt
$stderr.puts "..interrupt... |
evendis/gmail_cli | spec/unit/tasks_spec.rb | <reponame>evendis/gmail_cli<filename>spec/unit/tasks_spec.rb
require 'spec_helper'
describe "Rake Task gmail_cli:" do
require 'rake'
require 'gmail_cli/tasks'
describe "authorize" do
let(:task_name) { "gmail_cli:authorize" }
let :run_rake_task do
Rake::Task[task_name].reenable
Rake.applicati... |
evendis/gmail_cli | lib/gmail_cli/logger.rb | class GmailCli::Logger
class << self
def log(msg)
$stdout.puts "#{Time.now}| #{msg}"
end
def trace(name,value) ; value ; end
def set_log_mode(verbose)
if verbose
class_eval <<-LOGGER_ACTION, __FILE__, __LINE__
def self.trace(name,value)
$stderr.puts "\#{Time... |
evendis/gmail_cli | lib/gmail_cli/tasks.rb | namespace :gmail_cli do
require 'gmail_cli'
desc "Perform Google OAuth2 client authorization with client_id=? client_secret=?"
task :authorize do |t|
options = {
client_id: ENV['client_id'],
client_secret: ENV['client_secret'],
scope: ENV['scope'],
redirect_uri: ENV['redirect_uri'],
... |
evendis/gmail_cli | lib/gmail_cli/shell.rb | <reponame>evendis/gmail_cli
# class that groks the command line options and invokes the required task
class GmailCli::Shell
# holds the parsed options
attr_reader :options
# holds the remaining command line arguments
attr_reader :args
# initializes the shell with command line argments:
#
# +options+ is... |
evendis/gmail_cli | lib/gmail_cli.rb | <filename>lib/gmail_cli.rb<gh_stars>1-10
require "gmail_cli/version"
require "gmail_cli/logger"
require "gmail_cli/oauth2_helper"
require "gmail_cli/shell"
require "gmail_cli/imap"
|
evendis/gmail_cli | spec/unit/shell_spec.rb | require 'spec_helper'
require 'getoptions'
describe GmailCli::Shell do
let(:getoptions) { GetOptions.new(GmailCli::Shell::OPTIONS, options) }
let(:shell) { GmailCli::Shell.new(getoptions,argv) }
before do
allow($stderr).to receive(:puts) # silence console feedback chatter
end
describe "#usage" do
... |
KaanOzkan/rails-i18n | lib/rails_i18n.rb | <reponame>KaanOzkan/rails-i18n
require 'rails_i18n/unicode'
require 'rails_i18n/railtie'
|
KaanOzkan/rails-i18n | lib/rails_i18n/unicode.rb | $KCODE = "U" if RUBY_VERSION < '1.9' && $KCODE == 'NONE' |
cheerharry90/TestPodSDK | TestPodSDK.podspec | Pod::Spec.new do |s|
#名称
s.name = 'TestPodSDK'
#版本号
s.version = '1.0.0'
#许可证
s.license = { :type => 'MIT' }
#项目主页地址
s.homepage = 'https://github.com/cheerharry90/TestPodSDK.git'
#作者
s.author = { "cheer_harry" => "<EMAIL>" }
#简介
s.summary = 'A delightful iOS framework.'... |
netguru-hackathon/toggler | command_line/handler.rb | <gh_stars>0
require_relative "parser"
module CommandLine
class Handler
attr_accessor :command, :params, :options, :project, :task
def initialize
@params = ARGV
@command = params.shift
assign_project_and_task(params.shift) unless params[0]&.start_with?("-")
@options = Parser.parse par... |
netguru-hackathon/toggler | command_line/parser.rb | <filename>command_line/parser.rb
require "optparse"
module CommandLine
Options = Struct.new(:description, :workspace, :billable)
class Parser
def self.parse(options)
args = Options.new
opt_parser = OptionParser.new do |opts|
opts.banner = "Usage: toggler [options]"
opts.on("-dDES... |
netguru-hackathon/toggler | toggl_manager.rb | <reponame>netguru-hackathon/toggler
module Toggler
class TogglManager
def initialize
@config = YAML::load_file("config.yml")
init_api
load_defaults
end
def start_entry(description:, task_name:, project_name:, billable:, workspace_name:)
project_name ||= default_project["name"]
... |
noelmcloughlin/insomnia-formula | test/integration/binary/controls/binary_spec.rb | <gh_stars>1-10
# frozen_string_literal: true
title 'insomnia archives profile'
control 'insomnia archive archive' do
impact 1.0
title 'should be installed'
end
|
Kadenze/carrierwave | spec/orm/activerecord_spec.rb | require 'spec_helper'
require 'support/activerecord'
def create_table(name)
ActiveRecord::Base.connection.create_table(name, force: true) do |t|
t.column :image, :string
t.column :images, :json
t.column :textfile, :string
t.column :textfiles, :json
t.column :foo, :string
end
end
def drop_table... |
Kadenze/carrierwave | spec/uploader/download_spec.rb | require 'spec_helper'
describe CarrierWave::Uploader::Download do
let(:uploader_class) { Class.new(CarrierWave::Uploader::Base) }
let(:uploader) { uploader_class.new }
let(:cache_id) { '1369894322-345-1234-2255' }
let(:base_url) { "http://www.example.com" }
let(:url) { base_url + "/test.jpg" }
let(:test_fi... |
TakuyaHarayama/flat_report | app/models/project.rb | # == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# team_id :integer not null
# client_name :string not null
# project_name :string not null
# status :integer default(0), not null
# description :... |
TakuyaHarayama/flat_report | app/controllers/application_controller.rb | require "application_responder"
class ApplicationController < ActionController::Base
self.responder = ApplicationResponder
protect_from_forgery with: :exception
respond_to :html
layout :set_layout
before_action :authenticate_user!
before_action :configure_permitted_parameters, if: :devise_controller?
b... |
TakuyaHarayama/flat_report | app/views/posts/show.json.jbuilder | <filename>app/views/posts/show.json.jbuilder
json.extract! @post, :id, :title, :body, :published, :created_at, :updated_at
|
TakuyaHarayama/flat_report | app/models/post_detail.rb | <gh_stars>0
# == Schema Information
#
# Table name: post_details
#
# id :integer not null, primary key
# post_id :integer not null
# project_id :integer not null
# spent_time :integer not null
# content :text not null
# created_at :datetime not... |
TakuyaHarayama/flat_report | app/views/team/projects/index.json.jbuilder | json.array!(@projects) do |project|
json.extract! post, :id, :client_name, :project_name, :status, :description, :scheduled_time, :actual_time, :created_at, :updated_at
json.url team_projects_url(project, format: :json)
end
|
TakuyaHarayama/flat_report | config/application.rb | <gh_stars>0
require_relative 'boot'
require 'rails/all'
Bundler.require(*Rails.groups)
module FlatReport
class Application < Rails::Application
config.load_defaults 5.1
# Test unit
config.generators.system_tests = nil
# I18n
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**',... |
TakuyaHarayama/flat_report | config/initializers/time_formats.rb | # Custome formats
Time::DATE_FORMATS[:ja] = "%Y年%m月%d日 %H時%M分"
Date::DATE_FORMATS[:ja] = "%Y年%m月d日"
|
TakuyaHarayama/flat_report | app/controllers/users_controller.rb | <reponame>TakuyaHarayama/flat_report
# NOTE: Defined 'members' by routes.rb
class UsersController < ApplicationController
before_action :set_user, only: :show
def index
@users = current_user.team.users
end
def show; end
def new
@user = current_user.team.users.new
end
def create
@user = cu... |
TakuyaHarayama/flat_report | db/seeds.rb | # Team
Team.destroy_all
Team.create!(
name: 'fake_name',
access_token: 'fake_access_token'
)
team = Team.first
# Post
Project.destroy_all
team.projects.create!(
client_name: 'fake_client',
project_name: 'fake_project',
status: 0,
description: 'fake_description',
scheduled_time: 100,
actual_time: 150
)... |
TakuyaHarayama/flat_report | app/controllers/me/posts_controller.rb | class Me::PostsController < ApplicationController
before_action :set_post, only: [:edit, :update, :destroy]
helper_method :current_post_hit
def index
@posts = current_user.posts
end
def edit
end
def update
respond_to do |format|
if @post.update(post_params)
format.html { redirect... |
TakuyaHarayama/flat_report | app/models/star.rb | # == Schema Information
#
# Table name: stars
#
# id :integer not null, primary key
# post_id :integer not null
# user_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_stars_on_post_id (... |
TakuyaHarayama/flat_report | db/migrate/20171022225901_create_projects.rb | class CreateProjects < ActiveRecord::Migration[5.1]
def change
create_table :projects do |t|
t.references :team, foreign_key: true, null: false
t.string :client_name, null: false
t.string :project_name, null: false
t.integer :status, default: 0, null: false
t.text :description
... |
TakuyaHarayama/flat_report | app/controllers/me/posts/stars_controller.rb | class Me::Posts::StarsController < ApplicationController
def index
@posts = current_user.starred_posts
.includes(:user)
end
end
|
TakuyaHarayama/flat_report | app/controllers/pages_controller.rb | <gh_stars>0
class PagesController < ApplicationController
skip_before_action :authenticate_user!
include HighVoltage::StaticPage
end
|
TakuyaHarayama/flat_report | app/controllers/users/posts_controller.rb | class Users::PostsController < ApplicationController
before_action :set_user
def index
@posts = @user.posts.order(created_at: :desc)
end
private
def set_user
@user = current_user.team.users.find(params[:member_id])
end
end
|
TakuyaHarayama/flat_report | app/controllers/mes_controller.rb | <filename>app/controllers/mes_controller.rb
class MesController < ApplicationController
before_action :set_me, only: [:show, :edit, :update]
def show
end
def edit
end
def update
respond_to do |format|
if @me.update(me_params)
format.html { redirect_to me_path, notice: 'Me was successful... |
TakuyaHarayama/flat_report | config/routes.rb | Rails.application.routes.draw do
# Devise routings
devise_for :users
# Authenticated root path
authenticated :user do
root :to => "dashboard#dashboard", :as => "user_authenticated_root"
end
resource :me, only: [:show, :edit, :update]
resource :team, only: [:show, :edit, :update]
namespace :team d... |
TakuyaHarayama/flat_report | app/views/teams/show.json.jbuilder | json.extract! @team, :id, :name, :access_token, :created_at, :updated_at
|
TakuyaHarayama/flat_report | config/initializers/materialize.rb | ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
class_attr_index = html_tag.index('class="')
first_tag_end_index = html_tag.index('>')
if class_attr_index.nil? || class_attr_index > first_tag_end_index
html_tag.insert(first_tag_end_index, ' class="error"')
else
html_tag.insert(clas... |
TakuyaHarayama/flat_report | config/initializers/high_voltage.rb | <gh_stars>0
HighVoltage.configure do |config|
config.routes = false
end
|
TakuyaHarayama/flat_report | app/views/team/projects/show.json.jbuilder | <filename>app/views/team/projects/show.json.jbuilder
json.extract! @project, :id, :client_name, :project_name, :status, :description, :scheduled_time, :actual_time, :created_at, :updated_at
|
TakuyaHarayama/flat_report | app/views/mes/show.json.jbuilder | <reponame>TakuyaHarayama/flat_report
json.extract! @me, :id, :username, :first_name, :last_name, :email, :created_at, :updated_at
|
TakuyaHarayama/flat_report | app/models/team.rb | # == Schema Information
#
# Table name: teams
#
# id :integer not null, primary key
# name :string not null
# access_token :string
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_teams_on_access_token (access_token) UN... |
TakuyaHarayama/flat_report | app/models/user.rb | # == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# team_id :integer not null
# first_name :string
# last_name :string
# username :string default(""), not null
# email ... |
TakuyaHarayama/flat_report | db/migrate/20171022225900_create_posts.rb | class CreatePosts < ActiveRecord::Migration[5.1]
def change
create_table :posts do |t|
t.references :user, foreign_key: true, null: false
t.datetime :published_at, null: false
t.text :unknown_content
t.text :impression_content
t.integer :status, default: 0, null: false
t.intege... |
TakuyaHarayama/flat_report | app/models/post.rb | <reponame>TakuyaHarayama/flat_report
# == Schema Information
#
# Table name: posts
#
# id :integer not null, primary key
# user_id :integer not null
# published_at :datetime not null
# unknown_content :text
# impression_content :text
# status ... |
TakuyaHarayama/flat_report | app/controllers/dashboard_controller.rb | class DashboardController < ApplicationController
def dashboard
end
end
|
TakuyaHarayama/flat_report | app/controllers/teams_controller.rb | class TeamsController < ApplicationController
before_action :set_team, only: [:show, :edit, :update]
def show
end
def edit
end
def update
respond_to do |format|
if @team.update(team_params)
format.html { redirect_to team_path, notice: 'Team was successfully updated.' }
format.js... |
AMSTKO/expo | packages/expo-dev-menu/TargetValidator.rb | <reponame>AMSTKO/expo
# Overrides CocoaPods class to bypass module dependencies check.
# We want to add vendored reanimated but then expo-dev-menu needs to
# depend on react modules which don't have modular_headers set.
module Pod
class Installer
class Xcode
class TargetValidator
private
... |
AMSTKO/expo | packages/expo-modules-autolinking/scripts/ios/autolinking_manager.rb | <filename>packages/expo-modules-autolinking/scripts/ios/autolinking_manager.rb<gh_stars>1-10
require_relative 'constants'
require_relative 'package'
# Require extensions to CocoaPods' classes
require_relative 'cocoapods/pod_target'
require_relative 'cocoapods/target_definition'
require_relative 'cocoapods/user_project... |
AMSTKO/expo | packages/expo-modules-autolinking/scripts/ios/cocoapods/pod_target.rb | <filename>packages/expo-modules-autolinking/scripts/ios/cocoapods/pod_target.rb
# Overrides CocoaPods `PodTarget` class to make the `ReactCommon` pod define a module
# and tell CocoaPods to generate a modulemap for it. This is needed for Swift/JSI integration
# until the upstream podspec add `DEFINES_MODULE => YES` to ... |
CrossRef/funder-reconciler | config.ru | <gh_stars>0
require './reconciler.rb'
run Sinatra::Application
|
CrossRef/funder-reconciler | funder-reconciler.rb | require 'bundler/setup'
require 'sinatra'
require 'json'
require 'open-uri'
set :bind, '0.0.0.0'
helpers do
def search_funders test_funder_name
uri ="http://api.crossref.org/funders?query=#{URI::encode(test_funder_name)}"
res = open(uri).read
return JSON.parse(res)
end
end
get '/heartbeat/?' , :provides =>... |
captproton/jim-weirich-rubymotion-intro | app/lib/layout.rb | <gh_stars>1-10
module Layout
def make_label(text)
label = UILabel.alloc.initWithFrame([[0, 0], [150, 30]])
label.font = UIFont.systemFontOfSize(20)
label.text = text
label.textColor = UIColor.darkGrayColor
label.backgroundColor = UIColor.clearColor
label
end
def make_button(title, actio... |
captproton/jim-weirich-rubymotion-intro | app/hello_view_controller.rb | class HelloViewController < UIViewController
include Layout
def viewDidLoad
view.backgroundColor = UIColor.whiteColor
layout(view, 10, 10) do |lb|
@hello = make_label("Hello, World")
@pushme = make_button("Push me", "pushed")
@clear_counter = make_button("Clear", "clear_counter")
... |
melvinsembrano/lockie | test/lockie/strategies/jwt_test.rb | require 'test_helper'
require 'auth_test_helper'
class Lockie::Strategies::JwtTest < ActionDispatch::IntegrationTest
include Warden::Test::Helpers
include AuthTestHelper
setup do
Lockie.configure do |c|
c.jwt_secret = "jwt-secret"
c.model_name = "User"
end
end
teardown { Warden.test_res... |
melvinsembrano/lockie | lib/lockie/strategies/failed.rb | module Lockie
module Strategies
class Failed < ::Warden::Strategies::Base
include Lockie::LogHelper
def valid?
true
end
def authenticate!
set_message 'Unauthorised'
fail!
end
end
end
end
Warden::Strategies.add(:failed, Lockie::Strategies::Failed)
|
melvinsembrano/lockie | lib/lockie.rb | <filename>lib/lockie.rb
require 'rails'
require 'warden'
require_relative "lockie/rails"
require_relative "lockie/log_helper"
require_relative "lockie/model_helper"
require_relative "lockie/controller_helper"
require_relative "lockie/strategies/email_password"
require_relative "lockie/strategies/jwt"
require_relative "... |
melvinsembrano/lockie | lib/lockie/model_helper.rb | require 'jwt'
module Lockie
module ModelHelper
extend ActiveSupport::Concern
def auth_object
@auth_object ||= Lockie.config.model_name.classify.constantize
end
included do
def create_token(payload = {})
payload = {
aud: 'lockie-app',
sub: id,
... |
melvinsembrano/lockie | lib/lockie/strategies/jwt.rb | <gh_stars>1-10
module Lockie
module Strategies
class Jwt < ::Warden::Strategies::Base
include Lockie::ModelHelper
include Lockie::LogHelper
def auth
@auth ||= ActionDispatch::Request.new(env)
end
def headers
auth.headers
end
def valid?
headers['... |
melvinsembrano/lockie | lib/lockie/strategies/email_password.rb | module Lockie
module Strategies
class EmailPassword < ::Warden::Strategies::Base
include Lockie::ModelHelper
include Lockie::LogHelper
def request
@request ||= ActionDispatch::Request.new(env)
end
def valid?
request.params['email'].present? && request.params['passwo... |
melvinsembrano/lockie | lib/lockie/failure_app.rb | <reponame>melvinsembrano/lockie
require 'action_controller/metal'
module Lockie
class FailureApp < ActionController::Metal
include ActionController::Redirecting
delegate :flash, to: :request
def self.call(*args)
req = ActionDispatch::Request.new(*args)
action(req.env['warden.options'][:actio... |
melvinsembrano/lockie | lib/lockie/rails.rb | require 'lockie/model_helper'
module Lockie
class Engine < ::Rails::Engine
config.app_middleware.use Warden::Manager do |manager|
manager.default_strategies Lockie.config.default_strategies
manager.failure_app = Lockie::FailureApp
if Lockie.config.serialize_session
serializer_... |
melvinsembrano/lockie | test/lockie/strategies/email_password_json_content_type_test.rb | <gh_stars>1-10
require 'test_helper'
require 'auth_test_helper'
class Lockie::Strategies::EmailPasswordJsonContentTypeTest < ActionDispatch::IntegrationTest
include Warden::Test::Helpers
include AuthTestHelper
setup do
Lockie.configure do |c|
c.model_name = "User"
end
end
teardown do
res... |
melvinsembrano/lockie | test/auth_test_helper.rb | module AuthTestHelper
def app
Rack::Builder.new do
use Warden::Manager do |config|
config.failure_app = Lockie::FailureApp
config.default_strategies Lockie.config.default_strategies
end
map "/json" do
run lambda { |env|
env['warden'].authenticate
if... |
melvinsembrano/lockie | test/dummy/app/models/user.rb | class User < ApplicationRecord
has_secure_password
include Lockie::ModelHelper
end
|
melvinsembrano/lockie | test/lockie/model_helper_test.rb | <reponame>melvinsembrano/lockie
require 'test_helper'
class Lockie::ControllerHelper::Test < ActiveSupport::TestCase
include Warden::Test::Helpers
class User
include Lockie::ModelHelper
def initialize(record)
@record = record
end
def id
@record.dig(:id)
end
def self.find(id)
... |
melvinsembrano/lockie | test/lockie_test.rb | require 'test_helper'
class Lockie::Test < ActiveSupport::TestCase
include Warden::Test::Helpers
teardown do
reset_lockie!
Warden.test_reset!
end
test "truth" do
assert_kind_of Module, Lockie
end
end
|
melvinsembrano/lockie | lib/lockie/log_helper.rb | module Lockie
module LogHelper
def set_message(message)
env['warden.message'] = message
end
end
end
|
melvinsembrano/lockie | test/lockie/controller_helper_test.rb | <filename>test/lockie/controller_helper_test.rb<gh_stars>1-10
require 'test_helper'
class Lockie::ControllerHelper::Test < ActiveSupport::TestCase
include Warden::Test::Helpers
teardown do
reset_lockie!
Warden.test_reset!
end
test "current auth helper should be #current_user" do
Lockie.configure d... |
melvinsembrano/lockie | lib/lockie/controller_helper.rb | module Lockie
module ControllerHelper
extend ActiveSupport::Concern
included do
if respond_to?(:helper_method)
helper_method "current_#{ Lockie.config.model_name.underscore.gsub(/\//, '_') }".to_sym
helper_method :logged_in?
helper_method :authenticated?
end
def wa... |
melvinsembrano/lockie | test/lockie/configuration_test.rb | require 'test_helper'
require 'auth_test_helper'
class Lockie::ConfigurationTest < ActionDispatch::IntegrationTest
include Warden::Test::Helpers
include AuthTestHelper
setup do
end
teardown do
reset_lockie!
Warden.test_reset!
end
test "should allow custom session serializer" do
Lockie.co... |
yellowhammer/secretary-rails | spec/internal/db/schema.rb | ActiveRecord::Schema.define do
create_table "animals", :force => true do |t|
t.string "name"
t.string "species"
t.string "color"
t.integer "person_id"
t.timestamps null: false
end
create_table "cars", :force => true do |t|
t.string "name"
t.string "color"
t.integer "year"
t.ti... |
yellowhammer/secretary-rails | spec/lib/secretary/versioned_attributes_spec.rb | <filename>spec/lib/secretary/versioned_attributes_spec.rb
require 'spec_helper'
describe Secretary::VersionedAttributes do
describe '::versioned_attributes' do
it 'uses the attributes set in the model' do
expect(Animal.versioned_attributes).to eq ["name", "color"]
end
it 'uses the column names min... |
yellowhammer/secretary-rails | lib/secretary/dirty_associations.rb | module Secretary
module DirtyAssociations
extend ActiveSupport::Concern
extend ActiveSupport::Autoload
autoload :Collection
autoload :Singular
COLLECTION_SUFFIX = "_were"
SINGULAR_SUFFIX = "_was"
module ClassMethods
# Backport of rails/rails#5383f22bb83adbd0e2e3f182f68196f1... |
yellowhammer/secretary-rails | lib/secretary/config.rb | module Secretary
class Config
DEFAULTS = {
:user_class => "::User",
:ignored_attributes => ['id', 'created_at', 'updated_at']
}
attr_writer :user_class
def user_class
@user_class || DEFAULTS[:user_class]
end
attr_writer :ignored_attributes
def ignored_attri... |
yellowhammer/secretary-rails | spec/factories.rb | FactoryGirl.define do
factory :animal do
name "Fred"
species "Elephant"
color "gray"
end
factory :car do
name "Betsy"
color "white"
year 1984
end
factory :image do
title "Obama"
url "http://obama.com/obama.jpg"
end
factory :location do
title "Crawford Family Forum"
... |
yellowhammer/secretary-rails | app/models/secretary/version.rb | <reponame>yellowhammer/secretary-rails
module Secretary
class Version < ActiveRecord::Base
#monkey patch
self.table_name = "secretary_versions"
acts_as_paranoid
belongs_to :version_object_change, dependent: :destroy, inverse_of: :version
validates :versioned, presence: true
validates :vers... |
MnkGitBox/MNkAnimatedTabBarController | MNkAnimatedTabBarController.podspec | #
# Be sure to run `pod lib lint MNkAnimatedTabBarController.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name ... |
Mahyar1990/Pod-Chat-iOS-SDK | FanapPodChatSDK.podspec | <filename>FanapPodChatSDK.podspec
Pod::Spec.new do |s|
s.name = "FanapPodChatSDK"
s.version = "0.6.2.5"
s.summary = "Fanap's POD Chat SDK"
s.description = "This Package is used for creating chat apps for companies whoes want to use Fanap Chat Services; This Package will use Fanap-Pod-Async-... |
carolgreene/trip-tracker | app/controllers/trips_controller.rb | <reponame>carolgreene/trip-tracker
require 'rack-flash'
class TripsController < ApplicationController
use Rack::Flash
get '/trips' do
if !logged_in?
flash[:message] = "You have to sign in to do that"
redirect '/login'
else
@user = User.find(session[:user_id])
erb :'/trips/trips'
... |
longbai/objc-netinfo | QNNetworkInfo.podspec | Pod::Spec.new do |s|
s.name = "QNNetworkInfo"
s.version = "0.0.1"
s.summary = "network infomation functions."
s.description = "Network infomation functions. Include dns servers, local ip, nettype"
s.homepage = 'https://github.com/qiniu/objc-netinfo'
s.author = 'Qiniu => <EMAIL>... |
andrewmcodes/gem_actions | gem_actions.gemspec | <reponame>andrewmcodes/gem_actions
# frozen_string_literal: true
require_relative "lib/gem_actions/version"
Gem::Specification.new do |s|
s.name = "gem_actions"
s.version = GemActions::VERSION
s.authors = ["<NAME>"]
s.email = ["<EMAIL>"]
s.homepage = "https://github.com/andrewmcodes/gem_actions"
s.summary... |
andrewmcodes/gem_actions | lib/gem_actions/version.rb | # frozen_string_literal: true
module GemActions # :nodoc:
VERSION = "0.0.2"
end
|
andrewmcodes/gem_actions | lib/gem_actions.rb | <filename>lib/gem_actions.rb
# frozen_string_literal: true
require "gem_actions/version"
|
totosimo/parentFriend | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
before_action :authenticate_user!
before_action :configure_permitted_parameters, if: :devise_controller?
include Pundit
after_action :verify_authorized, except: :index, unless: :skip_pundit?
after_action :verify_policy_scoped, only: :index, unless: :skip_p... |
totosimo/parentFriend | app/models/user.rb | <reponame>totosimo/parentFriend
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_one_attached :photo... |
totosimo/parentFriend | db/seeds.rb | <reponame>totosimo/parentFriend<filename>db/seeds.rb
require 'open-uri'
require 'faker'
require 'json'
starttime = Time.now
# Deleting ###############################################################
puts "Deleting all database entries..."
Booking.delete_all
Message.delete_all
Event.delete_all
UserChatroom.delete_all... |
totosimo/parentFriend | app/controllers/pages_controller.rb | <gh_stars>0
class PagesController < ApplicationController
skip_before_action :authenticate_user!, only: [ :home ]
def home
end
def main
end
def meet
@users = User.near(current_user, 3)
@markersUsers = @users.geocoded.map do |user|
{
lat: user.latitude,
lng: user.l... |
totosimo/parentFriend | app/models/event.rb | <filename>app/models/event.rb<gh_stars>0
class Event < ApplicationRecord
belongs_to :user
geocoded_by :address
has_one_attached :photo
has_many :bookings, dependent: :destroy
after_validation :geocode, if: :will_save_change_to_address?
validates :name, :date_time_start, :date_time_end, :address, presence: :... |
totosimo/parentFriend | db/migrate/20210303102923_create_events.rb | <filename>db/migrate/20210303102923_create_events.rb
class CreateEvents < ActiveRecord::Migration[6.0]
def change
create_table :events do |t|
t.string :name
t.text :description
t.float :latitude
t.float :longitude
t.datetime :date_time_start
t.datetime :date_time_end
t.re... |
totosimo/parentFriend | app/channels/chatroom_channel.rb | class ChatroomChannel < ApplicationCable::Channel
def subscribed
# stream_from "some_channel"
chatroom = Chatroom.find(params[:id])
stream_for chatroom
end
def unsubscribed
# Any cleanup needed when channel is unsubscribed
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.