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 | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/gap_service_spec.rb | Ruby | mit | 92 | main | 22,154 | require "rails_helper"
RSpec.describe GapService do
subject(:service) { described_class.new(show, update_previous:) }
let(:update_previous) { false }
let!(:venue) { create(:venue) }
let!(:tour) { create(:tour) }
let!(:song1) { create(:song, title: "Tweezer") }
let!(:song2) { create(:song, title: "Fluffhea... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/meta_tag_service_spec.rb | Ruby | mit | 92 | main | 6,202 | require "rails_helper"
RSpec.describe MetaTagService do
subject(:service) { described_class.call(path) }
let(:title_suffix) { " - #{App.app_name}" }
context "when the path is root" do
let(:path) { "/" }
it "returns the base title" do
expect(service[:title]).to eq(App.app_name)
expect(servi... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/id3_tag_service_spec.rb | Ruby | mit | 92 | main | 1,634 | require "rails_helper"
require "mp3info"
RSpec.describe Id3TagService do
subject(:service) { described_class.new(track) }
let(:show) { create(:show, date: "#{year}-10-31") }
let(:track) { create(:track, position:, title:, show:) }
let(:year) { 1995 }
let(:position) { 2 }
let(:title) { "Bathtub Gin" }
le... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/show.rb | Ruby | mit | 92 | main | 455 | FactoryBot.define do
factory :show do
sequence(:date) { |n| Date.new(1985, 1, 1) + n.days }
taper_notes { Faker::Lorem.paragraph }
audio_status { 'complete' }
tour
venue
trait :with_tracks do
after(:build) do |show|
create_list(:track, 3, show:)
end
end
trait :wi... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/announcement.rb | Ruby | mit | 92 | main | 200 | FactoryBot.define do
factory :announcement do
title { "New show: #{Faker::Date}" }
description { "New content added: #{Faker::Date}" }
url { "#{App.base_url}/#{Faker::Date}" }
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/playlist.rb | Ruby | mit | 92 | main | 469 | FactoryBot.define do
factory :playlist do
sequence(:name) { |n| "Playlist #{n}" }
slug { name.downcase.gsub(/[^a-z0-9]/, '-') }
published { true }
description { Faker::Lorem.paragraph_by_chars(number: 500, supplemental: false) }
user
transient do
tracks_count { 2 }
end
before(... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/venue.rb | Ruby | mit | 92 | main | 379 | FactoryBot.define do
factory :venue do
sequence(:name) { |n| "Venue #{n}" }
city { Faker::Address.city }
state { Faker::Address.state }
country { 'USA' }
latitude { Faker::Address.latitude }
longitude { Faker::Address.longitude }
trait :with_shows do
after(:build) do |venue|
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/venue_rename.rb | Ruby | mit | 92 | main | 205 | FactoryBot.define do
factory :venue_rename do
sequence(:name) { |n| "Venue Rename #{n}" }
renamed_on { Faker::Date.unique.between(from: 500.years.ago, to: Time.zone.today) }
venue
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/tour.rb | Ruby | mit | 92 | main | 344 | FactoryBot.define do
factory :tour do
sequence(:name) { |n| "Tour #{n}" }
sequence(:starts_on) { |n| Date.new(1985, 1, 1) + (n * 30).days }
sequence(:ends_on) { |n| Date.new(1985, 1, 1) + (n * 30 + 10).days }
trait :with_shows do
after(:build) do |tour|
create_list(:show, 2, tour:)
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/tag.rb | Ruby | mit | 92 | main | 336 | FactoryBot.define do
factory :tag do
sequence(:name) { |n| "Tag #{n}" }
color { Faker::Color.hex_color }
description { Faker::Lorem.sentence }
sequence(:priority)
trait :with_tracks do
tracks { build_list(:track, 2) }
end
trait :with_shows do
shows { build_list(:show, 2) }
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/user.rb | Ruby | mit | 92 | main | 289 | FactoryBot.define do
factory :user do
sequence(:username) { |n| "user_#{n}" }
sequence(:email) { |n| "email-#{n}@example.com" }
password { 'password' }
password_confirmation { 'password' }
trait :with_likes do
likes { create_list(:like, 3) }
end
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/song.rb | Ruby | mit | 92 | main | 252 | FactoryBot.define do
factory :song do
sequence(:title) { |n| "Song #{n}" }
lyrics { Faker::Lorem.paragraph }
trait :with_tracks do
after(:build) do |song|
create_list(:track, 2, songs: [ song ])
end
end
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/factories/track.rb | Ruby | mit | 92 | main | 397 | FactoryBot.define do
factory :track do
sequence(:title) { |n| "Track #{n}" }
songs { [ build(:song) ] }
set { "1" }
sequence(:position, 1)
duration { 150_000 } # 2m 30s
exclude_from_stats { false }
audio_status { 'complete' }
show
trait :with_likes do
after(:build) do |trac... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/user_spec.rb | Ruby | mit | 92 | main | 211 | require 'rails_helper'
describe User do
subject { build(:user) }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to have_many(:playlists) }
it { is_expected.to have_many(:likes) }
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/application_record_spec.rb | Ruby | mit | 92 | main | 213 | require 'rails_helper'
RSpec.describe ApplicationRecord do
subject(:record) { described_class.new }
let(:described_class) { User }
it 'exists' do
expect(record.class).to eq(described_class)
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/tag_spec.rb | Ruby | mit | 92 | main | 1,869 | require 'rails_helper'
RSpec.describe Tag do
subject(:tag) { create(:tag, name: 'Musical Tease') }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to have_many(:show_tags).dependent(:destroy) }
it { is_expected.to have_many(:shows).through(:show_tags) }
it { is_expected.to have_many(:track_... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/show_tag_spec.rb | Ruby | mit | 92 | main | 346 | require 'rails_helper'
RSpec.describe ShowTag do
subject { build(:show_tag) }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to belong_to(:show).counter_cache(:tags_count) }
it { is_expected.to belong_to(:tag).counter_cache(:shows_count) }
it { is_expected.to validate_uniqueness_of(:show)... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/playlist_spec.rb | Ruby | mit | 92 | main | 3,858 | require 'rails_helper'
RSpec.describe Playlist do
subject(:playlist) { build(:playlist) }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to have_many(:tracks) }
it { is_expected.to have_many(:playlist_tracks).dependent(:destroy) }
it { is_expected.to have_many(:likes).dependent(:destroy) }... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/tour_spec.rb | Ruby | mit | 92 | main | 1,707 | require 'rails_helper'
RSpec.describe Tour do
subject(:tour) { create(:tour, name: '1996 Summer Tour') }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to have_many(:shows).dependent(:nullify) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_uniqueness_of(:... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/like_spec.rb | Ruby | mit | 92 | main | 421 | require 'rails_helper'
RSpec.describe Like do
subject { build(:like) }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to belong_to(:likable) }
it { is_expected.to belong_to(:user) }
describe 'validations' do
subject { create(:like) } # Create an actual record in the database
it ... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/venue_spec.rb | Ruby | mit | 92 | main | 3,612 | require 'rails_helper'
RSpec.describe Venue do
subject(:venue) { create(:venue, name: 'Madison Square Garden') }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to have_many(:shows).dependent(:nullify) }
it { is_expected.to have_many(:venue_renames).dependent(:destroy) }
it { is_expected.t... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/song_spec.rb | Ruby | mit | 92 | main | 2,965 | require 'rails_helper'
RSpec.describe Song do
subject(:song) { create(:song, title: 'Bathtub Gin') }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to have_many(:songs_tracks).dependent(:destroy) }
it { is_expected.to have_many(:tracks).through(:songs_tracks) }
it { is_expected.to validat... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/playlist_track_spec.rb | Ruby | mit | 92 | main | 6,282 | require 'rails_helper'
RSpec.describe PlaylistTrack do
subject { build(:playlist_track) }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to belong_to(:playlist).counter_cache(:tracks_count) }
it { is_expected.to belong_to(:track) }
it { is_expected.to validate_numericality_of(:position).o... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/venue_rename_spec.rb | Ruby | mit | 92 | main | 297 | require 'rails_helper'
RSpec.describe VenueRename do
subject { build(:venue_rename) }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to belong_to(:venue) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:renamed_on) }
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/authentication_spec.rb | Ruby | mit | 92 | main | 206 | require "rails_helper"
RSpec.describe Authentication do
subject(:authentication) { build(:authentication) }
it { is_expected.to be_a(ApplicationRecord) }
it { is_expected.to belong_to(:user) }
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/api_key_spec.rb | Ruby | mit | 92 | main | 1,855 | require 'rails_helper'
RSpec.describe ApiKey do
subject(:api_key) { build(:api_key) }
it { is_expected.to be_an(ApplicationRecord) }
describe 'attributes' do
subject(:api_key) { described_class.attribute_names.map(&:to_sym) }
it { is_expected.to include :id }
it { is_expected.to include :name }
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/track_spec.rb | Ruby | mit | 92 | main | 7,405 | require 'rails_helper'
RSpec.describe Track do
subject(:track) { create(:track, title: 'Bathtub Gin') }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to have_many(:songs_tracks).dependent(:destroy) }
it { is_expected.to have_many(:songs).through(:songs_tracks) }
it { is_expected.to have_m... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/show_spec.rb | Ruby | mit | 92 | main | 7,517 | require 'rails_helper'
RSpec.describe Show do
subject(:show) { create(:show) }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to belong_to(:tour) }
it { is_expected.to belong_to(:venue) }
it { is_expected.to have_many(:tracks).dependent(:destroy) }
it { is_expected.to have_many(:likes).... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/songs_track_spec.rb | Ruby | mit | 92 | main | 706 | require 'rails_helper'
RSpec.describe SongsTrack do
subject { build(:songs_track) }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to belong_to(:song) }
it { is_expected.to belong_to(:track) }
it { is_expected.to validate_uniqueness_of(:song).scoped_to(:track_id) }
describe 'callbacks'... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/track_tag_spec.rb | Ruby | mit | 92 | main | 276 | require 'rails_helper'
RSpec.describe TrackTag do
subject { build(:track_tag) }
it { is_expected.to be_an(ApplicationRecord) }
it { is_expected.to belong_to(:track).counter_cache(:tags_count) }
it { is_expected.to belong_to(:tag).counter_cache(:tracks_count) }
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/models/concerns/sorcery_authenticable_spec.rb | Ruby | mit | 92 | main | 1,417 | require "rails_helper"
RSpec.describe SorceryAuthenticable do
subject(:user) { create(:user, email:, username: "harryhood") }
let(:email) { "email.1@example.com" }
it { is_expected.to have_many(:authentications).dependent(:destroy) }
it { is_expected.not_to allow_value("email@example.com").for(:username) }
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/mcp_controller_spec.rb | Ruby | mit | 92 | main | 29,777 | require "rails_helper"
RSpec.describe "MCP Controller" do
let(:headers) { { "Content-Type" => "application/json" } }
def json_rpc_request(rpc_method:, params: {}, id: 1)
{ jsonrpc: "2.0", method: rpc_method, params:, id: }.to_json
end
describe "POST /mcp" do
it "returns Mcp-Session-Id header" do
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/tags_controller_spec.rb | Ruby | mit | 92 | main | 860 | require 'rails_helper'
describe Api::V1::TagsController do
include Rack::Test::Methods
let(:json_data) { JSON[subject.body].deep_symbolize_keys[:data] }
describe 'index' do
subject { get('/api/v1/tags', {}, auth_header) }
let!(:tags) { create_list(:tag, 3) }
it 'responds with expected data' do
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/api_controller_spec.rb | Ruby | mit | 92 | main | 1,344 | require "rails_helper"
describe Api::V1::ApiController do
include Rack::Test::Methods
subject(:response) { get(path, params, headers) }
let(:headers) { auth_header }
let(:json) { JSON[response.body].deep_symbolize_keys }
let(:params) { {} }
let(:path) { "/api/v1/tags" }
context "with no authorization ... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/shows_controller_spec.rb | Ruby | mit | 92 | main | 3,142 | require 'rails_helper'
describe Api::V1::ShowsController do
include Rack::Test::Methods
let(:json_data) { JSON[subject.body].deep_symbolize_keys[:data] }
describe 'index' do
let!(:shows) { create_list(:show, 3, :with_tracks, :with_tags, :with_likes) }
context 'without params' do
subject { get('/... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/years_controller_spec.rb | Ruby | mit | 92 | main | 2,340 | require 'rails_helper'
describe Api::V1::YearsController do
include Rack::Test::Methods
let(:json) { JSON[subject.body].deep_symbolize_keys }
let(:json_data) { json[:data] }
describe 'index' do
before do
create(:show, date: '1986-01-01')
create(:show, date: '1987-01-01')
create(:show, d... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/tours_controller_spec.rb | Ruby | mit | 92 | main | 861 | require 'rails_helper'
describe Api::V1::ToursController do
include Rack::Test::Methods
let(:json_data) { JSON[subject.body].deep_symbolize_keys[:data] }
describe 'index' do
subject { get('/api/v1/tours', {}, auth_header) }
let!(:tours) { create_list(:tour, 3, :with_shows) }
it 'responds with exp... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/eras_controller_spec.rb | Ruby | mit | 92 | main | 745 | require 'rails_helper'
describe Api::V1::ErasController do
include Rack::Test::Methods
let(:json_data) { JSON[subject.body].symbolize_keys[:data] }
describe 'index' do
subject { get('/api/v1/eras', {}, auth_header) }
it 'responds with expected data' do
expect(json_data).to eq(ERAS)
end
end... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/tracks_controller_spec.rb | Ruby | mit | 92 | main | 1,723 | require 'rails_helper'
describe Api::V1::TracksController do
include Rack::Test::Methods
let(:json) { JSON[subject.body].deep_symbolize_keys }
let(:json_data) { json[:data] }
describe 'index' do
let!(:tracks) { create_list(:track, 3, :with_likes) }
before do
tracks.each { |t| t.tags = create_l... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/search_controller_spec.rb | Ruby | mit | 92 | main | 1,208 | require 'rails_helper'
describe Api::V1::SearchController do
include Rack::Test::Methods
let(:json) { JSON[response.body].deep_symbolize_keys }
describe 'show' do
subject(:response) { get("/api/v1/search/#{term}", {}, auth_header) }
context 'with invalid term' do
let(:term) { 'a' }
it 're... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/venues_controller_spec.rb | Ruby | mit | 92 | main | 1,128 | require 'rails_helper'
describe Api::V1::VenuesController do
include Rack::Test::Methods
let(:json) { JSON[subject.body].deep_symbolize_keys }
let(:json_data) { json[:data] }
describe 'index' do
subject { get('/api/v1/venues', {}, auth_header) }
let!(:venues) { create_list(:venue, 3, :with_shows) }
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/songs_controller_spec.rb | Ruby | mit | 92 | main | 1,109 | require 'rails_helper'
describe Api::V1::SongsController do
include Rack::Test::Methods
let(:json) { JSON[subject.body].deep_symbolize_keys }
let(:json_data) { json[:data] }
describe 'index' do
subject { get('/api/v1/songs', {}, auth_header) }
let!(:songs) { create_list(:song, 3, :with_tracks) }
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v1/playlists_controller_spec.rb | Ruby | mit | 92 | main | 641 | require 'rails_helper'
describe Api::V1::PlaylistsController do
include Rack::Test::Methods
let(:json_data) { JSON[subject.body].deep_symbolize_keys[:data] }
describe 'show' do
context 'with valid id param' do
subject { get("/api/v1/playlists/#{playlist.slug}", {}, auth_header) }
let(:playlist... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/reports_spec.rb | Ruby | mit | 92 | main | 2,298 | require "rails_helper"
RSpec.describe "API v2 Reports" do
let!(:venue1) { create(:venue, name: "Madison Square Garden", city: "New York", state: "NY") }
let!(:venue2) { create(:venue, name: "The Roxy", city: "Atlanta", state: "GA") }
let!(:show3) { create(:show, date: "2023-06-10", audio_status: 'partial', venue... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/shows_spec.rb | Ruby | mit | 92 | main | 11,519 | require "rails_helper"
RSpec.describe "API v2 Shows" do
let!(:user) { create(:user) }
let!(:venue) { create(:venue, name: "Madison Square Garden") }
let!(:previous_show) { create(:show, date: "2022-12-30", venue:, likes_count: 0) }
let!(:next_show) { create(:show, date: "2023-01-05", venue:, likes_count: 25) }... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/songs_spec.rb | Ruby | mit | 92 | main | 3,034 | require "rails_helper"
RSpec.describe "API v2 Songs" do
let!(:songs) do
[
create(
:song,
title: "You Enjoy Myself",
slug: "you-enjoy-myself",
original: true,
tracks_count: 200
),
create(
:song,
title: "Tweezer",
slug: "tweezer",
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/tracks_spec.rb | Ruby | mit | 92 | main | 9,747 | require "rails_helper"
RSpec.describe "API v2 Tracks" do
let!(:user) { create(:user) }
let!(:tag) { create(:tag, name: "Classic", priority: 1) }
let!(:show1) { create(:show, date: "2023-01-01") }
let!(:show2) { create(:show, date: "2024-01-01") }
let!(:show3) { create(:show, date: "2025-01-01") }
let!(:son... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/tags_spec.rb | Ruby | mit | 92 | main | 499 | require "rails_helper"
RSpec.describe "API Tags" do
let(:tags) do
[
create(:tag, name: "Classic", slug: "classic"),
create(:tag, name: "Jam", slug: "jam")
]
end
describe "GET /api/v2/tags" do
it "returns a list of all tags" do
tags
get_api "/tags"
expect(response).to ... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/playlists_spec.rb | Ruby | mit | 92 | main | 7,359 | require "rails_helper"
RSpec.describe "API v2 Playlists" do
include ApiHelper
let!(:user) { create(:user) }
let!(:playlist) do
create(
:playlist,
slug: "summer-jams",
name: "Summer Jams",
description: "The best summer jams",
user:,
tracks_count: 2
)
end
let!(:trac... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/venues_spec.rb | Ruby | mit | 92 | main | 4,087 | require "rails_helper"
RSpec.describe "API v2 Venues" do
let!(:venues) do
[
create(
:venue,
name: "Madison Square Garden",
city: "New York",
state: "NY",
country: "USA",
latitude: 40.7505045,
longitude: -73.9934387,
slug: "madison-square-garde... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/years_spec.rb | Ruby | mit | 92 | main | 1,239 | require "rails_helper"
RSpec.describe "API v2 Years" do
describe "GET /years" do
let(:venue1) { create(:venue) }
let(:venue2) { create(:venue) }
let!(:show1) { create(:show, date: "1987-05-01", venue: venue1) }
let!(:show2) { create(:show, date: "1986-07-15", venue: venue1) }
let!(:show3) { create(... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/auth_spec.rb | Ruby | mit | 92 | main | 7,806 | require "rails_helper"
RSpec.describe "API v2 Auth" do
let!(:user) { create(:user, password: "password") }
describe "POST /auth/create_user" do
context "with valid parameters" do
it "creates a new user, returns a JWT, and user information" do
post_api "/auth/create_user", params: {
use... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/search_spec.rb | Ruby | mit | 92 | main | 2,348 | require "rails_helper"
RSpec.describe "API v2 Search" do
include ApiHelper
let!(:user) { create(:user) }
let!(:venue) do
create(
:venue,
name: "Madison Square Garden",
city: "New York",
state: "NY",
country: "USA",
slug: "madison-square-garden"
)
end
let!(:show) {... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/likes_spec.rb | Ruby | mit | 92 | main | 3,858 | require "rails_helper"
RSpec.describe "API v2 Likes" do
let!(:user) { create(:user) }
let!(:show) { create(:show) }
let!(:track) { create(:track) }
describe "POST /likes" do
context "when liking a show" do
it "creates a like for the show" do
expect {
post_api_authed(
us... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/announcements_spec.rb | Ruby | mit | 92 | main | 658 | require "rails_helper"
RSpec.describe "API v2 Announcements" do
let(:announcements) do
105.times.map do |i|
create(:announcement, title: "Announcement #{i}", created_at: i.days.ago)
end
end
describe "GET /api/v2/announcements" do
it "returns the last 100 announcements ordered by created_at des... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/api/v2/tours_spec.rb | Ruby | mit | 92 | main | 3,417 | require "rails_helper"
RSpec.describe "API v2 Tours" do
let!(:tour1) do
create(
:tour,
name: "Summer Tour 2022",
starts_on: "2022-06-01",
ends_on: "2022-08-01",
shows_count: 10,
slug: "summer-tour-2022"
)
end
let!(:tour2) do
create(
:tour,
name: "Winte... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/requests/oauth/sorcery_controller_spec.rb | Ruby | mit | 92 | main | 448 | require "rails_helper"
RSpec.describe "Oauth::SorceryController" do
describe "GET /oauth/:provider" do
it "returns 404 for unknown provider" do
get "/oauth/unknown"
expect(response).to have_http_status(:not_found)
end
end
describe "GET /oauth/callback/:provider" do
it "returns 404 for un... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/support/feature_helpers.rb | Ruby | mit | 92 | main | 992 | module FeatureHelpers
def sign_in(user)
visit "/login"
fill_in "email", with: user.email
fill_in "password", with: "password"
click_on "Login"
# Wait for successful login by checking that we've navigated away from /login
# and that the page no longer has the login form
expect(page).to hav... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/support/shared_examples.rb | Ruby | mit | 92 | main | 303 | RSpec.shared_examples 'responds with 404' do
let(:json) { JSON[subject.body].deep_symbolize_keys }
it 'returns 404' do
expect(subject.status).to eq(404)
end
it 'responds with error message' do
expect(json).to eq(
success: false,
message: 'Record not found'
)
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/support/capybara.rb | Ruby | mit | 92 | main | 2,401 | require 'capybara/rails'
require 'capybara/rspec'
require 'capybara-screenshot/rspec'
require 'selenium/webdriver'
Capybara.configure do |config|
config.default_max_wait_time = 5
config.default_driver = :rack_test
config.javascript_driver = :chrome
config.server = :puma, { Silent: true }
config.raise_server_... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/support/sidekiq.rb | Ruby | mit | 92 | main | 290 | require "sidekiq/testing"
Sidekiq::Testing.fake!
RSpec.configure do |config|
config.before do
Sidekiq::Worker.clear_all
end
config.before(:all, :enable_sidekiq) do
Sidekiq::Testing.inline!
end
config.after(:all, :enable_sidekiq) do
Sidekiq::Testing.fake!
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/support/api_helper.rb | Ruby | mit | 92 | main | 843 | module ApiHelper
def auth_header
api_key = create(:api_key)
{ "Authorization" => "Bearer #{api_key.key}" }
end
def user_auth_header(user)
token = JWT.encode(
{
sub: user.id,
exp: (Time.now + 1.year).to_i
},
Rails.application.secret_key_base,
"HS256"
)
{... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/schema.rb | Ruby | mit | 92 | main | 15,501 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20130223222601_add_counter_caches_to_venues_and_tours.rb | Ruby | mit | 92 | main | 205 | class AddCounterCachesToVenuesAndTours < ActiveRecord::Migration
def change
add_column :venues, :shows_count, :integer, default: 0
add_column :tours, :shows_count, :integer, default: 0
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20250719062931_rename_exclude_from_performance_gaps_to_exclude_from_stats.rb | Ruby | mit | 92 | main | 622 | class RenameExcludeFromPerformanceGapsToExcludeFromStats < ActiveRecord::Migration[8.0]
def change
rename_column :tracks, :exclude_from_performance_gaps, :exclude_from_stats
remove_index :tracks, name: "index_tracks_on_set_exclude_show_position"
remove_index :tracks, name: "index_tracks_on_show_set_exclu... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20130416030421_create_playlists.rb | Ruby | mit | 92 | main | 558 | class CreatePlaylists < ActiveRecord::Migration
def change
create_table :playlists do |t|
t.integer :user_id
t.string :name
t.string :slug
t.timestamps
end
create_table :playlist_tracks do |t|
t.integer :playlist_id
t.integer :track_id
t.integer :position
end
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20121202033002_create_albums.rb | Ruby | mit | 92 | main | 336 | class CreateAlbums < ActiveRecord::Migration
def change
create_table :albums do |t|
t.string :name
t.string :md5
t.boolean :is_custom_playlist, default: :false
t.datetime :completed_at
t.timestamps
end
add_attachment :albums, :zip_file
add_index :albums,... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20181214080858_venue_rename.rb | Ruby | mit | 92 | main | 418 | class VenueRename < ActiveRecord::Migration[5.2]
def change
create_table :venue_renames do |t|
t.integer :venue_id
t.string :name, null: false
t.date :renamed_on, null: false
end
add_index :venue_renames, :venue_id
add_index :venue_renames, %i[name renamed_on], unique: true
rem... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20240918023447_add_gap_cols_to_songs_tracks.rb | Ruby | mit | 92 | main | 447 | class AddGapColsToSongsTracks < ActiveRecord::Migration[7.2]
def change
add_column :songs_tracks, :previous_performance_gap, :integer
add_column :songs_tracks, :previous_performance_slug, :string
add_column :songs_tracks, :next_performance_gap, :integer
add_column :songs_tracks, :next_performance_slug... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20190616113121_create_known_dates.rb | Ruby | mit | 92 | main | 298 | class CreateKnownDates < ActiveRecord::Migration[5.2]
def change
create_table :known_dates do |t|
t.date :date, null: false
t.string :phishnet_url
t.string :location
t.string :venue
t.timestamps
end
add_index :known_dates, :date, unique: true
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20210413081017_remove_paperclip_columns.rb | Ruby | mit | 92 | main | 283 | class RemovePaperclipColumns < ActiveRecord::Migration[6.1]
def change
remove_column :tracks, :audio_file_file_name
remove_column :tracks, :audio_file_content_type
remove_column :tracks, :audio_file_file_size
remove_column :tracks, :audio_file_updated_at
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20250715021560_add_audio_status_to_shows_and_tracks.rb | Ruby | mit | 92 | main | 326 | class AddAudioStatusToShowsAndTracks < ActiveRecord::Migration[8.0]
def change
add_column :shows, :audio_status, :string, null: false, default: 'complete'
add_column :tracks, :audio_status, :string, null: false, default: 'complete'
add_index :shows, :audio_status
add_index :tracks, :audio_status
en... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20240926015231_add_tracks_count_and_description_to_playlists.rb | Ruby | mit | 92 | main | 505 | class AddTracksCountAndDescriptionToPlaylists < ActiveRecord::Migration[7.0]
def change
add_column :playlists, :tracks_count, :integer, default: 0
add_column :playlists, :description, :text
add_index :playlists, :tracks_count
add_index :playlists, :likes_count
add_index :playlists, :updated_at
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20250715021580_add_shows_with_audio_count_to_venues_and_tours.rb | Ruby | mit | 92 | main | 1,107 | class AddShowsWithAudioCountToVenuesAndTours < ActiveRecord::Migration[8.0]
def up
add_column :venues, :shows_with_audio_count, :integer, default: 0
add_column :tours, :shows_with_audio_count, :integer, default: 0
add_index :venues, :shows_with_audio_count
add_index :tours, :shows_with_audio_count
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20130323013212_add_geocoding_to_venues.rb | Ruby | mit | 92 | main | 227 | class AddGeocodingToVenues < ActiveRecord::Migration
def change
add_column :venues, :latitude, :float
add_column :venues, :longitude, :float
add_column :venues, :vague_location, :boolean, default: false
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20181027220035_add_notes_to_tag_intersections.rb | Ruby | mit | 92 | main | 238 | class AddNotesToTagIntersections < ActiveRecord::Migration[5.2]
def change
add_column :show_tags, :notes, :text
add_column :track_tags, :notes, :text
add_index :show_tags, :notes
add_index :track_tags, :notes
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20210509161243_add_waveform_data_to_tracks.rb | Ruby | mit | 92 | main | 213 | # frozen_string_literal
class AddWaveformDataToTracks < ActiveRecord::Migration[6.1]
def change
add_column :tracks, :waveform_data, :json
add_column :tracks, :waveform_max, :float, index: true
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20221224070950_create_announcements.rb | Ruby | mit | 92 | main | 260 | class CreateAnnouncements < ActiveRecord::Migration[7.0]
def change
create_table :announcements do |t|
t.string :title
t.string :description
t.string :url
t.timestamps
end
add_index :announcements, :created_at
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20130225005015_devise_create_users.rb | Ruby | mit | 92 | main | 1,447 | 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.... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20130302031026_create_likes.rb | Ruby | mit | 92 | main | 524 | class CreateLikes < ActiveRecord::Migration
def change
create_table :likes do |t|
t.string :likable_type
t.integer :likable_id
t.integer :user_id
t.datetime :created_at
end
add_column :tracks, :likes_count, :integer, default: 0
add_column :shows, :likes_count, ... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20120816184654_create_shows.rb | Ruby | mit | 92 | main | 279 | class CreateShows < ActiveRecord::Migration
def change
create_table :shows do |t|
t.date :date
t.string :location
t.boolean :remastered, default: false
t.boolean :sbd, default: false
t.timestamps
end
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20190803193249_add_alias_to_songs.rb | Ruby | mit | 92 | main | 484 | class AddAliasToSongs < ActiveRecord::Migration[5.2]
def up
add_column :songs, :alias, :string
add_index :songs, :alias, unique: true
# Convert all alias_for records to alias strings on their target records
Song.where('alias_for IS NOT NULL').find_each do |alias_song|
target_song = Song.find(al... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20181217073256_add_unique_indexes_to_tours.rb | Ruby | mit | 92 | main | 331 | class AddUniqueIndexesToTours < ActiveRecord::Migration[5.2]
def change
remove_index :tours, name: 'index_tours_on_name'
add_index :tours, :name, unique: true
remove_index :tours, name: 'index_tours_on_starts_on'
add_index :tours, :starts_on, unique: true
add_index :tours, :ends_on, unique: true... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20121107030749_create_venues.rb | Ruby | mit | 92 | main | 323 | class CreateVenues < ActiveRecord::Migration
def change
create_table :venues do |t|
t.string :name
t.string :past_names
t.string :city
t.string :state
t.string :country
t.string :slug
t.timestamps
end
add_index :venues, :name
end
e... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20130324014414_create_rails_admin_histories_table.rb | Ruby | mit | 92 | main | 507 | class CreateRailsAdminHistoriesTable < ActiveRecord::Migration
def self.up
create_table :rails_admin_histories do |t|
t.text :message # title, name, or object_id
t.string :username
t.integer :item
t.string :table
t.integer :month, limit: 2
t.integer :year, limit: 5
t.time... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20210503051354_add_lyrics_to_songs.rb | Ruby | mit | 92 | main | 231 | class AddLyricsToSongs < ActiveRecord::Migration[6.1]
def change
add_column :songs, :lyrics, :text
add_column :songs, :artist, :string
add_column :songs, :instrumental, :boolean, default: false, null: false
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20241004091430_post_v2_cleanup.rb | Ruby | mit | 92 | main | 263 | class PostV2Cleanup < ActiveRecord::Migration[7.2]
def change
drop_table :playlist_bookmarks
remove_column :songs, :lyrical_excerpt, :string
remove_column :songs, :instrumental, :boolean
remove_column :tracks, :waveform_max, :integer
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20240924225413_translate_playlist_bookmarks_to_likes.rb | Ruby | mit | 92 | main | 473 | class TranslatePlaylistBookmarksToLikes < ActiveRecord::Migration[7.2]
def change
reversible do |dir|
dir.up do
PlaylistBookmark.find_each do |pb|
likable = Playlist.find_by(id: pb.playlist_id)
next unless likable
Like.create!(likable:, user_id: pb.user_id)
# S... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20240816022858_sorcery_external.rb | Ruby | mit | 92 | main | 275 | class SorceryExternal < ActiveRecord::Migration[7.2]
def change
create_table :authentications do |t|
t.references :user
t.string :provider, :uid, null: false
t.timestamps null: false
end
add_index :authentications, %i[provider uid]
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20181214071912_set_required_columns_null_false.rb | Ruby | mit | 92 | main | 824 | class SetRequiredColumnsNullFalse < ActiveRecord::Migration[5.2]
def change
change_column_null :playlists, :name, false
change_column_null :playlists, :slug, false
change_column_null :shows, :date, false
change_column_null :tours, :name, false
change_column_null :tours, :starts_on, false
chang... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20121108010949_create_tours.rb | Ruby | mit | 92 | main | 299 | class CreateTours < ActiveRecord::Migration
def change
create_table :tours do |t|
t.string :name
t.date :starts_on
t.date :ends_on
t.string :slug
t.timestamps
end
add_index :tours, :name
add_index :tours, :starts_on
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20210413024707_remove_activestorage_tables.rb | Ruby | mit | 92 | main | 213 | class RemoveActivestorageTables < ActiveRecord::Migration[6.1]
def change
drop_table :active_storage_variant_records
drop_table :active_storage_attachments
drop_table :active_storage_blobs
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20250715021600_add_audio_gap_fields_to_songs_tracks.rb | Ruby | mit | 92 | main | 520 | class AddAudioGapFieldsToSongsTracks < ActiveRecord::Migration[8.0]
def change
add_column :songs_tracks, :previous_performance_gap_with_audio, :integer
add_column :songs_tracks, :previous_performance_slug_with_audio, :string
add_column :songs_tracks, :next_performance_gap_with_audio, :integer
add_colu... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20250715021700_add_tracks_with_audio_count_to_songs.rb | Ruby | mit | 92 | main | 717 | class AddTracksWithAudioCountToSongs < ActiveRecord::Migration[8.0]
def up
add_column :songs, :tracks_with_audio_count, :integer, default: 0
add_index :songs, :tracks_with_audio_count
populate_tracks_with_audio_counts
end
def down
remove_index :songs, :tracks_with_audio_count
remove_column ... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20240822053815_remove_devise_cols.rb | Ruby | mit | 92 | main | 794 | class RemoveDeviseCols < ActiveRecord::Migration[7.2]
def change
remove_column :users, :encrypted_password, :datetime
remove_column :users, :reset_password_sent_at, :datetime
remove_column :users, :remember_created_at, :datetime
remove_column :users, :sign_in_count, :integer
remove_column :users, ... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20250715021570_migrate_incomplete_to_audio_status.rb | Ruby | mit | 92 | main | 458 | class MigrateIncompleteToAudioStatus < ActiveRecord::Migration[8.0]
def up
execute <<-SQL
UPDATE shows
SET audio_status = 'partial'
WHERE incomplete = true AND audio_status = 'complete'
SQL
remove_column :shows, :incomplete
end
def down
add_column :shows, :incomplete, :boolean,... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20240816015824_sorcery_columns.rb | Ruby | mit | 92 | main | 659 | class SorceryColumns < ActiveRecord::Migration[7.2]
def change
add_column :users, :crypted_password, :string
execute "UPDATE users SET crypted_password = encrypted_password"
add_column :users, :salt, :string
add_column :users, :reset_password_token_expires_at, :datetime, default: nil
add_column :... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20181218053555_create_api_keys.rb | Ruby | mit | 92 | main | 403 | class CreateApiKeys < ActiveRecord::Migration[5.2]
def change
create_table :api_keys do |t|
t.string :name, null: false
t.string :email, null: false
t.string :key, null: false
t.timestamp :revoked_at
t.timestamps
end
add_index :api_keys, :name, unique: true
add_index :ap... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20130421233021_create_tags.rb | Ruby | mit | 92 | main | 634 | class CreateTags < ActiveRecord::Migration
def change
create_table :tags do |t|
t.string :name
t.string :color
t.text :description
t.timestamps
end
create_table :show_tags do |t|
t.integer :show_id
t.integer :tag_id
t.datetime :created_at
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | db/migrate/20240913000444_add_likes_unique_index.rb | Ruby | mit | 92 | main | 635 | class AddLikesUniqueIndex < ActiveRecord::Migration[6.1]
def up
execute <<-SQL
DELETE FROM likes
WHERE id NOT IN (
SELECT MIN(id)
FROM likes
GROUP BY likable_id, likable_type, user_id
);
SQL
unless index_exists?(:likes, %i[ likable_id likable_type user_id ], uniq... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.