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 | railsbump/app | https://github.com/railsbump/app | db/migrate/20260407000001_create_lockfile_checks_and_gem_checks.rb | Ruby | mit | 213 | main | 967 | class CreateLockfileChecksAndGemChecks < ActiveRecord::Migration[8.0]
def change
create_table :lockfile_checks do |t|
t.belongs_to :lockfile, null: false, foreign_key: true
t.belongs_to :rails_release, null: false, foreign_key: true
t.string :status, null: false, default: "pending"
t.strin... |
github | railsbump/app | https://github.com/railsbump/app | db/migrate/20200125222830_create_lockfile_dependencies.rb | Ruby | mit | 213 | main | 208 | class CreateLockfileDependencies < ActiveRecord::Migration[6.0]
def change
create_table :lockfile_dependencies, id: false do |t|
t.references :lockfile
t.references :gemmy
end
end
end |
github | railsbump/app | https://github.com/railsbump/app | db/migrate/20191222070102_create_compats.rb | Ruby | mit | 213 | main | 416 | class CreateCompats < ActiveRecord::Migration[6.0]
def change
create_table :compats do |t|
t.jsonb :dependencies
t.string :dependencies_key
t.string :status_determined_by
t.integer :status
t.datetime :checked_at
t.references :rails_release, foreign_key: true
t.timestamps
... |
github | railsbump/app | https://github.com/railsbump/app | db/migrate/20191222065024_create_gemmies.rb | Ruby | mit | 213 | main | 284 | class CreateGemmies < ActiveRecord::Migration[6.0]
def change
create_table :gemmies do |t|
t.string :name, index: { unique: true }
t.json :dependencies_and_versions, default: {}
t.json :compat_ids, default: [], null: false
t.timestamps
end
end
end |
github | railsbump/app | https://github.com/railsbump/app | db/migrate/20240930143554_add_columns_to_rails_releases_table.rb | Ruby | mit | 213 | main | 483 | class AddColumnsToRailsReleasesTable < ActiveRecord::Migration[7.1]
def change
add_column :rails_releases, :minimum_ruby_version, :string
add_column :rails_releases, :minimum_bundler_version, :string
add_column :rails_releases, :minimum_rubygems_version, :string
add_column :rails_releases, :maximum_ru... |
github | railsbump/app | https://github.com/railsbump/app | db/migrate/20200125221350_create_lockfiles.rb | Ruby | mit | 213 | main | 408 | class CreateLockfiles < ActiveRecord::Migration[6.0]
def change
create_table :lockfiles do |t|
t.text :content
t.string :slug, index: { unique: true }
t.timestamps
end
enable_extension 'pgcrypto' # Add this line to enable UUID generation
# change_column :lockfiles, :id, :uuid, defa... |
github | railsbump/app | https://github.com/railsbump/app | db/migrate/20240927154305_create_api_keys.rb | Ruby | mit | 213 | main | 267 | class CreateAPIKeys < ActiveRecord::Migration[7.1]
def change
create_table :api_keys do |t|
t.string :name
t.string :key
t.timestamps
end
add_index :api_keys, :name, unique: true
add_index :api_keys, :key, unique: true
end
end |
github | railsbump/app | https://github.com/railsbump/app | db/migrate/20241125191510_create_inaccessible_gemmies.rb | Ruby | mit | 213 | main | 313 | class CreateInaccessibleGemmies < ActiveRecord::Migration[7.1]
def change
create_table :inaccessible_gemmies do |t|
t.text :name
t.belongs_to :lockfile, null: false, foreign_key: true
t.timestamps
end
add_index :inaccessible_gemmies, [:lockfile_id, :name], unique: true
end
end |
github | railsbump/app | https://github.com/railsbump/app | db/migrate/20240911015959_add_missing_sequences.rb | Ruby | mit | 213 | main | 1,178 | class AddMissingSequences < ActiveRecord::Migration[7.1]
def up
up_sequence('gemmies')
up_sequence('compats')
up_sequence('github_notifications')
up_sequence('lockfiles')
up_sequence('rails_releases')
end
def down
down_sequence('gemmies')
down_sequence('compats')
down_sequence('gi... |
github | railsbump/app | https://github.com/railsbump/app | db/migrate/20200201222813_create_github_notifications.rb | Ruby | mit | 213 | main | 355 | class CreateGithubNotifications < ActiveRecord::Migration[6.0]
def change
create_table :github_notifications do |t|
t.string :conclusion
t.string :action, null: false
t.string :branch, null: false
t.jsonb :data
t.datetime :processed_at
t.references :compat, foreign_key: true
... |
github | railsbump/app | https://github.com/railsbump/app | lib/direct_resolver.rb | Ruby | mit | 213 | main | 4,454 | # frozen_string_literal: true
require "bundler"
require "bundler/resolver"
require "bundler/resolver/base"
require "bundler/source/rubygems"
class DirectResolver
Result = Struct.new(:compatible?, :error, :specs, keyword_init: true) do
def resolved_version(gem_name)
specs&.dig(gem_name)
end
end
Ta... |
github | railsbump/app | https://github.com/railsbump/app | lib/direct_resolver/subprocess.rb | Ruby | mit | 213 | main | 1,270 | # frozen_string_literal: true
require "open3"
require "json"
class DirectResolver
class Subprocess
SCRIPT = File.expand_path("../../../bin/resolve_gem", __FILE__)
def initialize(rails_version:, ruby_version:, dependencies: {}, rubygems_version: Gem::VERSION, bundler_version: Bundler::VERSION, promoter: :la... |
github | railsbump/app | https://github.com/railsbump/app | lib/tasks/data.rake | Ruby | mit | 213 | main | 4,366 | # lib/tasks/update_rails_releases.rake
namespace :data do
SUPPORTED_RAILS_VERSIONS = %w(
2.3
3.0
3.1
3.2
4.0
4.1
4.2
5.0
5.1
5.2
6.0
6.1
7.0
7.1
7.2
8.0
8.1
)
task find_or_create_rails_releases: :environment do
SUPPORTED_RAILS_VERSIONS.each ... |
github | railsbump/app | https://github.com/railsbump/app | spec/rails_helper.rb | Ruby | mit | 213 | main | 3,362 | # This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
requ... |
github | railsbump/app | https://github.com/railsbump/app | spec/spec_helper.rb | Ruby | mit | 213 | main | 4,850 | if ENV["COVERAGE"]
require "simplecov"
require "simplecov-console"
SimpleCov.start "rails"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console
])
end
# This file was generated by the `rails generate rspec:install` comman... |
github | railsbump/app | https://github.com/railsbump/app | spec/helpers/rails_releases_helper_spec.rb | Ruby | mit | 213 | main | 3,013 | require "rails_helper"
RSpec.describe RailsReleasesHelper, type: :helper do
describe "#head_title" do
context "when @gemmy is not set" do
it "calls super" do
expect(helper.head_title).to eq("RailsBump.org: Rails Compatibility Checker Tool")
end
end
context "when @gemmy is set" do
... |
github | railsbump/app | https://github.com/railsbump/app | spec/helpers/application_helper_spec.rb | Ruby | mit | 213 | main | 8,159 | require "rails_helper"
RSpec.describe ApplicationHelper, type: :helper do
describe "#compats_status" do
let(:rails_release) { FactoryBot.create(:rails_release) }
let(:gemmy) { FactoryBot.create(:gemmy) }
context "when gemmy is inaccessible" do
let(:lockfile) { FactoryBot.build(:lockfile) }
l... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/report_error_spec.rb | Ruby | mit | 213 | main | 463 | require "rails_helper"
RSpec.describe ReportError, type: :service do
describe ".call" do
it "delegates to Baseline::ReportError" do
expect(Baseline::ReportError).to receive(:call).with("test error")
ReportError.call("test error")
end
it "handles error with additional context" do
expec... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/check_git_branches_spec.rb | Ruby | mit | 213 | main | 4,937 | require "rails_helper"
RSpec.describe CheckGitBranches, type: :service do
let(:service) { described_class.new }
describe "#call" do
let(:mock_client) { instance_double(External::Github) }
before do
allow(External::Github).to receive(:new).and_return(mock_client)
allow(mock_client).to receive(... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/maintenance/hourly_spec.rb | Ruby | mit | 213 | main | 2,915 | require "rails_helper"
RSpec.describe Maintenance::Hourly, type: :service do
let(:service) { described_class.new }
describe "#call" do
before do
allow(CheckGitBranches).to receive(:call_in)
allow(EmailNotifications::SendAll).to receive(:call_in)
allow(SitemapGenerator).to receive(:verbose=)
... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/rails_releases/create_spec.rb | Ruby | mit | 213 | main | 2,458 | require "rails_helper"
RSpec.describe RailsReleases::Create, type: :service do
let(:service) { described_class.new }
describe "#call" do
before { allow(RailsReleases::Process).to receive(:perform_async) }
context "with a valid stable version" do
it "creates a new RailsRelease" do
expect do
... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/rails_releases/process_spec.rb | Ruby | mit | 213 | main | 840 | require "rails_helper"
RSpec.describe RailsReleases::Process, type: :service do
let(:rails_release) { FactoryBot.create(:rails_release) }
let(:service) { described_class.new }
describe "#call" do
before do
FactoryBot.create(:gemmy, name: "gem1")
FactoryBot.create(:gemmy, name: "gem2")
allo... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/gemmies/update_compats_spec.rb | Ruby | mit | 213 | main | 466 | require "rails_helper"
RSpec.describe Gemmies::UpdateCompats do
describe "#call", vcr: { record: :once } do
let(:gemmy) { FactoryBot.create :gemmy }
before do
@rails_release = FactoryBot.create :rails_release
Gemmies::UpdateDependenciesAndVersions.call(gemmy)
end
it "creates a compat fo... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/gemmies/process_spec.rb | Ruby | mit | 213 | main | 1,115 | # spec/services/gemmies/process_spec.rb
require 'rails_helper'
RSpec.describe Gemmies::Process, type: :service, vcr: { record: :once } do
describe '#call' do
let(:gemmy) { FactoryBot.create(:gemmy, name: 'ombu_labs-auth') }
let(:service) { described_class.new }
before do
FactoryBot.create(:rails_r... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/external/github_spec.rb | Ruby | mit | 213 | main | 2,024 | require "rails_helper"
RSpec.describe External::Github, type: :service do
let(:service) { described_class.new }
let(:mock_client) { instance_double(Octokit::Client) }
before do
allow(Octokit::Client).to receive(:new).and_return(mock_client)
end
describe "#list_branches" do
let(:branches) { [{ name:... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/email_notifications/send_all_spec.rb | Ruby | mit | 213 | main | 1,115 | require "rails_helper"
RSpec.describe EmailNotifications::SendAll, type: :service do
let(:service) { described_class.new }
let(:gemmy) { FactoryBot.create(:gemmy) }
let(:email_notification) { EmailNotification.new(email: "test@example.com", notifiable: gemmy) }
before do
allow(EmailNotification).to receiv... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/github_notifications/process_spec.rb | Ruby | mit | 213 | main | 6,072 | require "rails_helper"
RSpec.describe GithubNotifications::Process, type: :service do
let(:service) { described_class.new }
let(:compat) do
compat = FactoryBot.create(:compat, status: :pending)
# Ensure compat has checked_at set so validation passes when updating status
compat.update_column(:checked_at... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/compats/check_spec.rb | Ruby | mit | 213 | main | 2,252 | require "rails_helper"
RSpec.describe Compats::Check, type: :service do
let(:compat) { FactoryBot.create(:compat, rails_release: rails_release, status: "pending", dependencies: []) }
let(:rails_release) { FactoryBot.create(:rails_release) }
let(:service) { described_class.new }
describe "#call" do
context... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/compats/check_unchecked_spec.rb | Ruby | mit | 213 | main | 381 | require "rails_helper"
RSpec.describe Compats::CheckUnchecked, type: :service do
describe "do_call" do
it "calls Compats::Check#call" do
expect(Compats::Check).to receive(:call)
release = FactoryBot.create :rails_release, version: "5.0"
compat = FactoryBot.create :compat, rails_release: releas... |
github | railsbump/app | https://github.com/railsbump/app | spec/services/compats/checks/empty_dependencies_check_spec.rb | Ruby | mit | 213 | main | 2,433 | require "rails_helper"
RSpec.describe Compats::Checks::EmptyDependenciesCheck, type: :service do
let(:rails_release) { FactoryBot.create(:rails_release) }
let(:compat) { Compat.new(status: :pending, rails_release: rails_release, dependencies: {}) }
let(:check) { described_class.new(compat) }
describe "#call" ... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/rails_release_spec.rb | Ruby | mit | 213 | main | 1,027 | require "rails_helper"
RSpec.describe RailsRelease, type: :model do
subject { described_class.new(version: "6.0") }
describe "valid?" do
it "returns true" do
expect(subject).to be_valid
end
end
describe ".next_after" do
let!(:release_6_1) { FactoryBot.create(:rails_release, version: "6.1") ... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/github_notification_spec.rb | Ruby | mit | 213 | main | 3,461 | require "rails_helper"
RSpec.describe GithubNotification, type: :model do
describe "validations" do
let(:valid_attributes) do
{
action: "completed",
branch: "main",
conclusion: "success",
data: { "test" => "data" }
}
end
it "is valid with valid attributes" do
... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/target_runtime_spec.rb | Ruby | mit | 213 | main | 4,063 | require "rails_helper"
RSpec.describe TargetRuntime, type: :model do
let(:rails_release) do
FactoryBot.create(:rails_release,
version: "7.2",
minimum_ruby_version: "3.1.0",
minimum_bundler_version: "2.3.22",
minimum_rubygems_version: "3.3.3")
end
def lockfile_stub(ruby: nil, bundler:... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/email_notification_spec.rb | Ruby | mit | 213 | main | 3,720 | require "rails_helper"
RSpec.describe EmailNotification, type: :model do
let(:gemmy) { FactoryBot.create(:gemmy) }
let(:email) { "test@example.com" }
let(:email_notification) { EmailNotification.new(email: email, notifiable: gemmy) }
describe "validations" do
it "is valid with valid attributes" do
e... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/inconclusive_compat_spec.rb | Ruby | mit | 213 | main | 1,050 | require "rails_helper"
RSpec.describe InconclusiveCompat, type: :model do
let(:rails_release) { FactoryBot.create(:rails_release) }
let(:inconclusive_compat) do
compat = InconclusiveCompat.create!(
rails_release: rails_release,
dependencies: { "gem" => "~> 1.0" },
status: :pending
)
#... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/lockfile_spec.rb | Ruby | mit | 213 | main | 3,372 | require "rails_helper"
RSpec.describe Lockfile, type: :model, new_check_flow: true do
def build_lockfile(rails_version: "7.1.3")
content = <<~LOCK
GEM
remote: https://rubygems.org/
specs:
rails (#{rails_version})
puma (6.4.0)
PLATFORMS
ruby
DEPENDEN... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/api_key_spec.rb | Ruby | mit | 213 | main | 2,002 | require 'rails_helper'
RSpec.describe APIKey, type: :model do
describe "#valid?" do
let(:valid_attributes) { { name: "Valid API Key", key: "a" * 64 } }
it "is valid with valid attributes" do
api_key = APIKey.new(valid_attributes)
expect(api_key).to be_valid
end
it "is invalid without a ... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/gem_check_spec.rb | Ruby | mit | 213 | main | 5,087 | require "rails_helper"
RSpec.describe GemCheck, type: :model, new_check_flow: true do
let(:gem_check) { build(:gem_check, gem_name: "puma", locked_version: "6.0.0") }
describe ".create_for!" do
let(:lockfile_check) { FactoryBot.create(:lockfile_check) }
def locked_gem(name: "puma", version: "6.0.0", sour... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/lockfile_check_spec.rb | Ruby | mit | 213 | main | 3,439 | require "rails_helper"
RSpec.describe LockfileCheck, type: :model, new_check_flow: true do
let(:rails_release) do
FactoryBot.create(:rails_release,
version: "7.2",
minimum_ruby_version: "3.1.0",
minimum_bundler_version: "2.3.22",
minimum_rubygems_version: "3.3.3")
end
def build_lockf... |
github | railsbump/app | https://github.com/railsbump/app | spec/models/lockfile/parsed_spec.rb | Ruby | mit | 213 | main | 3,791 | require "rails_helper"
RSpec.describe Lockfile::Parsed, type: :model, new_check_flow: true do
def lockfile_content(rails_version: "7.1.3", ruby: nil, bundler: "2.4.10", extra_deps: "")
<<~LOCK
GEM
remote: https://rubygems.org/
specs:
rails (#{rails_version})
puma (6.4.0)... |
github | railsbump/app | https://github.com/railsbump/app | spec/controllers/email_notifications_controller_spec.rb | Ruby | mit | 213 | main | 2,189 | require "rails_helper"
RSpec.describe EmailNotificationsController, type: :controller do
describe "POST #create" do
let(:gemmy) { FactoryBot.create(:gemmy) }
let(:valid_params) do
{
email_notification: {
email: "test@example.com",
notifiable_gid: gemmy.to_global_id.to_s
... |
github | railsbump/app | https://github.com/railsbump/app | spec/controllers/static_controller_spec.rb | Ruby | mit | 213 | main | 365 | require "rails_helper"
RSpec.describe StaticController, type: :controller do
describe "GET #robots" do
it "returns 200 OK" do
get :robots, format: :text
expect(response).to have_http_status(:ok)
end
it "renders the robots template" do
get :robots, format: :text
expect(response).t... |
github | railsbump/app | https://github.com/railsbump/app | spec/controllers/lockfiles_controller_spec.rb | Ruby | mit | 213 | main | 3,009 | require 'rails_helper'
RSpec.describe LockfilesController, type: :controller, vcr: { record: :once } do
let(:lockfile) { FactoryBot.build(:lockfile) }
describe "GET #new" do
it "returns a success response" do
get :new
expect(response).to be_successful
end
end
describe "POST #create" do
... |
github | railsbump/app | https://github.com/railsbump/app | spec/controllers/sitemaps_controller_spec.rb | Ruby | mit | 213 | main | 1,281 | require "rails_helper"
RSpec.describe SitemapsController, type: :controller do
describe "GET #show" do
context "when FOG_URL is set" do
let(:sitemap_url) { "https://s3.us-east-1.amazonaws.com/railsbump.org" }
let(:sitemap_content) { "<?xml version='1.0'?><urlset></urlset>" }
before do
... |
github | railsbump/app | https://github.com/railsbump/app | spec/controllers/rails_releases_controller_spec.rb | Ruby | mit | 213 | main | 1,320 | require "rails_helper"
RSpec.describe RailsReleasesController, type: :controller do
describe "GET #show" do
let(:gemmy) { FactoryBot.create(:gemmy, name: "test_gem") }
let!(:rails_release) { FactoryBot.create(:rails_release, version: "7.1") }
it "assigns the gemmy" do
get :show, params: { gemmy_id... |
github | railsbump/app | https://github.com/railsbump/app | spec/controllers/gemmies_controllers_spec.rb | Ruby | mit | 213 | main | 1,251 | require "rails_helper"
RSpec.describe GemmiesController, type: :controller do
describe "GET #compat_table" do
context "when gemmy_ids param is missing" do
it "renders successfully with an empty gemmies list" do
get :compat_table
expect(response).to have_http_status(:ok)
end
end
... |
github | railsbump/app | https://github.com/railsbump/app | spec/controllers/api/releases_controller_spec.rb | Ruby | mit | 213 | main | 1,624 | require "rails_helper"
RSpec.describe API::ReleasesController, type: :controller do
describe "POST #create" do
context "when name is 'rails'" do
before { allow(RailsReleases::Create).to receive(:perform_async) }
it "schedules RailsReleases::Create with the version" do
post :create, params: {... |
github | railsbump/app | https://github.com/railsbump/app | spec/controllers/api/github_notifications_controller_spec.rb | Ruby | mit | 213 | main | 1,807 | require "rails_helper"
RSpec.describe API::GithubNotificationsController, type: :controller do
describe "POST #create" do
# Realistic GitHub Check Run webhook payload structure
let(:notification_data) do
{
"action" => "completed",
"check_run" => {
"id" => 1234567890,
... |
github | railsbump/app | https://github.com/railsbump/app | spec/controllers/api/results_controller_spec.rb | Ruby | mit | 213 | main | 3,416 | require 'rails_helper'
RSpec.describe API::ResultsController, type: :controller do
let(:api_key) { FactoryBot.create(:api_key) }
let(:rails_release) { FactoryBot.create(:rails_release) }
let(:compat) { FactoryBot.create(:compat, rails_release: rails_release, status: :pending) }
let(:headers) { { 'RAILS-BUMP-AP... |
github | railsbump/app | https://github.com/railsbump/app | spec/mailers/application_mailer_spec.rb | Ruby | mit | 213 | main | 2,003 | require "rails_helper"
RSpec.describe ApplicationMailer, type: :mailer do
describe "#email_notification" do
context "when notifiable is a Gemmy" do
let(:gemmy) { FactoryBot.create(:gemmy, name: "test_gem") }
let(:email_notification) do
EmailNotification.new(
email: "test@example.com... |
github | railsbump/app | https://github.com/railsbump/app | spec/requests/api/compats_spec.rb | Ruby | mit | 213 | main | 3,192 | require "rails_helper"
RSpec.describe "Gemmies JSON API", type: :request do
include FactoryBot::Syntax::Methods
describe "GET /gems/:id.json" do
context "when the gem exists with compats" do
let(:rails_71) { create(:rails_release, version: "7.1") }
let(:rails_72) { create(:rails_release, version: ... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | apivore.gemspec | Ruby | apache-2.0 | 213 | master | 1,675 | $:.push File.expand_path("../lib", __FILE__)
require 'apivore/version'
Gem::Specification.new do |s|
s.name = 'apivore'
s.version = Apivore::VERSION
s.summary = "Tests your API against its OpenAPI (Swagger) 2.0 spec"
s.description = "Tests your rails API using its OpenAPI (Swagger) description o... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | spec/request_spec.rb | Ruby | apache-2.0 | 213 | master | 1,459 | require 'spec_helper'
describe "Example API", type: :apivore, order: :defined do
subject { Apivore::SwaggerChecker.instance_for("/swagger-doc.json") }
context "has valid paths" do
it 'allows the same path (with response documented) to be tested twice' do
expect(subject).to validate(:get, "/services.json... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | spec/apivore_spec.rb | Ruby | apache-2.0 | 213 | master | 1,758 | require 'spec_helper'
describe 'Apivore::Swagger' do
context 'with valid swagger 2.0 input' do
let(:doc) { IO.read(File.join(File.dirname(__FILE__), "data", "01_sample2.0.json")) }
let(:swagger) { Apivore::Swagger.new(JSON.parse(doc)) }
subject { swagger }
it { should be_an_instance_of(Apivore::Swa... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | spec/rails_shim_spec.rb | Ruby | apache-2.0 | 213 | master | 952 | require 'spec_helper'
describe 'Apivore::RailsShim' do
describe '.action_dispatch_request_args' do
subject {
Apivore::RailsShim.action_dispatch_request_args(
path,
params: params,
headers: headers
)
}
let(:path) { '/posts' }
let(:params) { { 'foo' => 'bar' } }
... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | spec/integration_spec.rb | Ruby | apache-2.0 | 213 | master | 3,052 | context "Apivore tests running against a mock API" do
describe "the test checks unimplemented path" do
it 'should show an alert that the specific path is unimplemented' do
stdout = `rspec spec/data/example_specs.rb --example 'unimplemented path'`
expect(stdout).to match(/1 failure/)
expect(stdo... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | spec/data/example_specs.rb | Ruby | apache-2.0 | 213 | master | 2,271 | require 'spec_helper'
context "API testing scenarios" do
include Apivore::RspecMatchers
include Apivore::RspecHelpers
describe "unimplemented path", :type => :request do
subject { Apivore::SwaggerChecker.instance_for("/02_unimplemented_path.json") }
it "fails" do
expect(subject).to validate(:get, ... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore.rb | Ruby | apache-2.0 | 213 | master | 689 | require 'json-schema'
require 'rspec'
require 'apivore/rspec_matchers'
require 'apivore/rspec_helpers'
require 'apivore/swagger_checker'
require 'apivore/swagger'
RSpec.configure do |config|
config.include Apivore::RspecMatchers, type: :apivore
config.include Apivore::RspecHelpers, type: :apivore
end
# Load and r... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore/rspec_matchers.rb | Ruby | apache-2.0 | 213 | master | 1,949 | require 'rspec/expectations'
require 'net/http'
module Apivore
module RspecMatchers
extend RSpec::Matchers::DSL
matcher :be_consistent_with_swagger_definitions do |master_swagger_url, current_service|
attr_reader :actual, :expected
define_method :cleaned_definitions do |definitions, current_ser... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore/rspec_helpers.rb | Ruby | apache-2.0 | 213 | master | 449 | require 'apivore/validator'
require 'apivore/all_routes_tested_validator'
require 'apivore/custom_schema_validator'
module Apivore
module RspecHelpers
def validate(method, path, response_code, params = {})
Validator.new(method, path, response_code, params)
end
def conform_to(custom_schema)
C... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore/validator.rb | Ruby | apache-2.0 | 213 | master | 4,248 | require 'action_controller'
require 'action_dispatch'
require 'apivore/rails_shim'
module Apivore
class Validator
include ::ActionDispatch::Integration::Runner
attr_reader :method, :path, :expected_response_code, :params
def initialize(method, path, expected_response_code, params = {})
@method = ... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore/swagger_checker.rb | Ruby | apache-2.0 | 213 | master | 2,699 | module Apivore
class SwaggerChecker
PATH_TO_CHECKER_MAP = {}
def self.instance_for(path)
PATH_TO_CHECKER_MAP[path] ||= new(path)
end
def has_path?(path)
mappings.has_key?(path)
end
def has_method_at_path?(path, method)
mappings[path].has_key?(method)
end
def has_r... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore/custom_schema_validator.rb | Ruby | apache-2.0 | 213 | master | 593 | module Apivore
class CustomSchemaValidator
# This constant is an example custom schema included with the gem
WF_SCHEMA = File.expand_path("../../data/custom_schemata/westfield_api_standards.json", File.dirname(__FILE__))
def initialize(custom_schema)
@schema = custom_schema
end
def matches... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore/swagger.rb | Ruby | apache-2.0 | 213 | master | 1,429 | require 'hashie'
require 'apivore/fragment'
module Apivore
class Swagger < Hashie::Mash
NONVERB_PATH_ITEMS = %q(parameters)
def validate
case version
when '2.0'
schema = File.read(File.expand_path("../../../data/swagger_2.0_schema.json", __FILE__))
else
raise "Unknown/unsu... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore/all_routes_tested_validator.rb | Ruby | apache-2.0 | 213 | master | 526 | module Apivore
class AllRoutesTestedValidator
def matches?(swagger_checker)
@errors = []
swagger_checker.untested_mappings.each do |path, methods|
methods.each do |method, codes|
codes.each do |code, _|
@errors << "#{method} #{path} is untested for response code #{code}"... |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore/fragment.rb | Ruby | apache-2.0 | 213 | master | 301 | module Apivore
# This is a workaround for json-schema's fragment validation which does not allow paths to contain forward slashes
# current json-schema attempts to split('/') on a string path to produce an array.
class Fragment < Array
def split(options = nil)
self
end
end
end |
github | westfieldlabs/apivore | https://github.com/westfieldlabs/apivore | lib/apivore/rails_shim.rb | Ruby | apache-2.0 | 213 | master | 302 | module Apivore
class RailsShim
class << self
def action_dispatch_request_args(path, params: {}, headers: {})
if ActionPack::VERSION::MAJOR >= 5
[path, params: params, headers: headers]
else
[path, params, headers]
end
end
end
end
end |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | rakefile | Ruby | mit | 213 | master | 1,396 | require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "is_taggable"
s.summary = %Q{tagging that doesn't want to be on steroids. it's skinny and happy to stay that way.}
s.email = "chebuctonian@mgmail.com"
s.homepage = "http://github.com/giraffesoft/is_taggable"
s.authors = [... |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | is_taggable.gemspec | Ruby | mit | 213 | master | 1,320 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{is_taggable}
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Daniel Haran", "James Golick", "GiraffeSoft Inc."]
s.date = %q{2009-02-16}
s.email = %q... |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | test/test_helper.rb | Ruby | mit | 213 | master | 909 | require 'rubygems'
require 'activerecord'
require File.dirname(__FILE__)+'/../lib/is_taggable'
require 'expectations'
require 'logger'
ActiveRecord::Base.configurations = {'sqlite3' => {:adapter => 'sqlite3', :database => ':memory:'}}
ActiveRecord::Base.establish_connection('sqlite3')
ActiveRecord::Base.logger = Logg... |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | test/is_taggable_test.rb | Ruby | mit | 213 | master | 1,900 | require File.dirname(__FILE__) + '/test_helper'
Expectations do
expect Tag do
Post.new.tags.build
end
expect Tagging do
Post.new.taggings.build
end
expect ["is_taggable", "has 'tags' by default"] do
n = Comment.new :tag_list => "is_taggable, has 'tags' by default"
n.tag_list
end
ex... |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | test/tag_test.rb | Ruby | mit | 213 | master | 907 | require File.dirname(__FILE__) + '/test_helper'
Expectations do
expect Tagging do
Tag.new.taggings.proxy_reflection.klass
end
expect Tag.new(:name => "duplicate").not.to.be.valid? do
Tag.create!(:name => "duplicate")
end
expect Tag.new(:name => "not dup").to.be.valid? do
Tag.create!(:name => "n... |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | test/tagging_test.rb | Ruby | mit | 213 | master | 792 | require File.dirname(__FILE__) + '/test_helper'
Expectations do
expect Tag do
t = Tagging.new :tag => Tag.new(:name => 'some_tag')
t.tag
end
expect Post do
t = Tagging.new :taggable => Post.new
t.taggable
end
expect 2 do
2.times { Post.create(:tag_list => "interesting") }
Tag.fi... |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | lib/is_taggable.rb | Ruby | mit | 213 | master | 2,530 | path = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH << path unless $LOAD_PATH.include?(path)
require 'tag'
require 'tagging'
module IsTaggable
class TagList < Array
cattr_accessor :delimiter
@@delimiter = ','
def initialize(list)
list = list.is_a?(Array) ? list : list.split(@@delimiter)... |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | lib/tag.rb | Ruby | mit | 213 | master | 557 | class Tag < ActiveRecord::Base
class << self
def find_or_initialize_with_name_like_and_kind(name, kind)
with_name_like_and_kind(name, kind).first || new(:name => name, :kind => kind)
end
end
has_many :taggings, :dependent => :destroy
validates_presence_of :name
validates_uniqueness_of :name, :... |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | generators/is_taggable_migration/is_taggable_migration_generator.rb | Ruby | mit | 213 | master | 219 | class IsTaggableMigrationGenerator < Rails::Generator::Base
def manifest
record do |m|
m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => 'is_taggable_migration'
end
end
end |
github | jamesgolick/is_taggable | https://github.com/jamesgolick/is_taggable | generators/is_taggable_migration/templates/migration.rb | Ruby | mit | 213 | master | 538 | class IsTaggableMigration < ActiveRecord::Migration
def self.up
create_table :tags do |t|
t.string :name, :default => ''
t.string :kind, :default => ''
end
create_table :taggings do |t|
t.integer :tag_id
t.string :taggable_type, :default => ''
t.integer :taggable_id
e... |
github | AlexJWayne/rails-settings | https://github.com/AlexJWayne/rails-settings | rails-settings.gemspec | Ruby | mit | 212 | master | 2,029 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{rails-settings}
s.version = "1.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :req... |
github | AlexJWayne/rails-settings | https://github.com/AlexJWayne/rails-settings | Rakefile | Ruby | mit | 212 | master | 1,567 | require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rubygems'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the fleximage plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the rai... |
github | AlexJWayne/rails-settings | https://github.com/AlexJWayne/rails-settings | generators/settings_migration/settings_migration_generator.rb | Ruby | mit | 212 | master | 304 | class SettingsMigrationGenerator < Rails::Generator::NamedBase
def initialize(runtime_args, runtime_options = {})
runtime_args << 'add_settings_table' if runtime_args.empty?
super
end
def manifest
record do |m|
m.migration_template 'migration.rb', 'db/migrate'
end
end
end |
github | AlexJWayne/rails-settings | https://github.com/AlexJWayne/rails-settings | generators/settings_migration/templates/migration.rb | Ruby | mit | 212 | master | 322 | class <%= class_name %> < ActiveRecord::Migration
def self.up
create_table :settings, :force => true do |t|
t.string :var, :null => false
t.text :value, :null => true
t.timestamps
end
add_index :settings, :var, :uniq => true
end
def self.down
drop_table :settings
end
en... |
github | AlexJWayne/rails-settings | https://github.com/AlexJWayne/rails-settings | test/settings_test.rb | Ruby | mit | 212 | master | 1,696 | #!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../../../test/test_helper'
class SettingsTest < Test::Unit::TestCase
def setup
Settings.create(:var => 'test', :value => 'foo')
Settings.create(:var => 'test2', :value => 'bar')
end
def test_defaults
Settings.defaults[:foo] = 'default foo'
... |
github | AlexJWayne/rails-settings | https://github.com/AlexJWayne/rails-settings | lib/settings.rb | Ruby | mit | 212 | master | 2,120 | class Settings < ActiveRecord::Base
class SettingNotFound < RuntimeError; end
cattr_accessor :defaults
@@defaults = {}.with_indifferent_access
# Support old plugin
if defined?(SettingsDefaults::DEFAULTS)
@@defaults = SettingsDefaults::DEFAULTS.with_indifferent_access
end
#get or set a variabl... |
github | wycats/artifice | https://github.com/wycats/artifice | artifice.gemspec | Ruby | mit | 212 | master | 686 | Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'artifice'
s.version = '0.6'
s.summary = 'Use a Rack application for mock HTTP requests'
s.description = 'Replaces Net::HTTP with a subclass that routes all requests to a Rack application'
s.required_ruby_version = '>=... |
github | wycats/artifice | https://github.com/wycats/artifice | spec/artifice_spec.rb | Ruby | mit | 212 | master | 5,046 | require "net/http"
shared_examples_for "a working request" do
it "gets response headers" do
@response["Content-Type"].should == "text/html"
end
it "sends the host properly" do
@response["X-Test-Host"].should == "google.com"
end
end
shared_examples_for "a working GET request" do
it_should_behave_li... |
github | wycats/artifice | https://github.com/wycats/artifice | lib/artifice.rb | Ruby | mit | 212 | master | 3,957 | require "rack/test"
require "net/http"
require "net/https"
module Artifice
NET_HTTP = ::Net::HTTP
# Activate Artifice with a particular Rack endpoint.
#
# Calling this method will replace the Net::HTTP system
# with a replacement that routes all requests to the
# Rack endpoint.
#
# @param [#call] endp... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | Berksfile | Ruby | apache-2.0 | 212 | v5.x | 221 | # frozen_string_literal: true
source 'https://supermarket.chef.io'
metadata
group :integration do
cookbook 'apt'
cookbook 'minitest-handler'
cookbook 'rabbitmq_test', :path => './test/cookbooks/rabbitmq_test'
end |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | Rakefile | Ruby | apache-2.0 | 212 | v5.x | 1,208 | #!/usr/bin/env rake
# frozen_string_literal: true
# Style tests. cookstyle (rubocop) and Foodcritic
namespace :style do
begin
require 'cookstyle'
require 'rubocop/rake_task'
desc 'Run Ruby style checks'
RuboCop::RakeTask.new(:ruby)
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | metadata.rb | Ruby | apache-2.0 | 212 | v5.x | 737 | # frozen_string_literal: true
name 'rabbitmq'
maintainer 'VMware, Inc. and contributors'
maintainer_email 'klishinm@vmware.com'
license 'Apache-2.0'
description 'Installs and configures RabbitMQ server'
version '5.10.0'
issues_url 'https://github.com/rabbitmq/chef-cookbook/issues'
source_url 'https://github.com/rabbit... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | Gemfile | Ruby | apache-2.0 | 212 | v5.x | 1,234 | # frozen_string_literal: true
source 'https://rubygems.org'
gem 'chef'
gem 'berkshelf'
gem 'github_changelog_generator'
gem 'nokogiri', ">= 1.13.4"
# Pinned to the highest version compatible with chef-cli's `< 2.9` constraint.
# Contains the partial fix for CVE-2026-35611 (ReDoS in URI templates).
# Drop this pin once... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | Guardfile | Ruby | apache-2.0 | 212 | v5.x | 821 | # A sample Guardfile
# More info at https://github.com/guard/guard#readme
# guard 'kitchen' do
# watch(%r{test/.+})
# watch(%r{^recipes/(.+)\.rb$})
# watch(%r{^attributes/(.+)\.rb$})
# watch(%r{^files/(.+)})
# watch(%r{^templates/(.+)})
# watch(%r{^providers/(.+)\.rb})
# watch(%r{^resources/(.+)\.rb})
# ... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | test/erlang_package/latest_rpm/default_spec.rb | Ruby | apache-2.0 | 212 | v5.x | 766 | # The Inspec reference, with examples and extensive documentation, can be
# found at https://inspec.io/docs/reference/resources/
describe package('erlang') do
it { should be_installed }
end
describe package('rabbitmq-server') do
it { should be_installed }
end
describe service('rabbitmq-server') do
it { should ... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | test/erlang_package/latest_deb/default_spec.rb | Ruby | apache-2.0 | 212 | v5.x | 1,066 | # The Inspec reference, with examples and extensive documentation, can be
# found at https://inspec.io/docs/reference/resources/
%w(
erlang-asn1 erlang-crypto erlang-public-key erlang-ssl erlang-syntax-tools
erlang-mnesia erlang-runtime-tools erlang-snmp erlang-os-mon erlang-parsetools
erlang-inets erlang-tools ... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | test/erlang_package/pinned_deb/default_spec.rb | Ruby | apache-2.0 | 212 | v5.x | 1,115 | # The Inspec reference, with examples and extensive documentation, can be
# found at https://inspec.io/docs/reference/resources/
%w(
erlang-asn1 erlang-crypto erlang-public-key erlang-ssl erlang-syntax-tools
erlang-mnesia erlang-runtime-tools erlang-snmp erlang-os-mon erlang-parsetools
erlang-inets erlang-tools ... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | test/erlang_package/pinned_rpm/default_spec.rb | Ruby | apache-2.0 | 212 | v5.x | 812 | # The Inspec reference, with examples and extensive documentation, can be
# found at https://inspec.io/docs/reference/resources/
describe package('erlang') do
it { should be_installed }
its('version') { should match(/^(22|23)/) }
end
describe package('rabbitmq-server') do
it { should be_installed }
end
describ... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | test/cookbooks/rabbitmq_test/metadata.rb | Ruby | apache-2.0 | 212 | v5.x | 271 | # frozen_string_literal: true
name 'rabbitmq_test'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'This cookbook is used with test-kitchen to test the parent, rabbitmq cookbook.'
version '1.0.0'
depends 'rabbitmq' |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | test/cookbooks/rabbitmq_test/recipes/cook-2151-3489.rb | Ruby | apache-2.0 | 212 | v5.x | 432 | # frozen_string_literal: true
#
# Cookbook Name:: rabbitmq_test
# Recipe:: cook-2151-3489
#
# This recipe exists to ensure that minitest tests are run.
include_recipe 'rabbitmq::default'
# HACK: Give rabbit time to spin up before the tests, it seems
# to be responding that it has started before it really has
execute ... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | test/cookbooks/rabbitmq_test/recipes/cook-openfiles.rb | Ruby | apache-2.0 | 212 | v5.x | 973 | # frozen_string_literal: true
#
# Cookbook Name:: rabbitmq_test
# Recipe:: cook-openfiles
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | test/cookbooks/rabbitmq_test/recipes/cluster.rb | Ruby | apache-2.0 | 212 | v5.x | 880 | # frozen_string_literal: true
#
# Cookbook Name:: rabbitmq_test
# Recipe:: cluster
#
# Copyright 2012, Chef Software, Inc. <legal@chef.io>
# Copyright 2019-2021, VMware, Inc or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
github | rabbitmq/chef-cookbook | https://github.com/rabbitmq/chef-cookbook | test/cookbooks/rabbitmq_test/recipes/mgmt_console.rb | Ruby | apache-2.0 | 212 | v5.x | 1,037 | # frozen_string_literal: true
#
# Cookbook Name:: rabbitmq_test
# Recipe:: mgmt_console
#
# Copyright 2012-2013, Chef Software, Inc. <legal@chef.io>
# Copyright 2019-2021, VMware, Inc or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.