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 | erichaydel/errdo | https://github.com/erichaydel/errdo | test/integrations/authorization_integration_test.rb | Ruby | mit | 87 | master | 2,953 | require 'test_helper'
class Ability
include CanCan::Ability
def initialize(user)
if user && user.loser?
cannot :manage, Errdo::Error
else
can :manage, Errdo::Error
end
end
end
class AuthorizationIntegrationTest < ActionDispatch::IntegrationTest
context "cancancan" do
setup do
... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/helpers/views_helper_test.rb | Ruby | mit | 87 | master | 1,025 | require 'test_helper'
class ViewsHelperTest < ActionView::TestCase
include Errdo::Helpers::ViewsHelper
context "methods" do
context "user_show_string" do
should "default to email" do
@user = users(:user)
assert_equal @user.email, user_show_string(@user)
end
should "correctl... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/models/error_occurrence_test.rb | Ruby | mit | 87 | master | 537 | require 'test_helper'
class ErrorOccurrenceTest < ActiveSupport::TestCase
context "model linkages" do
setup do
@occ = FactoryGirl.create(:error_occurrence)
end
should "have correct relations" do
@occ.error
end
end
context "callbacks" do
should "update last_occurrence of error w... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/models/errdo_test.rb | Ruby | mit | 87 | master | 2,797 | require 'test_helper'
require 'rake'
class ErrdoTest < ActiveSupport::TestCase
context "methods on the module" do
context "warn and error" do
setup do
Errdo.notify_with slack: { webhook: "https://slack.com/test" }
stub_request :any, /.*slack.*/
end
teardown do
Errdo.in... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/models/error_test.rb | Ruby | mit | 87 | master | 2,521 | require 'test_helper'
class ErrorTest < ActiveSupport::TestCase
context "model attributes" do
setup do
@error = FactoryGirl.create(:error)
end
should "have right fields" do
@error.status
end
should "default status to active" do
assert @error.active?
end
end
context "... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/generators/active_record_generator_test.rb | Ruby | mit | 87 | master | 929 | require 'test_helper'
require 'minitest/mock'
require "generators/active_record/errdo_generator"
class ActiveRecordGeneratorTest < Rails::Generators::TestCase
tests ActiveRecord::Generators::ErrdoGenerator
destination File.expand_path("../../tmp", __FILE__)
setup :prepare_destination
should "make sure that m... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/generators/errdo_generator_test.rb | Ruby | mit | 87 | master | 664 | require "generators/errdo/errdo_generator"
require 'test_helper'
class ErrdoGeneratorTest < Rails::Generators::TestCase
tests Errdo::Generators::ErrdoGenerator
destination File.expand_path("../../tmp", __FILE__)
setup :prepare_destination
setup :make_initializer
should "add class name to initializer" do
... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/generators/install_generator_test.rb | Ruby | mit | 87 | master | 718 | require 'test_helper'
class InstallGeneratorTest < Rails::Generators::TestCase
tests Errdo::Generators::InstallGenerator
destination File.expand_path("../../tmp", __FILE__)
setup :prepare_destination
setup :make_application_rb
setup :make_initializers_dir
should "assert initializer is properly created" d... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/db/schema.rb | Ruby | mit | 87 | master | 3,548 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/db/migrate/20161120204607_update_columns.rb | Ruby | mit | 87 | master | 736 | class UpdateColumns < ActiveRecord::Migration
def up
change_column :errors, :exception_class_name, :text
change_column :errors, :exception_message, :text
change_column :errors, :host_name, :text
change_column :errors, :url, :text
change_column :error_occurrences, :user_agent, :text
... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/db/migrate/20160816202941_devise_create_users.rb | Ruby | mit | 87 | master | 1,401 | class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
t.d... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/db/migrate/20161004015324_errdo_create_errors.rb | Ruby | mit | 87 | master | 1,343 | class ErrdoCreateErrors < ActiveRecord::Migration
def change
create_table :errors do |t|
t.string :exception_class_name
t.string :exception_message
t.string :http_method
t.string :host_name
t.string :url
t.text :backtrace
t.string :backtrace_hash
t.integer :occurr... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/app/models/user.rb | Ruby | mit | 87 | master | 396 | class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
enum permission_class: [:regular, :loser] # For testi... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/app/models/ability.rb | Ruby | mit | 87 | master | 1,090 | class Ability
include CanCan::Ability
def initialize(_user)
# Define abilities for the passed in user here. For example:
#
# user ||= User.new # guest user (not logged in)
# if user.admin?
# can :manage, :all
# else
# can :read, :all
# end
#
# The first argu... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/app/controllers/static_controller.rb | Ruby | mit | 87 | master | 2,554 | class StaticController < ApplicationController
def home
end
def generic_error
raise "standard-error"
end
def long_error
raise "e" * 256
end
def deep_error
eval(params[:code])
render :home
end
def log
Errdo.error "This is the error", user: current_user, data: "This is the data"... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/app/controllers/application_controller.rb | Ruby | mit | 87 | master | 294 | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
rescue_from CanCan::AccessDenied do
redirect_to root_url, alert: "FAILURE"
end
end |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/config/routes.rb | Ruby | mit | 87 | master | 420 | Rails.application.routes.draw do
devise_for :users
get 'static/home'
get 'static/generic_error'
get 'static/long_error'
get 'static/deep_error'
get 'static/log'
get 'static/view_error'
get 'static/double_render_error'
get 'static/embedded_partial_error'
post 'static/post_error'
get 'static/extreme... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/config/application.rb | Ruby | mit | 87 | master | 1,018 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "errdo"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/ini... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/config/environments/development.rb | Ruby | mit | 87 | master | 1,718 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/config/environments/production.rb | Ruby | mit | 87 | master | 3,377 | 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 both threaded web serve... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/config/environments/test.rb | Ruby | mit | 87 | master | 1,828 | Rails.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 | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/config/initializers/devise.rb | Ruby | mit | 87 | master | 13,379 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/dummy/config/initializers/errdo.rb | Ruby | mit | 87 | master | 713 | Errdo.setup do |config|
config.current_user_method = :current_user
config.user_string_method = :email
config.user_show_path = :user_path
config.authorize_with :cancan
# This is the name of the class inside your application that the exceptions are stored as.
# Exceptions are a reserved class name.
#
... |
github | erichaydel/errdo | https://github.com/erichaydel/errdo | test/controllers/errors_controller_test.rb | Ruby | mit | 87 | master | 555 | require 'test_helper'
module Errdo
class ErrorsControllerTest < ActionController::TestCase
include Devise::TestHelpers
setup do
@routes = Engine.routes
end
context "actions" do
setup do
@error = FactoryGirl.create(:error)
@occ = FactoryGirl.create(:error_occurrence, err... |
github | telerik/fiddler-docs | https://github.com/telerik/fiddler-docs | build_kb.rb | Ruby | apache-2.0 | 87 | master | 883 | temp_file = "temp_exclude_result.tmp"
File.delete(temp_file) if File.exist?(temp_file)
config_file = "_config.yml"
paths_to_include = ARGV.collect!{|arg| arg += '/' unless arg[-1] == '/'}
orig_config = File.read(config_file)
orig_exlude = orig_config[/(?<=exclude: \[)[^\]]*/].split(',')
all_paths = Dir["*/"].reject{ ... |
github | telerik/fiddler-docs | https://github.com/telerik/fiddler-docs | api_sort.rb | Ruby | apache-2.0 | 87 | master | 1,022 | filename = ARGV.first
def sections_as_key_values(text, re)
text = text.strip
keys = text.scan(re).reject { |value| value.empty? }
values = text.split(re).reject { |value| value.empty? }
raise "keys and values don't match" unless keys.size == values.size
keys.each_with_index.map { |key, index| {... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | Guardfile | Ruby | bsd-3-clause | 87 | master | 622 | guard 'rspec', cmd: 'bundle exec rspec' do
watch('spec/spec_helper.rb') { 'spec' }
watch('config/routes.rb') { 'spec/controllers' }
watch('app/controllers/application_controller.rb') { 'spec/controllers' }
watch(%r{^spec/(.+)_spec\.rb$}) { |m... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | Rakefile | Ruby | bsd-3-clause | 87 | master | 321 | require 'bundler'
Bundler::GemHelper.install_tasks
require 'rspec/core/rake_task'
require 'spree/testing_support/common_rake'
RSpec::Core::RakeTask.new
task default: :spec
desc 'Generates a dummy app for testing'
task :test_app do
ENV['LIB_NAME'] = 'spree_static_content'
Rake::Task['common:test_app'].invoke
end |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spree_static_content.gemspec | Ruby | bsd-3-clause | 87 | master | 1,654 | # coding: utf-8
lib = File.expand_path('../lib/', __FILE__)
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
require 'spree_static_content/version'
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_static_content'
s.version = SpreeStaticContent.version
s.summar... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/spec_helper.rb | Ruby | bsd-3-clause | 87 | master | 801 | require 'simplecov'
SimpleCov.start 'rails'
ENV['RAILS_ENV'] ||= 'test'
begin
require File.expand_path('../dummy/config/environment', __FILE__)
rescue LoadError
puts 'Could not load dummy application. Please ensure you have run `bundle exec rake test_app`'
exit
end
require 'pry'
require 'ffaker'
require 'rspec... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/helpers/page_helper_spec.rb | Ruby | bsd-3-clause | 87 | master | 326 | RSpec.describe Spree::PagesHelper, type: :helper do
context '.render_snippet' do
it 'returns body when page exists' do
page = create(:page)
expect(render_snippet(page.slug)).to eq page.body
end
it 'returns nil when no page exist' do
expect(render_snippet('hello')).to be_nil
end
en... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/support/capybara.rb | Ruby | bsd-3-clause | 87 | master | 429 | require 'capybara/rspec'
require 'capybara/rails'
require 'capybara/poltergeist'
RSpec.configure do |config|
Capybara.javascript_driver = :poltergeist
Capybara.register_driver(:poltergeist) do |app|
Capybara::Poltergeist::Driver.new app, js_errors: true, timeout: 60
end
config.before(:each, :js) do
i... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/support/spree.rb | Ruby | bsd-3-clause | 87 | master | 449 | require 'spree/testing_support/factories'
require 'spree/testing_support/url_helpers'
require 'spree/testing_support/controller_requests'
require 'spree/testing_support/authorization_helpers'
require 'spree/testing_support/capybara_ext'
RSpec.configure do |config|
config.include Spree::TestingSupport::ControllerRequ... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/factories/page_factory.rb | Ruby | bsd-3-clause | 87 | master | 284 | FactoryGirl.define do
factory :page, class: Spree::Page do
title { generate(:random_string) }
body { generate(:random_description) }
sequence(:slug) { |n| "/page#{n}" }
trait :with_foreign_link do
foreign_link { Faker::Internet.http_url }
end
end
end |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/lib/spree_static_content_spec.rb | Ruby | bsd-3-clause | 87 | master | 930 | RSpec.describe StaticPage do
context '.remove_spree_mount_point' do
specify do
path = '/hello'
expect(subject.remove_spree_mount_point(path)).to eq 'hello'
end
end
end
RSpec.describe Spree::StaticPage do
context '.matches?' do
it 'is true when valid page' do
page = create(:page, slu... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/controllers/static_content_controller_spec.rb | Ruby | bsd-3-clause | 87 | master | 1,117 | RSpec.describe Spree::StaticContentController, type: :controller do
before do
allow(controller).to receive(:spree_current_user).and_return(nil)
end
let!(:store) { create(:store, default: true) }
context '#show' do
it 'accepts path as root' do
page = create(:page, slug: '/', stores: [store])
... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/features/static_content_spec.rb | Ruby | bsd-3-clause | 87 | master | 1,767 | RSpec.feature 'Static Content Page', :js do
let!(:store) { create(:store, default: true) }
context 'render page' do
scenario 'is a query string' do
create(:page, slug: '/page', title: 'Query Test', stores: [store])
visit '/page?test'
expect(page).to have_text 'Query Test'
end
scenari... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/features/admin/pages_spec.rb | Ruby | bsd-3-clause | 87 | master | 1,614 | RSpec.feature 'Admin Static Content', :js do
stub_authorization!
context 'when no page exists' do
background do
visit spree.admin_pages_path
end
scenario 'can create new page' do
expect(page).to have_text 'No Page found, Add One!'
click_link 'New page'
expect(page).to have_tex... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | spec/models/page_spec.rb | Ruby | bsd-3-clause | 87 | master | 988 | RSpec.describe Spree::Page, type: :model do
let!(:page) { create(:page) }
context 'factory' do
it 'is valid' do
expect(page).to be_valid
end
end
it 'always add / prefix to slug' do
page = create(:page, slug: 'hello')
expect(page.slug).to eq '/hello'
end
context '.link' do
it 're... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | lib/spree_static_content.rb | Ruby | bsd-3-clause | 87 | master | 658 | require 'spree_core'
require 'spree_static_content/engine'
require 'spree_static_content/version'
require 'coffee_script'
require 'sass/rails'
module StaticPage
module_function
def remove_spree_mount_point(path)
regex = Regexp.new '\A' + Rails.application.routes.url_helpers.spree_path
path.sub(regex, '').... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | lib/generators/spree_static_content/install/install_generator.rb | Ruby | bsd-3-clause | 87 | master | 843 | module SpreeStaticContent
module Generators
class InstallGenerator < Rails::Generators::Base
class_option :auto_run_migrations, type: :boolean, default: false
def add_stylesheets
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/spree_static_cont... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | lib/spree_static_content/engine.rb | Ruby | bsd-3-clause | 87 | master | 442 | module SpreeStaticContent
class Engine < Rails::Engine
require 'spree/core'
isolate_namespace Spree
engine_name 'spree_static_content'
config.autoload_paths += %W(#{config.root}/lib)
def self.activate
Dir.glob(%W(#{config.root}/app/overrides/*.rb)) do |klass|
Rails.configuration.ca... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | lib/spree_static_content/version.rb | Ruby | bsd-3-clause | 87 | master | 348 | module SpreeStaticContent
module_function
# Returns the version of the currently loaded SpreeStaticContent as a
# <tt>Gem::Version</tt>.
def version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 3
MINOR = 0
TINY = 0
PRE = 'beta'
STRING = [MAJOR, MINOR, TINY, PRE].... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | db/migrate/20090625125735_extend_pages.rb | Ruby | bsd-3-clause | 87 | master | 801 | class ExtendPages < ActiveRecord::Migration
class Page < ActiveRecord::Base
end
def self.up
change_table :spree_pages do |t|
t.boolean :show_in_header, default: false, null: false
t.boolean :show_in_footer, default: false, null: false
t.string :foreign_link
t.integer :position, defau... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | db/migrate/20140926121757_add_pages_stores.rb | Ruby | bsd-3-clause | 87 | master | 293 | class AddPagesStores < ActiveRecord::Migration
def change
create_table :spree_pages_stores, id: false do |t|
t.integer :store_id
t.integer :page_id
t.timestamps
end
add_index :spree_pages_stores, :store_id
add_index :spree_pages_stores, :page_id
end
end |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | db/migrate/20091219021134_add_meta_fields_to_pages.rb | Ruby | bsd-3-clause | 87 | master | 209 | class AddMetaFieldsToPages < ActiveRecord::Migration
def self.up
add_column :spree_pages, :meta_keywords, :string
add_column :spree_pages, :meta_description, :string
end
def self.down
end
end |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | db/migrate/20090814113100_add_visible_to_pages.rb | Ruby | bsd-3-clause | 87 | master | 349 | class AddVisibleToPages < ActiveRecord::Migration
class Page < ActiveRecord::Base
end
def self.up
add_column :spree_pages, :visible, :boolean
if Page.table_exists?
Page.update_all visible: true
else
Spree::Page.update_all visible: true
end
end
def self.down
remove_column :spr... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | db/migrate/20081216193152_create_pages.rb | Ruby | bsd-3-clause | 87 | master | 246 | class CreatePages < ActiveRecord::Migration
def self.up
create_table :spree_pages do |t|
t.string :title
t.text :body
t.string :slug
t.timestamps
end
end
def self.down
drop_table :spree_pages
end
end |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | db/migrate/20100323085528_add_show_in_sidebar_option_to_pages.rb | Ruby | bsd-3-clause | 87 | master | 243 | class AddShowInSidebarOptionToPages < ActiveRecord::Migration
def self.up
add_column :spree_pages, :show_in_sidebar, :boolean, default: false, null: false
end
def self.down
remove_column :spree_pages, :show_in_sidebar
end
end |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | db/migrate/20120723144115_add_render_as_partial_for_layout_for_spree_pages.rb | Ruby | bsd-3-clause | 87 | master | 397 | class AddRenderAsPartialForLayoutForSpreePages < ActiveRecord::Migration
def up
unless column_exists? :spree_pages, :render_layout_as_partial
add_column :spree_pages, :render_layout_as_partial, :boolean, default: false
end
end
def down
if column_exists? :spree_pages, :render_layout_as_partial
... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | app/overrides/pages_in_header.rb | Ruby | bsd-3-clause | 87 | master | 204 | Deface::Override.new(
virtual_path: 'spree/shared/_main_nav_bar',
name: 'pages_in_header',
insert_bottom: '#main-nav-bar > ul:first-child',
partial: 'spree/static_content/static_content_header'
) |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | app/models/spree/page.rb | Ruby | bsd-3-clause | 87 | master | 1,691 | class Spree::Page < ActiveRecord::Base
default_scope { order(position: :asc) }
has_and_belongs_to_many :stores, join_table: 'spree_pages_stores'
validates :title, presence: true
validates :slug, :body, presence: true, if: :not_using_foreign_link?
validates :layout, presence: true, if: :render_layout_as_part... |
github | pero-ict-solutions/spree-static-content | https://github.com/pero-ict-solutions/spree-static-content | app/controllers/spree/static_content_controller.rb | Ruby | bsd-3-clause | 87 | master | 586 | module Spree
class StaticContentController < StoreController
rescue_from ActiveRecord::RecordNotFound, with: :render_404
helper 'spree/products'
layout :determine_layout
def show
@page = Spree::Page.by_store(current_store).visible.find_by_slug!(request.path)
end
private
def deter... |
github | jbaines-r7/cisco_asa_research | https://github.com/jbaines-r7/cisco_asa_research | modules/asdm_fetch_config/cisco_asa_asdm_config.rb | Ruby | bsd-3-clause | 87 | main | 3,226 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Cisco
include Msf::Auxiliary::Scanner
def initialize(info = {})
... |
github | jbaines-r7/cisco_asa_research | https://github.com/jbaines-r7/cisco_asa_research | modules/asdm_fetch_config/cisco.rb | Ruby | bsd-3-clause | 87 | main | 15,455 | # -*- coding: binary -*-
module Msf
###
#
# This module provides methods for working with Cisco equipment
#
###
module Auxiliary::Cisco
include Msf::Auxiliary::Report
def cisco_ios_decrypt7(inp)
xlat = [
0x64, 0x73, 0x66, 0x64, 0x3b, 0x6b, 0x66, 0x6f,
0x41, 0x2c, 0x2e, 0x69, ... |
github | jbaines-r7/cisco_asa_research | https://github.com/jbaines-r7/cisco_asa_research | modules/cve_2021_1585/metasploit-framework.gemspec | Ruby | bsd-3-clause | 87 | main | 9,494 | # coding: utf-8
# During build, the Gemfile is temporarily moved and
# we must manually define the project root
if ENV['MSF_ROOT']
lib = File.realpath(File.expand_path('lib', ENV['MSF_ROOT']))
else
# have to use realpath as metasploit-framework is often loaded through a symlink and tools like Coverage and debugger... |
github | jbaines-r7/cisco_asa_research | https://github.com/jbaines-r7/cisco_asa_research | modules/cve_2021_1585/cisco_asdm_evil_endpoint_cve_2021_1585.rb | Ruby | bsd-3-clause | 87 | main | 5,490 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'lzma'
class MetasploitModule < Msf::Exploit::Remote
Rank = ManualRanking
include Msf::Exploit::Remote::HttpServer
def initialize(info = {})
super(
updat... |
github | jbaines-r7/cisco_asa_research | https://github.com/jbaines-r7/cisco_asa_research | modules/cve_2022_20828/cisco_asax_sfr_rce.rb | Ruby | bsd-3-clause | 87 | main | 5,363 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
prepend Msf::Exploit::Remote::AutoCheck
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit:... |
github | jbaines-r7/cisco_asa_research | https://github.com/jbaines-r7/cisco_asa_research | modules/asdm_bruteforce/cisco_asa_asdm_bruteforce.rb | Ruby | bsd-3-clause | 87 | main | 3,732 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Report
include Msf::Auxiliary::AuthBrute
include Msf::Auxiliary::Sca... |
github | jbaines-r7/cisco_asa_research | https://github.com/jbaines-r7/cisco_asa_research | modules/cve_2022_20651/cisco_asdm_logfile.rb | Ruby | bsd-3-clause | 87 | main | 3,191 | # frozen_string_literal: true
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Post
include Msf::Post::File
include Msf::Post::Windows::UserProfiles
include Msf::Post::Windows::Packrat
ARTIFA... |
github | jbaines-r7/cisco_asa_research | https://github.com/jbaines-r7/cisco_asa_research | modules/boot_image_shell/cisco_asax_firepower_boot_root.rb | Ruby | bsd-3-clause | 87 | main | 11,491 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::SSH
include Msf::Exploit::CmdStager
def initialize(info = {})
super... |
github | vbanthia-zz/appium-docker-demo | https://github.com/vbanthia-zz/appium-docker-demo | Vagrantfile | Ruby | mit | 87 | master | 1,155 | # -*- mode: ruby -*-
# -*- coding: utf-8 -*-
Vagrant.require_version '>= 1.6.0'
Vagrant.configure(2) do |config|
# always use Vagrants insecure key
config.ssh.insert_key = false
# Ubuntu 14.04, 64 bit
config.vm.box = 'ubuntu/trusty64'
config.vm.box_version = '~> 14.04'
# Set memory to 2048
# A... |
github | vbanthia-zz/appium-docker-demo | https://github.com/vbanthia-zz/appium-docker-demo | Rakefile | Ruby | mit | 87 | master | 842 | # -*- coding: utf-8 -*-
require 'rspec/core/rake_task'
task :default => [:spec]
desc 'Run all test'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
namespace :spec do
desc 'Run test for addition feature'
RSpec::Core::RakeTask.new(:addition) do |spec|
spec.pattern = FileList[ 'spec/features/addition_... |
github | vbanthia-zz/appium-docker-demo | https://github.com/vbanthia-zz/appium-docker-demo | spec/spec_helper.rb | Ruby | mit | 87 | master | 759 | # -*- coding: utf-8 -*-
require 'appium_lib'
# support files
SPEC_ROOT = File.expand_path(File.dirname(__FILE__))
Dir[File.expand_path('support/**/*.rb', SPEC_ROOT)].each { |f| require f }
app_path = ENV['APP_PATH'] || File.join(Bundler.root, 'apks', 'android-sample-app.apk')
device_serial = ENV['DEVICE_SERIAL'] || ... |
github | vbanthia-zz/appium-docker-demo | https://github.com/vbanthia-zz/appium-docker-demo | spec/support/screenshot.rb | Ruby | mit | 87 | master | 864 | # -*- coding: utf-8 -*-
require 'fileutils'
module Screenshot
module_function
## Usage:
# capture_screenshot => #{ screenshot_dir }/img_1.png
# capture_screenshot(prefix: 'foo') => #{ screenshot_dir}/foo_img_2.png
def capture_screenshot(prefix: nil)
img_name = "img_#{ screenshot_count }.png"
img_n... |
github | vbanthia-zz/appium-docker-demo | https://github.com/vbanthia-zz/appium-docker-demo | spec/support/extns/screenshot_embedded_html_formatter.rb | Ruby | mit | 87 | master | 740 | require 'rspec/core/formatters/html_formatter'
require 'base64'
require_relative '../screenshot'
class ScreenshotEmbeddedHtmlFormatter < RSpec::Core::Formatters::HtmlFormatter
RSpec::Core::Formatters.register self
include ::Screenshot
def extra_failure_content(failure)
screenshot_path = failure.example.m... |
github | vbanthia-zz/appium-docker-demo | https://github.com/vbanthia-zz/appium-docker-demo | spec/features/multiplication_spec.rb | Ruby | mit | 87 | master | 897 | # -*- coding: utf-8 -*-
RSpec.describe 'Calculator' do
let!(:x) { 7 }
let!(:y) { 3 }
context 'multiplication' do
before do
$driver.find_element(:accessibility_id, 'resetButton').click
sleep 1
$driver.find_element(:accessibility_id, 'inputFieldLeft').send_key(x)
$driver.find_element(... |
github | vbanthia-zz/appium-docker-demo | https://github.com/vbanthia-zz/appium-docker-demo | spec/features/addition_spec.rb | Ruby | mit | 87 | master | 842 | # -*- coding: utf-8 -*-
RSpec.describe 'Calculator' do
let!(:x) { 7 }
let!(:y) { 3 }
context 'addition' do
before do
$driver.find_element(:accessibility_id, 'resetButton').click
sleep 1
$driver.find_element(:accessibility_id, 'inputFieldLeft').send_key(x)
$driver.find_element(:acces... |
github | vbanthia-zz/appium-docker-demo | https://github.com/vbanthia-zz/appium-docker-demo | spec/features/division_spec.rb | Ruby | mit | 87 | master | 893 | # -*- coding: utf-8 -*-
RSpec.describe 'Calculator' do
let!(:x) { 7 }
let!(:y) { 3 }
context 'division' do
before do
$driver.find_element(:accessibility_id, 'resetButton').click
sleep 1
$driver.find_element(:accessibility_id, 'inputFieldLeft').send_key(x)
$driver.find_element(:acces... |
github | vbanthia-zz/appium-docker-demo | https://github.com/vbanthia-zz/appium-docker-demo | spec/features/subtraction_spec.rb | Ruby | mit | 87 | master | 888 | # -*- coding: utf-8 -*-
RSpec.describe 'Calculator' do
let!(:x) { 15 }
let!(:y) { 5 }
context 'subtraction' do
before do
$driver.find_element(:accessibility_id, 'resetButton').click
sleep 1
$driver.find_element(:accessibility_id, 'inputFieldLeft').send_key(x)
$driver.find_element(:a... |
github | junegunn/tmux-fzf-url | https://github.com/junegunn/tmux-fzf-url | fzf-url.rb | Ruby | mit | 87 | master | 2,291 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'English'
require 'shellwords'
def executable(*commands)
commands.find do |c|
`command -v "#{c.split.first}"`.empty?.!
end
end
def halt(message)
system "tmux display-message #{Shellwords.escape(message)}"
exit
end
def with(command)
io = IO.pope... |
github | socketry/http-accept | https://github.com/socketry/http-accept | gems.rb | Ruby | mit | 87 | main | 345 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2024, by Samuel Williams.
source "https://rubygems.org"
gemspec
group :maintenance, optional: true do
gem "bake-modernize"
gem "bake-gem"
gem "utopia-project"
end
group :test do
gem "bake-test"
gem "bake-test-external"
gem ... |
github | socketry/http-accept | https://github.com/socketry/http-accept | http-accept.gemspec | Ruby | mit | 87 | main | 794 | # frozen_string_literal: true
require_relative "lib/http/accept/version"
Gem::Specification.new do |spec|
spec.name = "http-accept"
spec.version = HTTP::Accept::VERSION
spec.summary = "Parse Accept and Accept-Language HTTP headers."
spec.authors = ["Samuel Williams", "Matthew Kerwin", "Alif Rachmawadi", "Andy B... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/languages.rb | Ruby | mit | 87 | main | 4,184 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
# Copyright, 2021, by Khaled Hassan Hussein.
require 'http/accept/languages'
describe HTTP::Accept::Languages do
it "should parse basic header" do
languages = HTTP::Accept::Languages.parse("da, en-gb;q=0.5,... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/frozen.rb | Ruby | mit | 87 | main | 1,270 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
require 'http/accept/media_types'
require 'http/accept/languages'
describe HTTP::Accept::MediaTypes::Map do
let(:converter) do
Struct.new(:content_type) do
def split(*args)
self.content_type.split(*a... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/quoted_string.rb | Ruby | mit | 87 | main | 363 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
require 'http/accept/quoted_string'
describe HTTP::Accept::QuotedString do
it "should ignore linear whitespace" do
quoted_string = HTTP::Accept::QuotedString.unquote(%Q{"Hello\r\n World"})
expect(quot... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/media_types.rb | Ruby | mit | 87 | main | 4,301 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
require 'http/accept/media_types'
require 'http/accept/content_type'
describe HTTP::Accept::MediaTypes do
it "should parse basic header with multiple parameters" do
media_types = HTTP::Accept::MediaTypes.pa... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/encodings.rb | Ruby | mit | 87 | main | 3,176 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016, by Matthew Kerwin.
# Copyright, 2017-2024, by Samuel Williams.
require 'http/accept/encodings'
describe HTTP::Accept::Encodings::ContentCoding do
it "should have default quality_factor of 1.0" do
encoding = HTTP::Accept::Encodings:... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/browser.rb | Ruby | mit | 87 | main | 2,235 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
require 'http/accept/media_types'
require 'http/accept/content_type'
ServerContextTypes = Sus::Shared("server content types") do
let(:json_content_type) {HTTP::Accept::ContentType.new("application", "json")}
... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/negotiation.rb | Ruby | mit | 87 | main | 1,355 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
require 'http/accept/media_types'
require 'http/accept/content_type'
describe HTTP::Accept::MediaTypes do
let(:json_content_type) {HTTP::Accept::ContentType.new("application", "json")}
let(:html_content_type... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/content_type.rb | Ruby | mit | 87 | main | 1,569 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
require 'http/accept/content_type'
describe HTTP::Accept::ContentType do
it "should raise argument error if constructed with wildcard" do
expect{HTTP::Accept::ContentType.new("*", "*")}.to raise_exception(A... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/charsets.rb | Ruby | mit | 87 | main | 3,126 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016, by Matthew Kerwin.
# Copyright, 2017-2024, by Samuel Williams.
require 'http/accept/charsets'
describe HTTP::Accept::Charsets::Charset do
it "should have default quality_factor of 1.0" do
charset = HTTP::Accept::Charsets::Charset.n... |
github | socketry/http-accept | https://github.com/socketry/http-accept | test/http/media_types/map.rb | Ruby | mit | 87 | main | 1,942 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
require 'http/accept/media_types'
require 'http/accept/media_types/map'
require 'http/accept/content_type'
describe HTTP::Accept::MediaTypes::Map do
let(:converter) do
Struct.new(:content_type) do
def sp... |
github | socketry/http-accept | https://github.com/socketry/http-accept | lib/http/accept.rb | Ruby | mit | 87 | main | 474 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
# Copyright, 2016, by Matthew Kerwin.
# Copyright, 2017, by Andy Brody.
require_relative 'accept/version'
# Accept: header
require_relative 'accept/media_types'
require_relative 'accept/content_type'
# Accept... |
github | socketry/http-accept | https://github.com/socketry/http-accept | lib/http/accept/quoted_string.rb | Ruby | mit | 87 | main | 996 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
module HTTP
module Accept
# According to https://tools.ietf.org/html/rfc7231#appendix-C
TOKEN = /[!#$%&'*+\-.^_`|~0-9A-Z]+/i
QUOTED_STRING = /"(?:.(?!(?<!\\)"))*.?"/
module QuotedString
# Unquote... |
github | socketry/http-accept | https://github.com/socketry/http-accept | lib/http/accept/charsets.rb | Ruby | mit | 87 | main | 2,029 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016, by Matthew Kerwin.
# Copyright, 2017-2024, by Samuel Williams.
require 'strscan'
require_relative 'parse_error'
require_relative 'quoted_string'
require_relative 'sort'
module HTTP
module Accept
module Charsets
# https://tools.... |
github | socketry/http-accept | https://github.com/socketry/http-accept | lib/http/accept/languages.rb | Ruby | mit | 87 | main | 2,565 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
# Copyright, 2021, by Khaled Hassan Hussein.
require 'strscan'
require_relative 'parse_error'
require_relative 'sort'
module HTTP
module Accept
module Languages
# https://tools.ietf.org/html/rfc3066#sec... |
github | socketry/http-accept | https://github.com/socketry/http-accept | lib/http/accept/media_types.rb | Ruby | mit | 87 | main | 3,586 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
require 'strscan'
require_relative 'parse_error'
require_relative 'quoted_string'
require_relative 'sort'
require_relative 'media_types/map'
module HTTP
module Accept
# Parse and process the HTTP Accept: ... |
github | socketry/http-accept | https://github.com/socketry/http-accept | lib/http/accept/encodings.rb | Ruby | mit | 87 | main | 2,428 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016, by Matthew Kerwin.
# Copyright, 2017-2024, by Samuel Williams.
require 'strscan'
require_relative 'parse_error'
require_relative 'quoted_string'
require_relative 'sort'
module HTTP
module Accept
module Encodings
# https://tools... |
github | socketry/http-accept | https://github.com/socketry/http-accept | lib/http/accept/content_type.rb | Ruby | mit | 87 | main | 619 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
require_relative 'media_types'
require_relative 'quoted_string'
module HTTP
module Accept
# A content type is different from a media range, in that a content type should not have any wild cards.
class Con... |
github | socketry/http-accept | https://github.com/socketry/http-accept | lib/http/accept/sort.rb | Ruby | mit | 87 | main | 444 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
module HTTP
module Accept
module Sort
# This sorts items with higher priority first, and keeps items with the same priority in the same relative order.
def self.by_quality_factor(items)
# We do thi... |
github | socketry/http-accept | https://github.com/socketry/http-accept | lib/http/accept/media_types/map.rb | Ruby | mit | 87 | main | 1,795 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2024, by Samuel Williams.
module HTTP
module Accept
module MediaTypes
# Map a set of mime types to objects.
class Map
WILDCARD = "*/*".freeze
def initialize
@media_types = {}
end
def freeze
u... |
github | kickstarter/event-sourcing-rails-todo-app-demo | https://github.com/kickstarter/event-sourcing-rails-todo-app-demo | Gemfile | Ruby | mit | 87 | master | 1,896 | source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.4'
# Use sqlite3 as the database for Active Record... |
github | kickstarter/event-sourcing-rails-todo-app-demo | https://github.com/kickstarter/event-sourcing-rails-todo-app-demo | db/schema.rb | Ruby | mit | 87 | master | 1,877 | # 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 | kickstarter/event-sourcing-rails-todo-app-demo | https://github.com/kickstarter/event-sourcing-rails-todo-app-demo | db/migrate/20190501030348_create_todo_items.rb | Ruby | mit | 87 | master | 282 | class CreateTodoItems < ActiveRecord::Migration[5.2]
def change
create_table :todo_items do |t|
t.integer :todo_list_id, null: false
t.string :name, null: false
t.datetime :due_date
t.boolean :completed
t.timestamps null: false
end
end
end |
github | kickstarter/event-sourcing-rails-todo-app-demo | https://github.com/kickstarter/event-sourcing-rails-todo-app-demo | db/migrate/20190501031240_todo_item_events.rb | Ruby | mit | 87 | master | 342 | class TodoItemEvents < ActiveRecord::Migration[5.2]
def change
create_table :todo_item_events do |t|
t.string :type, null: false
t.integer :todo_item_id, null: false
t.text :data, null: false
t.text :metadata, null: false
t.datetime :created_at, null: false
t.index :todo_item... |
github | kickstarter/event-sourcing-rails-todo-app-demo | https://github.com/kickstarter/event-sourcing-rails-todo-app-demo | db/migrate/20180529232913_create_todo_list_events.rb | Ruby | mit | 87 | master | 348 | class CreateTodoListEvents < ActiveRecord::Migration[5.1]
def change
create_table :todo_list_events do |t|
t.string :type, null: false
t.integer :todo_list_id, null: false
t.text :data, null: false
t.text :metadata, null: false
t.datetime :created_at, null: false
t.index :tod... |
github | kickstarter/event-sourcing-rails-todo-app-demo | https://github.com/kickstarter/event-sourcing-rails-todo-app-demo | test/models/todo_item_test.rb | Ruby | mit | 87 | master | 356 | require 'test_helper'
class TodoListTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
test "create a todo item" do
todo_list = TodoList.create!(name: "List")
event = Commands::TodoItem::Create.call(name: "Todo", todo_list: todo_list, metadata: {})
todo_item = event.todo_item
assert_equ... |
github | kickstarter/event-sourcing-rails-todo-app-demo | https://github.com/kickstarter/event-sourcing-rails-todo-app-demo | test/models/todo_list_test.rb | Ruby | mit | 87 | master | 617 | require 'test_helper'
class TodoListTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
test "create a todo list" do
perform_enqueued_jobs do
Commands::TodoList::Create.call(name: "My first list", metadata: { source: "test" })
end
assert_equal "My first list", TodoList.first!.name
en... |
github | kickstarter/event-sourcing-rails-todo-app-demo | https://github.com/kickstarter/event-sourcing-rails-todo-app-demo | config/application.rb | Ruby | mit | 87 | master | 927 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
# require "action_mailer/railtie"
require "action_view/railtie"
# require "action_cable/engine"
require "sprockets/rail... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.