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
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/system/application_settings_spec.rb
Ruby
mit
4,115
main
976
# frozen_string_literal: true RSpec.describe "application settings" do it "allows enabling account creation" do login_as(create(:user, admin: true)) visit(settings_path) within("form", text: "User signups are disabled") { click_on("Enable") } expect(page).to have_content("User signups are enabled")...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/system/debug_spec.rb
Ruby
mit
4,115
main
711
# frozen_string_literal: true RSpec.describe "admin/debug" do it "displays debug information" do login_as(create(:user, admin: true)) visit("/admin/debug") expect(page).to have_content(RUBY_VERSION) end it "shows None when there are no pending migrations" do login_as(create(:user, admin: true)...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/factories/stories.rb
Ruby
mit
4,115
main
375
# frozen_string_literal: true FactoryBot.define do factory(:story) do feed sequence(:entry_id, 100) { |n| "entry-#{n}" } sequence(:published, 100) { |n| n.days.ago } trait :read do is_read { true } end trait :starred do is_starred { true } end trait :with_group do ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/factories/feeds.rb
Ruby
mit
4,115
main
258
# frozen_string_literal: true FactoryBot.define do factory(:feed) do user { default_user } sequence(:name, 100) { |n| "Feed #{n}" } sequence(:url, 100) { |n| "http://exampoo.com/#{n}" } trait :with_group do group end end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/tasks/remove_old_stories_spec.rb
Ruby
mit
4,115
main
1,482
# frozen_string_literal: true RSpec.describe RemoveOldStories do def create_stories stories = double("stories") allow(stories).to receive(:delete_all) stories end it "passes along the number of days to the story repository query" do allow(described_class).to receive(:pruned_feeds).and_return([])...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/helpers/url_helpers_spec.rb
Ruby
mit
4,115
main
3,339
# frozen_string_literal: true RSpec.describe UrlHelpers do def helper helper_class = Class.new { include UrlHelpers } helper_class.new end describe "#expand_absolute_urls" do it "preserves existing absolute urls" do content = '<a href="http://foo">bar</a>' expect(helper.expand_absolute_...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/request_helpers.rb
Ruby
mit
4,115
main
222
# frozen_string_literal: true module RequestHelpers def login_as(user) post("/login", params: { username: user.username, password: user.password }) end def rendered Capybara.string(response.body) end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/with_model.rb
Ruby
mit
4,115
main
528
# frozen_string_literal: true class WithModel::Model # Workaround for https://github.com/Casecommons/with_model/issues/35 def cleanup_descendants_tracking cache_classes = Rails.application.config.cache_classes if defined?(ActiveSupport::DescendantsTracker) && !cache_classes ActiveSupport::Descendants...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/factory_bot.rb
Ruby
mit
4,115
main
453
# frozen_string_literal: true require "factory_bot" FactoryBot.find_definitions module FactoryCache def self.user @user ||= FactoryBot.create(:user) end def self.reset @user = nil end end RSpec.configure do |config| config.include(FactoryBot::Syntax::Methods) config.after do FactoryBot.rewi...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/matchers.rb
Ruby
mit
4,115
main
817
# frozen_string_literal: true module Matchers def change_all_records(records, attribute) Matchers::ChangeAllRecords.new(records, attribute) end def change_record(record, attribute) Matchers::ChangeRecord.new(record, attribute) end def delete_record(record) Matchers::DeleteRecord.new(record) e...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/downloads.rb
Ruby
mit
4,115
main
481
# frozen_string_literal: true module Downloads PATH = Rails.root.join("tmp/downloads") class << self def clear FileUtils.rm_f(downloads) end def content_for(page, filename) page.document.synchronize(errors: [Errno::ENOENT]) do File.read(PATH.join(filename)) end end ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/assets.rb
Ruby
mit
4,115
main
218
# frozen_string_literal: true RSpec.configure do |config| config.before(:suite) do system("pnpm build > /dev/null 2>&1", exception: true) system("pnpm build:css > /dev/null 2>&1", exception: true) end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/coverage.rb
Ruby
mit
4,115
main
492
# frozen_string_literal: true return if ENV["COVERAGE"] == "false" require "simplecov" if ENV["CI"] require "coveralls" SimpleCov.formatter = Coveralls::SimpleCov::Formatter end SimpleCov.start(:rails) do add_group("Commands", "app/commands") add_group("Fever API", "app/fever_api") add_group("Repositories...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/capybara.rb
Ruby
mit
4,115
main
785
# frozen_string_literal: true require "capybara/rails" Capybara.enable_aria_label = true Capybara.save_path = ENV.fetch("CIRCLE_ARTIFACTS", Capybara.save_path) Capybara.server = :puma, { Silent: true } Selenium::WebDriver.logger.output = Rails.root.join("log/selenium.log") using = ENV.fetch("DRIVER", :firefox).to_s...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/feed_server.rb
Ruby
mit
4,115
main
276
# frozen_string_literal: true class FeedServer attr_writer :response def initialize @server = Capybara::Server.new(method(:response)).boot end def response(_env) [200, {}, [@response]] end def url "http://#{@server.host}:#{@server.port}" end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/system_helpers.rb
Ruby
mit
4,115
main
217
# frozen_string_literal: true module SystemHelpers def login_as(user) visit(login_path) fill_in("Username", with: user.username) fill_in("Password", with: user.password) click_on("Login") end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/axe_core.rb
Ruby
mit
4,115
main
802
# frozen_string_literal: true require "axe-rspec" module AccessibilityOverrides A11Y_SKIP = [ "aria-required-children", "color-contrast", "landmark-one-main", "page-has-heading-one", "region" ].freeze def visit(*, accessible: true, a11y_skip: A11Y_SKIP) page.visit(*) yield if block...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/generate_xml.rb
Ruby
mit
4,115
main
608
# frozen_string_literal: true module GenerateXml class << self def call(feed, items) build_feed(feed, items).to_xml end private def build_feed(feed, items) Nokogiri::XML::Builder.new do |xml| xml.rss(version: "2.0") do xml.title(feed.name) xml.link(feed.url) ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/matchers/invoke.rb
Ruby
mit
4,115
main
1,962
# frozen_string_literal: true require "active_support/core_ext/module/delegation" class Matchers::Invoke include RSpec::Matchers::Composable delegate :failure_message, :failure_message_when_negated, to: :received_matcher def initialize(expected_method) @expected_method = expected_met...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/matchers/change_all_records.rb
Ruby
mit
4,115
main
3,027
# frozen_string_literal: true class Matchers::ChangeAllRecords include RSpec::Matchers::Composable attr_reader :records, :attribute, :original_values, :new_values, :expected_new_value, :expected_original_value def initialize(records, attribu...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/matchers/delete_record.rb
Ruby
mit
4,115
main
1,536
# frozen_string_literal: true class Matchers::DeleteRecord include RSpec::Matchers::Composable attr_reader :record def initialize(record) @record = record end def supports_block_expectations? true end def matches?(event_proc) perform_change(event_proc) exists_before? && !exists_after...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/support/matchers/change_record.rb
Ruby
mit
4,115
main
2,958
# frozen_string_literal: true class Matchers::ChangeRecord include RSpec::Matchers::Composable attr_reader :record, :attribute, :original_value, :new_value, :expected_new_value, :expected_original_value def initialize(record, attribute) ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/integration/feed_importing_spec.rb
Ruby
mit
4,115
main
2,892
# frozen_string_literal: true require "support/feed_server" RSpec.describe "Feed importing" do def create_server(url: "feed01_valid_feed/feed.xml") server = FeedServer.new server.response = sample_data(url) server end def create_feed(**) create( :feed, name: "Example feed", la...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/models/story_spec.rb
Ruby
mit
4,115
main
4,061
# frozen_string_literal: true RSpec.describe "Story" do describe ".unread" do it "returns stories where is_read is false" do story = create(:story) expect(Story.unread).to eq([story]) end it "does not return stories where is_read is true" do create(:story, :read) expect(Story.u...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/models/group_spec.rb
Ruby
mit
4,115
main
288
# frozen_string_literal: true RSpec.describe Group do describe "#as_fever_json" do it "returns a hash of the group in fever format" do group = described_class.new(id: 5, name: "wat group") expect(group.as_fever_json).to eq(id: 5, title: "wat group") end end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/models/migration_status_spec.rb
Ruby
mit
4,115
main
565
# frozen_string_literal: true RSpec.describe "MigrationStatus" do it "returns array of strings representing pending migrations" do migrator = ActiveRecord::Base.connection.pool.migration_context.open allow(migrator).to receive(:pending_migrations).and_return( [ ActiveRecord::Migration.new("Mig...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/models/user_spec.rb
Ruby
mit
4,115
main
1,311
# frozen_string_literal: true RSpec.describe User do describe "#update_api_key" do it "updates the api key when the username changed" do user = create(:user, username: "stringer", password: "super-secret") user.update!(username: "booger") expect(user.api_key).to eq(Digest::MD5.hexdigest("booge...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/models/feed_spec.rb
Ruby
mit
4,115
main
2,416
# frozen_string_literal: true RSpec.describe "Feed" do describe ".with_unread_stories_counts" do it "returns feeds with unread stories counts" do create(:story) feed = Feed.with_unread_stories_counts.first expect(feed.unread_stories_count).to eq(1) end it "includes feeds with no unre...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/models/application_record_spec.rb
Ruby
mit
4,115
main
1,752
# frozen_string_literal: true RSpec.describe ApplicationRecord do describe ".boolean_accessor" do with_model :Cheese, superclass: described_class do table { |t| t.jsonb(:options, default: {}) } end describe "#<key>" do it "returns the value when present" do Cheese.boolean_accessor(:o...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/models/setting/user_signup_spec.rb
Ruby
mit
4,115
main
903
# frozen_string_literal: true RSpec.describe Setting::UserSignup do describe ".first" do it "returns the first record" do setting = described_class.create! expect(described_class.first).to eq(setting) end it "creates a record if one does not already exist" do expect { described_class....
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/utils/i18n_support_spec.rb
Ruby
mit
4,115
main
609
# frozen_string_literal: true RSpec.describe "i18n", type: :request do it "loads default locale when no locale was set" do allow(UserRepository).to receive(:setup_complete?).and_return(false) ENV["LOCALE"] = nil get "/" expect(I18n.locale.to_s).to eq("en") expect(I18n.locale.to_s).not_to be_nil ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/utils/content_sanitizer_spec.rb
Ruby
mit
4,115
main
672
# frozen_string_literal: true RSpec.describe ContentSanitizer do it "handles <wbr> tag properly" do result = described_class.call("<code>WM_<wbr\t\n >ERROR</code> asdf") expect(result).to eq("<code>WM_ERROR</code> asdf") end it "handles <figure> tag properly" do result = described_class.call("<figu...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/utils/opml_parser_spec.rb
Ruby
mit
4,115
main
2,877
# frozen_string_literal: true RSpec.describe OpmlParser do it "returns a hash of feed details from an OPML file" do result = described_class.call(<<-XML) <?xml version="1.0" encoding="UTF-8"?> <opml version="1.0"> <head> <title>matt swanson subscriptions in Google Reader</title> <...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/utils/authorization_spec.rb
Ruby
mit
4,115
main
2,048
# frozen_string_literal: true RSpec.describe Authorization do describe "#check" do it "raises an error if the record belongs to another user" do user = create(:user) feed = create(:feed) expect { described_class.new(user).check(feed) } .to raise_error(Authorization::NotAuthorizedError)...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/utils/feed_discovery_spec.rb
Ruby
mit
4,115
main
1,752
# frozen_string_literal: true RSpec.describe FeedDiscovery do url = "http://example.com" invalid_discovered_url = "http://not-a-valid-feed.com" valid_discovered_url = "http://a-valid-feed.com" it "returns false if url is not a feed and feed url cannot be discovered" do expect(HTTParty).to receive(:get).wi...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/cast_boolean_spec.rb
Ruby
mit
4,115
main
721
# frozen_string_literal: true RSpec.describe CastBoolean do ["true", true, "1"].each do |true_value| it "returns true when passed #{true_value.inspect}" do expect(described_class.call(true_value)).to be(true) end end ["false", false, "0"].each do |false_value| it "returns false when passed #{f...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/feed/fetch_all_for_user_spec.rb
Ruby
mit
4,115
main
562
# frozen_string_literal: true RSpec.describe Feed::FetchAllForUser do def stub_pool pool = instance_double(Thread::Pool) expect(Thread).to receive(:pool).and_return(pool) expect(pool).to receive(:process).at_least(:once).and_yield expect(pool).to receive(:shutdown) end it "calls Feed::FetchOne f...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/feed/fetch_one_spec.rb
Ruby
mit
4,115
main
2,401
# frozen_string_literal: true RSpec.describe Feed::FetchOne do include ActiveSupport::Testing::TimeHelpers def create_entry(**options) entry = { published: Time.zone.now, title: "Run LLMs on my own Mac fast and efficient", url: "https://www.secondstate.io/articles/fast-llm-inference", ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/feed/find_new_stories_spec.rb
Ruby
mit
4,115
main
1,946
# frozen_string_literal: true RSpec.describe Feed::FindNewStories do def create_entry(**options) entry = { published: nil, title: "story1", url: "www.story1.com", content: "", id: "www.story1.com", **options } double(entry) end def create_raw_feed(feed, entries: [...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/feed/export_to_opml_spec.rb
Ruby
mit
4,115
main
950
# frozen_string_literal: true RSpec.describe Feed::ExportToOpml do it "returns OPML XML" do feed_one, feed_two = build_pair(:feed) result = described_class.call([feed_one, feed_two]) outlines = Nokogiri.XML(result).xpath("//body//outline") expect(outlines.size).to eq(2) expect(outlines.first["ti...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/feed/import_from_opml_spec.rb
Ruby
mit
4,115
main
4,431
# frozen_string_literal: true RSpec.describe Feed::ImportFromOpml do tmw_football = { name: "TMW Football Transfer News", url: "http://www.transfermarketweb.com/rss" } giant_robots = { name: "GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS - Home", url: "http://feeds.feedburner.com/GiantRobotsSmas...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/feed/create_spec.rb
Ruby
mit
4,115
main
1,533
# frozen_string_literal: true RSpec.describe Feed::Create do context "feed cannot be discovered" do it "returns false if cant discover any feeds" do expect(FeedDiscovery).to receive(:call).and_return(false) result = described_class.call("http://not-a-feed.com", user: default_user) expect(resul...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/feed/fetch_all_spec.rb
Ruby
mit
4,115
main
541
# frozen_string_literal: true RSpec.describe Feed::FetchAll do def stub_pool pool = instance_double(Thread::Pool) expect(Thread).to receive(:pool).and_return(pool) expect(pool).to receive(:process).at_least(:once).and_yield expect(pool).to receive(:shutdown) end it "calls Feed::FetchOne for ever...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/sync_saved_item_ids_spec.rb
Ruby
mit
4,115
main
530
# frozen_string_literal: true RSpec.describe FeverAPI::SyncSavedItemIds do it "returns a list of starred items if requested" do stories = create_list(:story, 3, :starred) authorization = Authorization.new(default_user) expect(described_class.call(authorization:, saved_item_ids: nil)) .to eq(saved_...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/write_mark_group_spec.rb
Ruby
mit
4,115
main
579
# frozen_string_literal: true RSpec.describe FeverAPI::WriteMarkGroup do def authorization Authorization.new(default_user) end it "marks the group stories as read before the given timestamp" do story = create(:story, :with_group, created_at: 1.week.ago) before = 1.day.ago id = story.group_id ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/write_mark_item_spec.rb
Ruby
mit
4,115
main
1,670
# frozen_string_literal: true RSpec.describe FeverAPI::WriteMarkItem do context "when as: 'read'" do it "marks the story as read" do story = create(:story) authorization = Authorization.new(story.user) params = { authorization:, mark: "item", as: "read", id: story.id } expect { subject.c...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/sync_unread_item_ids_spec.rb
Ruby
mit
4,115
main
522
# frozen_string_literal: true RSpec.describe FeverAPI::SyncUnreadItemIds do it "returns a list of unread items if requested" do stories = create_list(:story, 3) authorization = Authorization.new(default_user) expect(described_class.call(authorization:, unread_item_ids: nil)) .to eq(unread_item_ids...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/write_mark_feed_spec.rb
Ruby
mit
4,115
main
957
# frozen_string_literal: true RSpec.describe FeverAPI::WriteMarkFeed do def params(feed, before:) authorization = Authorization.new(feed.user) { authorization:, mark: "feed", id: feed.id, before: } end it "marks the feed stories as read before the given timestamp" do feed = create(:feed) story ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/read_groups_spec.rb
Ruby
mit
4,115
main
504
# frozen_string_literal: true RSpec.describe FeverAPI::ReadGroups do it "returns a group list if requested" do groups = create_pair(:group) authorization = Authorization.new(default_user) expect(described_class.call(authorization:, groups: nil)) .to eq(groups: [Group::UNGROUPED, *groups].map(&:as_...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/read_links_spec.rb
Ruby
mit
4,115
main
286
# frozen_string_literal: true RSpec.describe FeverAPI::ReadLinks do it "returns a fixed link list if requested" do expect(described_class.call(links: nil)).to eq(links: []) end it "returns an empty hash otherwise" do expect(described_class.call({})).to eq({}) end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/read_feeds_spec.rb
Ruby
mit
4,115
main
470
# frozen_string_literal: true RSpec.describe FeverAPI::ReadFeeds do it "returns a list of feeds" do feeds = create_list(:feed, 3) authorization = Authorization.new(default_user) expect(described_class.call(authorization:, feeds: nil)) .to eq(feeds: feeds.map(&:as_fever_json)) end it "returns ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/read_favicons_spec.rb
Ruby
mit
4,115
main
415
# frozen_string_literal: true RSpec.describe FeverAPI::ReadFavicons do it "returns a fixed icon list if requested" do expect(described_class.call({ favicons: nil })).to eq( favicons: [ { id: 0, data: "image/gif;base64,#{described_class::ICON}" } ] ) end it...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/read_feeds_groups_spec.rb
Ruby
mit
4,115
main
1,017
# frozen_string_literal: true RSpec.describe FeverAPI::ReadFeedsGroups do it "returns a list of groups requested through feeds" do group = create(:group) feeds = create_list(:feed, 3, group:) authorization = Authorization.new(default_user) expect(described_class.call(authorization:, feeds: nil)).to ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/read_items_spec.rb
Ruby
mit
4,115
main
1,560
# frozen_string_literal: true RSpec.describe FeverAPI::ReadItems do it "returns a list of unread items including total count" do stories = create_list(:story, 3) authorization = Authorization.new(default_user) items = stories.map(&:as_fever_json) expect(described_class.call(authorization:, items: ni...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/fever_api/authentication_spec.rb
Ruby
mit
4,115
main
794
# frozen_string_literal: true RSpec.describe FeverAPI::Authentication do def authorization Authorization.new(default_user) end it "returns the latest feed's last_fetched time" do feed = create(:feed, last_fetched: 1.month.ago) create(:feed, last_fetched: 1.year.ago) result = described_class.cal...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/story/mark_all_as_read_spec.rb
Ruby
mit
4,115
main
268
# frozen_string_literal: true RSpec.describe MarkAllAsRead do it "marks all stories as read" do stories = create_pair(:story) expect { described_class.call(stories.map(&:id)) } .to change_all_records(stories, :is_read).from(false).to(true) end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/story/mark_as_read_spec.rb
Ruby
mit
4,115
main
254
# frozen_string_literal: true RSpec.describe MarkAsRead do it "marks a story as read" do story = create(:story, is_read: false) expect { described_class.call(story.id) } .to change_record(story, :is_read).from(false).to(true) end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/story/mark_as_starred_spec.rb
Ruby
mit
4,115
main
296
# frozen_string_literal: true RSpec.describe MarkAsStarred do describe "#mark_as_starred" do it "marks a story as starred" do story = create(:story) expect { described_class.call(story.id) } .to change_record(story, :is_starred).from(false).to(true) end end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/story/mark_group_as_read_spec.rb
Ruby
mit
4,115
main
1,247
# frozen_string_literal: true RSpec.describe MarkGroupAsRead do describe "#mark_group_as_read" do it "marks group as read" do story = create(:story, :with_group, created_at: 1.week.ago) timestamp = 1.day.ago expect { described_class.call(story.group_id, timestamp) } .to change_record(s...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/story/mark_feed_as_read_spec.rb
Ruby
mit
4,115
main
324
# frozen_string_literal: true RSpec.describe MarkFeedAsRead do it "marks feed stories as read before timestamp" do story = create(:story, created_at: 1.week.ago) before = 1.day.ago expect { described_class.call(story.feed_id, before) } .to change_record(story, :is_read).from(false).to(true) end ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/story/mark_as_unstarred_spec.rb
Ruby
mit
4,115
main
261
# frozen_string_literal: true RSpec.describe MarkAsUnstarred do it "marks a story as unstarred" do story = create(:story, :starred) expect { described_class.call(story.id) } .to change_record(story, :is_starred).from(true).to(false) end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/story/mark_as_unread_spec.rb
Ruby
mit
4,115
main
257
# frozen_string_literal: true RSpec.describe MarkAsUnread do it "marks a story as unread" do story = create(:story, is_read: true) expect { described_class.call(story.id) } .to change_record(story, :is_read).from(true).to(false) end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/commands/user/sign_in_user_spec.rb
Ruby
mit
4,115
main
568
# frozen_string_literal: true RSpec.describe SignInUser do it "returns the user if the password is valid" do result = described_class.call(default_user.username, default_user.password) expect(result).to eq(default_user) end it "returns nil if password is invalid" do create(:user) result = desc...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/passwords_controller_spec.rb
Ruby
mit
4,115
main
3,173
# frozen_string_literal: true RSpec.describe PasswordsController do describe "#new" do it "displays a form to enter your password" do get "/setup/password" expect(rendered).to have_css("form#password_setup") end it "redirects to the login page when signups are not enabled" do create(:...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/feeds_controller_spec.rb
Ruby
mit
4,115
main
4,102
# frozen_string_literal: true RSpec.describe FeedsController do include ActiveJob::TestHelper describe "#index" do it "renders a list of feeds" do login_as(default_user) create_pair(:feed) get "/feeds" expect(rendered).to have_css("li.feed", count: 2) end it "displays messag...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/sessions_controller_spec.rb
Ruby
mit
4,115
main
1,583
# frozen_string_literal: true RSpec.describe SessionsController do describe "#new" do it "has a password input and login button" do create(:user) get "/login" expect(rendered).to have_field("password") end end describe "#create" do it "denies access when password is incorrect" do...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/imports_controller_spec.rb
Ruby
mit
4,115
main
620
# frozen_string_literal: true RSpec.describe ImportsController do describe "GET /feeds/import" do it "displays the import options" do login_as(default_user) get "/feeds/import" expect(rendered).to have_field("opml_file") end end describe "POST /feeds/import" do opml_file = Rack::...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/debug_controller_spec.rb
Ruby
mit
4,115
main
1,366
# frozen_string_literal: true RSpec.describe DebugController do describe "#debug" do def setup login_as(create(:user, admin: true)) expect(MigrationStatus) .to receive(:call) .and_return(["Migration B - 2", "Migration C - 3"]) end it "displays an admin settings link" do ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/fever_controller_spec.rb
Ruby
mit
4,115
main
7,214
# frozen_string_literal: true RSpec.describe FeverController do def standard_answer { api_version: 3, auth: 1, last_refreshed_on_time: 0 } end def cannot_auth { api_version: 3, auth: 0 } end def response_as_object JSON.parse(response.body, symbolize_names: true) end def params(user: defaul...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/profiles_controller_spec.rb
Ruby
mit
4,115
main
1,741
# frozen_string_literal: true RSpec.describe ProfilesController do describe "#edit" do it "displays the edit view" do login_as(default_user) get(edit_profile_path) expect(rendered).to have_text("Edit profile") .and have_field("Username", with: default_user.username) end end d...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/exports_controller_spec.rb
Ruby
mit
4,115
main
952
# frozen_string_literal: true RSpec.describe ExportsController do describe "GET /feeds/export" do def expected_xml <<~XML <?xml version="1.0"?> <opml version="1.0"> <head> <title>Feeds from Stringer</title> </head> <body/> </opml> XML ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/stories_controller_spec.rb
Ruby
mit
4,115
main
4,091
# frozen_string_literal: true RSpec.describe StoriesController do describe "GET /news" do it "redirects to the setup page when no user exists" do get "/news" expect(URI.parse(response.location).path).to eq("/setup/password") end it "redirects to the login page if not logged in" do cre...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/tutorials_controller_spec.rb
Ruby
mit
4,115
main
349
# frozen_string_literal: true RSpec.describe TutorialsController do describe "#index" do context "when a user has not been setup" do it "displays the tutorial and completes setup" do login_as(default_user) get "/setup/tutorial" expect(rendered).to have_css("#mark-all-instruction")...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/requests/settings_controller_spec.rb
Ruby
mit
4,115
main
621
# frozen_string_literal: true RSpec.describe SettingsController do describe "#index" do it "displays the settings page" do login_as(create(:user, admin: true)) get(settings_path) expect(rendered).to have_css("h1", text: "Settings") .and have_text("User signups are disabled") end ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
spec/linters/rubocop/cop/rspec/no_before_hook_spec.rb
Ruby
mit
4,115
main
1,298
# frozen_string_literal: true require "rubocop" require "rubocop-rspec" require "rubocop/rspec/cop_helper" require "rubocop/rspec/expect_offense" require_relative("../../../../../linters/rubocop/cop/rspec/no_before_hook") RSpec.describe RuboCop::Cop::RSpec::NoBeforeHook do include CopHelper include RuboCop::RSpec...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/schema.rb
Ruby
mit
4,115
main
8,213
# 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
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20240314031223_create_index_good_job_jobs_for_candidate_lookup.rb
Ruby
mit
4,115
main
657
# frozen_string_literal: true class CreateIndexGoodJobJobsForCandidateLookup < ActiveRecord::Migration[7.1] disable_ddl_transaction! def change reversible do |dir| dir.up do # Ensure this incremental update migration is idempotent # with monolithic install migration. return if co...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20230301024452_encrypt_api_key.rb
Ruby
mit
4,115
main
685
# frozen_string_literal: true class EncryptAPIKey < ActiveRecord::Migration[7.0] def change ActiveRecord::Encryption.config.support_unencrypted_data = true encrypt_api_keys ActiveRecord::Encryption.config.support_unencrypted_data = false change_column_null :users, :api_key, false add_index :us...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20240314031219_recreate_good_job_cron_indexes_with_conditional.rb
Ruby
mit
4,115
main
2,206
# frozen_string_literal: true class RecreateGoodJobCronIndexesWithConditional < ActiveRecord::Migration[7.1] disable_ddl_transaction! def change reversible do |dir| dir.up do unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at_cond) add_index :g...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20130805113712_update_stories_unique_constraints.rb
Ruby
mit
4,115
main
496
# frozen_string_literal: true class UpdateStoriesUniqueConstraints < ActiveRecord::Migration[4.2] def up remove_index :stories, [:permalink, :feed_id] add_index :stories, [:entry_id, :feed_id], unique: true, length: { permalink: 767 } end def down remove_ind...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20240314031222_remove_good_job_active_id_index.rb
Ruby
mit
4,115
main
600
# frozen_string_literal: true class RemoveGoodJobActiveIdIndex < ActiveRecord::Migration[7.1] disable_ddl_transaction! def change reversible do |dir| dir.up do if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_active_job_id) remove_index :good_jobs, name: :index_good_job...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20130409010826_create_stories.rb
Ruby
mit
4,115
main
271
# frozen_string_literal: true class CreateStories < ActiveRecord::Migration[4.2] def change create_table :stories do |t| t.string :title t.string :permalink t.text :body t.references :feed t.timestamps null: false end end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20130425222157_add_delayed_job.rb
Ruby
mit
4,115
main
1,206
# frozen_string_literal: true class AddDelayedJob < ActiveRecord::Migration[4.2] def self.up create_table :delayed_jobs, force: true do |table| # Allows some jobs to jump to the front of the queue table.integer :priority, default: 0 # Provides for retries, but still fail eventually. tabl...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20240226201050_add_precision_to_timestamps.rb
Ruby
mit
4,115
main
752
# frozen_string_literal: true class AddPrecisionToTimestamps < ActiveRecord::Migration[7.1] SKIP_TABLES = [:schema_migrations, :ar_internal_metadata].freeze def up migrate_precision(precision: 6) end def down migrate_precision(precision: nil) end def migrate_precision(precision:) table_names...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20240709172408_create_good_job_execution_duration.rb
Ruby
mit
4,115
main
426
# frozen_string_literal: true class CreateGoodJobExecutionDuration < ActiveRecord::Migration[7.1] def change reversible do |dir| dir.up do # Ensure this incremental update migration is idempotent # with monolithic install migration. return if connection.column_exists?(:good_job_exec...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20230223045525_add_null_false_to_associations.rb
Ruby
mit
4,115
main
646
# frozen_string_literal: true class AddNullFalseToAssociations < ActiveRecord::Migration[7.0] def change update_null_foreign_keys change_column_null :feeds, :user_id, false change_column_null :groups, :user_id, false change_column_null :stories, :feed_id, false end private def update_null_fo...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20140413100725_add_groups_table_and_foreign_keys_to_feeds.rb
Ruby
mit
4,115
main
348
# frozen_string_literal: true class AddGroupsTableAndForeignKeysToFeeds < ActiveRecord::Migration[4.2] def up create_table :groups do |t| t.string :name, null: false t.timestamps null: false end add_column :feeds, :group_id, :integer end def down drop_table :groups remove_column ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20141102103617_fix_invalid_titles_with_unicode_line_endings.rb
Ruby
mit
4,115
main
354
# frozen_string_literal: true class FixInvalidTitlesWithUnicodeLineEndings < ActiveRecord::Migration[4.2] def up Story.find_each do |story| unless story.title.nil? valid_title = story.title.delete("\u2028").delete("\u2029") story.update_attribute(:title, valid_title) end end end...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20230801025232_create_good_job_batches.rb
Ruby
mit
4,115
main
948
# frozen_string_literal: true class CreateGoodJobBatches < ActiveRecord::Migration[7.0] def change reversible do |dir| dir.up do # Ensure this incremental update migration is idempotent # with monolithic install migration. return if connection.table_exists?(:good_job_batches) ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20240314031220_create_good_job_labels.rb
Ruby
mit
4,115
main
400
# frozen_string_literal: true class CreateGoodJobLabels < ActiveRecord::Migration[7.1] def change reversible do |dir| dir.up do # Ensure this incremental update migration is idempotent # with monolithic install migration. return if connection.column_exists?(:good_jobs, :labels) ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20230305010750_create_good_jobs.rb
Ruby
mit
4,115
main
2,933
# frozen_string_literal: true class CreateGoodJobs < ActiveRecord::Migration[7.0] def change enable_extension "pgcrypto" create_table :good_jobs, id: :uuid do |t| t.text :queue_name t.integer :priority t.jsonb :serialized_params t.datetime :scheduled_at t.datetime :performed_at...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20130509131045_add_unique_constraints.rb
Ruby
mit
4,115
main
214
# frozen_string_literal: true class AddUniqueConstraints < ActiveRecord::Migration[4.2] def change add_index :stories, [:permalink, :feed_id], unique: true add_index :feeds, :url, unique: true end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20230801025234_create_good_jobs_error_event.rb
Ruby
mit
4,115
main
485
# frozen_string_literal: true class CreateGoodJobsErrorEvent < ActiveRecord::Migration[7.0] def change reversible do |dir| dir.up do # Ensure this incremental update migration is idempotent # with monolithic install migration. return if connection.column_exists?(:good_jobs, :error_e...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20130412185253_add_new_fields_to_stories.rb
Ruby
mit
4,115
main
247
# frozen_string_literal: true class AddNewFieldsToStories < ActiveRecord::Migration[4.2] def change add_column :stories, :published, :timestamp add_column :stories, :is_read, :boolean add_column :stories, :author, :string end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20240709172406_create_good_job_process_lock_ids.rb
Ruby
mit
4,115
main
579
# frozen_string_literal: true class CreateGoodJobProcessLockIds < ActiveRecord::Migration[7.1] def change reversible do |dir| dir.up do # Ensure this incremental update migration is idempotent # with monolithic install migration. return if connection.column_exists?(:good_jobs, :lock...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20230801025233_create_good_job_executions.rb
Ruby
mit
4,115
main
893
# frozen_string_literal: true class CreateGoodJobExecutions < ActiveRecord::Migration[7.0] def change reversible do |dir| dir.up do # Ensure this incremental update migration is idempotent # with monolithic install migration. return if connection.table_exists?(:good_job_executions) ...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20230221233057_add_user_id_to_tables.rb
Ruby
mit
4,115
main
238
# frozen_string_literal: true class AddUserIdToTables < ActiveRecord::Migration[7.0] def change add_reference :feeds, :user, index: true, foreign_key: true add_reference :groups, :user, index: true, foreign_key: true end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20130821020313_update_nil_entry_ids.rb
Ruby
mit
4,115
main
262
# frozen_string_literal: true class UpdateNilEntryIds < ActiveRecord::Migration[4.2] def up Story.where(entry_id: nil).find_each do |story| story.entry_id = story.permalink || story.id story.save end end def down # skip end end
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20240709172407_create_good_job_process_lock_indexes.rb
Ruby
mit
4,115
main
2,070
# frozen_string_literal: true class CreateGoodJobProcessLockIndexes < ActiveRecord::Migration[7.1] disable_ddl_transaction! def change reversible do |dir| dir.up do unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked) add_index...
github
stringer-rss/stringer
https://github.com/stringer-rss/stringer
db/migrate/20240709172405_create_good_job_execution_error_backtrace.rb
Ruby
mit
4,115
main
477
# frozen_string_literal: true class CreateGoodJobExecutionErrorBacktrace < ActiveRecord::Migration[7.1] def change reversible do |dir| dir.up do # Ensure this incremental update migration is idempotent # with monolithic install migration. if connection.column_exists?(:good_job_execu...