repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
jkeen/tracking_number_data | https://github.com/jkeen/tracking_number_data/blob/802d8a55e506b65bb5c820ed4e6d259a29f3911e/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'bundler/setup'
Bundler.setup
require 'byebug'
require 'tracking_number' # and any other gems you need
RSpec.configure do |config|
config.example_status_persistence_file_path = '.rspec_status'
end
module TrackingNumber
module ChecksumValidations
class << self
# DE... | ruby | MIT | 802d8a55e506b65bb5c820ed4e6d259a29f3911e | 2026-01-04T17:45:13.109005Z | false |
abhay/calais | https://github.com/abhay/calais/blob/21ef6f2714f2d5f786a1819927b4e8429c274fd5/init.rb | init.rb | require File.dirname(__FILE__) + '/lib/calais' | ruby | MIT | 21ef6f2714f2d5f786a1819927b4e8429c274fd5 | 2026-01-04T17:45:14.094016Z | false |
abhay/calais | https://github.com/abhay/calais/blob/21ef6f2714f2d5f786a1819927b4e8429c274fd5/spec/helper.rb | spec/helper.rb | require 'rubygems'
require 'rspec'
require 'yaml'
require File.dirname(__FILE__) + '/../lib/calais'
FIXTURES_DIR = File.join File.dirname(__FILE__), %[fixtures]
SAMPLE_DOCUMENT = File.read(File.join(FIXTURES_DIR, %[bicycles_australia.xml]))
SAMPLE_RESPONSE = File.read(File.join(FIXTURES_DIR, %[bicycles_australia.resp... | ruby | MIT | 21ef6f2714f2d5f786a1819927b4e8429c274fd5 | 2026-01-04T17:45:14.094016Z | false |
abhay/calais | https://github.com/abhay/calais/blob/21ef6f2714f2d5f786a1819927b4e8429c274fd5/spec/calais/response_spec.rb | spec/calais/response_spec.rb | require File.join(File.dirname(__FILE__), %w[.. helper])
describe Calais::Response, :new do
it 'accepts an rdf string to generate the response object' do
lambda { Calais::Response.new(SAMPLE_RESPONSE) }.should_not raise_error
end
end
describe Calais::Response, :new do
it "should return error message in runt... | ruby | MIT | 21ef6f2714f2d5f786a1819927b4e8429c274fd5 | 2026-01-04T17:45:14.094016Z | false |
abhay/calais | https://github.com/abhay/calais/blob/21ef6f2714f2d5f786a1819927b4e8429c274fd5/spec/calais/client_spec.rb | spec/calais/client_spec.rb | require File.join(File.dirname(__FILE__), %w[.. helper])
describe Calais::Client, :new do
it 'accepts arguments as a hash' do
client = nil
lambda { client = Calais::Client.new(:content => SAMPLE_DOCUMENT, :license_id => LICENSE_ID) }.should_not raise_error
client.license_id.should == LICENSE_ID
cli... | ruby | MIT | 21ef6f2714f2d5f786a1819927b4e8429c274fd5 | 2026-01-04T17:45:14.094016Z | false |
abhay/calais | https://github.com/abhay/calais/blob/21ef6f2714f2d5f786a1819927b4e8429c274fd5/lib/calais.rb | lib/calais.rb | require 'digest/sha1'
require 'net/http'
require 'uri'
require 'cgi'
require 'iconv' if RUBY_VERSION.to_f < 1.9
require 'set'
require 'date'
require 'rubygems'
require 'nokogiri'
require 'json'
if RUBY_VERSION.to_f < 1.9
$KCODE = "UTF8"
require 'jcode'
end
$:.unshift File.expand_path(File.dirname(__FILE__))
req... | ruby | MIT | 21ef6f2714f2d5f786a1819927b4e8429c274fd5 | 2026-01-04T17:45:14.094016Z | false |
abhay/calais | https://github.com/abhay/calais/blob/21ef6f2714f2d5f786a1819927b4e8429c274fd5/lib/calais/version.rb | lib/calais/version.rb | module Calais
VERSION = "0.0.13"
end
| ruby | MIT | 21ef6f2714f2d5f786a1819927b4e8429c274fd5 | 2026-01-04T17:45:14.094016Z | false |
abhay/calais | https://github.com/abhay/calais/blob/21ef6f2714f2d5f786a1819927b4e8429c274fd5/lib/calais/response.rb | lib/calais/response.rb | module Calais
class Response
MATCHERS = {
:docinfo => 'DocInfo',
:docinfometa => 'DocInfoMeta',
:defaultlangid => 'DefaultLangId',
:doccat => 'DocCat',
:entities => 'type/em/e',
:relations => 'type/em/r',
:geographies => 'type/er',
:instances => 'type/sys/InstanceIn... | ruby | MIT | 21ef6f2714f2d5f786a1819927b4e8429c274fd5 | 2026-01-04T17:45:14.094016Z | false |
abhay/calais | https://github.com/abhay/calais/blob/21ef6f2714f2d5f786a1819927b4e8429c274fd5/lib/calais/client.rb | lib/calais/client.rb | module Calais
class Client
# base attributes of the call
attr_accessor :content
attr_accessor :license_id
# processing directives
attr_accessor :content_type, :output_format, :reltag_base_url, :calculate_relevance, :omit_outputting_original_text
attr_accessor :store_rdf, :metadata_enables, :m... | ruby | MIT | 21ef6f2714f2d5f786a1819927b4e8429c274fd5 | 2026-01-04T17:45:14.094016Z | false |
abhay/calais | https://github.com/abhay/calais/blob/21ef6f2714f2d5f786a1819927b4e8429c274fd5/lib/calais/error.rb | lib/calais/error.rb | class Calais::Error < StandardError
end | ruby | MIT | 21ef6f2714f2d5f786a1819927b4e8429c274fd5 | 2026-01-04T17:45:14.094016Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/spec/spec_helper.rb | spec/spec_helper.rb | # This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# file... | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor.rb | lib/notifyor.rb | $LOAD_PATH.unshift(File.dirname(__FILE__))
require 'notifyor/plugin'
require 'notifyor/configuration'
module Notifyor
class << self
attr_accessor :configuration
end
def self.configure
self.configuration ||= Configuration.new
yield(configuration) if block_given?
end
ActiveRecord::Base.send(:inc... | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/version.rb | lib/notifyor/version.rb | module Notifyor
VERSION = "0.8.1"
end
| ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/growl.rb | lib/notifyor/growl.rb | require 'notifyor/util/os_analyzer'
module Notifyor
module Growl
extend self
def adapter
return @adapter if @adapter
self.adapter =
case ::Notifyor::Util::OSAnalyzer.os
when :macosx
:terminal_notifier
when :linux
:libnotify_notifier
... | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/plugin.rb | lib/notifyor/plugin.rb | require 'active_support'
require 'redis'
module Notifyor
module Plugin
extend ::ActiveSupport::Concern
included do
end
module ClassMethods
def notifyor(options = {})
configure_plugin(options)
end
def configure_plugin(options = {})
configuration = default_configura... | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/configuration.rb | lib/notifyor/configuration.rb | require 'redis'
require 'connection_pool'
module Notifyor
class Configuration
attr_accessor :redis_connection
def initialize
@redis_connection = ::Redis.new
end
end
end | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/cli.rb | lib/notifyor/cli.rb | require 'notifyor/version'
require 'optparse'
module Notifyor
class CLI
def parse
# Default configuration.
ENV['ssh_host'] = 'localhost'
ENV['ssh_port'] = '22'
ENV['ssh_tunnel_port'] = '2000'
ENV['ssh_redis_port'] = '6379'
::OptionParser.new do |opts|
opts.banner = '... | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/util/os_analyzer.rb | lib/notifyor/util/os_analyzer.rb | require 'rbconfig'
module Notifyor
module Util
module OSAnalyzer
extend self
def os
host_os = RbConfig::CONFIG['host_os']
case host_os
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
:windows
when /darwin|mac os/
:macosx
when /linux... | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/util/formatter.rb | lib/notifyor/util/formatter.rb | module Notifyor
module Util
module Formatter
extend self
def squish!(string)
string.gsub!(/\A[[:space:]]+/, '')
string.gsub!(/[[:space:]]+\z/, '')
string.gsub!(/[[:space:]]+/, ' ')
string
end
end
end
end | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/remote/connection.rb | lib/notifyor/remote/connection.rb | require 'json'
require 'redis'
require 'notifyor/growl'
require 'notifyor/util/formatter'
require 'net/ssh/gateway'
module Notifyor
module Remote
class Connection
def initialize
@ssh_host = ENV['ssh_host'] || 'localhost'
@ssh_port = ENV['ssh_port'] || '22'
@ssh_user = ENV['ssh_user'... | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/growl/adapters/libnotify_notifier.rb | lib/notifyor/growl/adapters/libnotify_notifier.rb | module Notifyor
module Growl
module Adapters
module LibnotifyNotifier
extend self
def create_growl(title, message)
%x(notify-send '#{title}' '#{message}')
end
end
end
end
end | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
erwinjunker/notifyor | https://github.com/erwinjunker/notifyor/blob/b95878a055ba28db060daae3c2c50d7162304311/lib/notifyor/growl/adapters/terminal_notifier.rb | lib/notifyor/growl/adapters/terminal_notifier.rb | require 'terminal-notifier'
module Notifyor
module Growl
module Adapters
module TerminalNotifier
extend self
def create_growl(title, message)
::TerminalNotifier.notify(message, :title => title)
end
end
end
end
end | ruby | MIT | b95878a055ba28db060daae3c2c50d7162304311 | 2026-01-04T17:45:18.437563Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/rakefile.rb | rakefile.rb | # frozen_string_literal: true
require 'bundler'
require 'rake'
require 'rspec'
require 'rspec/core/rake_task'
Bundler.setup
Bundler::GemHelper.install_tasks
task default: [:spec]
desc 'Run all examples'
RSpec::Core::RakeTask.new(:spec) do |t|
t.ruby_opts = %w[-w]
end
| ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'vcr'
if ENV['COVERAGE']
require 'simplecov'
SimpleCov.start do
enable_coverage :branch
add_filter '/spec/'
minimum_coverage 95
minimum_coverage_by_file 90
add_group 'Config', 'lib/html2rss/config'
add_group 'Request Service', 'lib/html2rss/request... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/support/cli_helpers.rb | spec/support/cli_helpers.rb | # frozen_string_literal: true
require 'stringio'
module CliHelpers
# Capture CLI output while running inside a VCR cassette.
#
# @param args [Array<String>] CLI arguments to execute
# @param cassette [String] VCR cassette name
# @return [String] captured STDOUT output
def capture_cli_output(*args, cassett... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/support/helpers/configuration_helpers.rb | spec/support/helpers/configuration_helpers.rb | # frozen_string_literal: true
# Configuration and validation helpers for HTML2RSS example specs
module ConfigurationHelpers
# Loads an example configuration from the spec/examples directory
# @param config_name [String] The name of the configuration file (without .yml extension)
# @return [Hash] The loaded confi... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/support/helpers/example_helpers.rb | spec/support/helpers/example_helpers.rb | # frozen_string_literal: true
# Helper methods for HTML2RSS example specs that keep assertions aligned with the production pipeline.
require_relative 'configuration_helpers'
module ExampleHelpers
include ConfigurationHelpers
FIXTURE_ROOT = File.join('spec', 'examples').freeze
##
# Stub the request service ... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/examples/conditional_processing_spec.rb | spec/examples/conditional_processing_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'time'
RSpec.describe 'Conditional Processing Configuration' do
subject(:feed) do
mock_request_service_with_html_fixture('conditional_processing_site', 'https://example.com')
Html2rss.feed(config)
end
let(:config_file) { File.join(%w[spec exam... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/examples/json_api_site_spec.rb | spec/examples/json_api_site_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'json'
require 'time'
RSpec.describe 'JSON API Site Configuration' do
subject(:feed) do
mock_request_service_with_json_fixture('json_api_site', 'https://example.com/posts')
Html2rss.feed(config)
end
let(:config_file) { File.join(%w[spec exampl... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/examples/performance_optimized_spec.rb | spec/examples/performance_optimized_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'time'
RSpec.describe 'Performance-Optimized Configuration' do
subject(:feed) do
mock_request_service_with_html_fixture('performance_optimized_site', 'https://example.com')
Html2rss.feed(config)
end
let(:config_file) { File.join(%w[spec exampl... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/examples/media_enclosures_spec.rb | spec/examples/media_enclosures_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'time'
RSpec.describe 'Media Enclosures Configuration', type: :example do
subject(:feed) { generate_feed_from_config(config, config_name, :html) }
let(:config_name) { 'media_enclosures_site' }
let(:config) { load_example_configuration(config_name) }
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/examples/combined_scraper_sources_spec.rb | spec/examples/combined_scraper_sources_spec.rb | # frozen_string_literal: true
require 'spec_helper'
# This spec demonstrates the combined scraper sources configuration,
# which uses both auto-source detection and manual selectors to extract
# RSS feed data from HTML content.
RSpec.describe 'Combined Scraper Sources Configuration', type: :example do
# RSS feed ge... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/examples/unreliable_site_spec.rb | spec/examples/unreliable_site_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Unreliable Site Configuration' do
subject(:feed) do
mock_request_service_with_html_fixture('unreliable_site', 'https://example.com')
Html2rss.feed(config)
end
let(:config_file) { File.join(%w[spec examples unreliable_site.yml]) }
let... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/examples/dynamic_content_site_spec.rb | spec/examples/dynamic_content_site_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Dynamic Content Site Configuration' do
subject(:feed) do
mock_request_service_with_html_fixture('dynamic_content_site', 'https://example.com/news')
Html2rss.feed(config)
end
let(:config_file) { File.join(%w[spec examples dynamic_conten... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/examples/multilang_site_spec.rb | spec/examples/multilang_site_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Multi-Language Site Configuration' do
subject(:feed) do
mock_request_service_with_html_fixture('multilang_site', 'https://example.com')
Html2rss.feed(config)
end
let(:config_file) { File.join(%w[spec examples multilang_site.yml]) }
l... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/exe/html2rss_spec.rb | spec/exe/html2rss_spec.rb | # frozen_string_literal: true
RSpec.describe 'exe/html2rss', :slow do
let(:executable) do
matches = Gem::Specification.find_all_by_name 'html2rss'
spec = matches.first
File.expand_path('exe/html2rss', spec.full_gem_path)
end
let(:doctype_xml) do
'<?xml version="1.0" encoding="UTF-8"?>'
end
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/html2rss/articles/deduplicator_spec.rb | spec/html2rss/articles/deduplicator_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::Articles::Deduplicator do
subject(:deduplicated) { described_class.new(articles).call }
let(:scraper) { Class.new }
describe '#initialize' do
it 'requires articles' do
expect { described_class.new(nil) }.to raise_error(Argu... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss_spec.rb | spec/lib/html2rss_spec.rb | # frozen_string_literal: true
require 'nokogiri'
RSpec.describe Html2rss do
let(:config_file) { File.join(%w[spec fixtures feeds.test.yml]) }
let(:name) { 'nuxt-releases' }
it 'has a version number' do
expect(Html2rss::VERSION).not_to be_nil
end
describe '.config_from_yaml_file(file, feed_name = nil)'... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/category_extractor_spec.rb | spec/lib/html2rss/category_extractor_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::CategoryExtractor do
describe '.call' do
let(:html) { Nokogiri::HTML.fragment(html_content) }
let(:article_tag) { html.at_css('article') }
context 'when article has category classes' do
let(:html_content) do
<<~H... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/cli_spec.rb | spec/lib/html2rss/cli_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::CLI do
subject(:cli) { described_class.new }
describe '#feed' do
let(:rss_xml) { '<rss><channel><title>Example</title></channel></rss>' }
before do
allow(Html2rss).to receive(:feed).and_return(rss_xml)
end
it 'pa... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/html_navigator_spec.rb | spec/lib/html2rss/html_navigator_spec.rb | # frozen_string_literal: true
require 'nokogiri'
RSpec.describe Html2rss::HtmlNavigator do
describe '.parent_until_condition' do
let(:html) do
<<-HTML
<div>
<section>
<article>
<p id="target">Some text here</p>
</article>
</section>
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/url_spec.rb | spec/lib/html2rss/url_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Url do
describe '.from_relative' do
let(:base_url) { 'https://example.com' }
{
'/sprite.svg#play' => 'https://example.com/sprite.svg#play',
'/search?q=term' => 'https://example.com/search?q=term'
}.each_pair do |relative_url, expected_ab... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/request_service_spec.rb | spec/lib/html2rss/request_service_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::RequestService do
specify(:aggregate_failures) do
expect(described_class::UnknownStrategy).to be < Html2rss::Error
expect(described_class::InvalidUrl).to be < Html2rss::Error
expect(described_class::UnsupportedUrlScheme).to be ... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/rss_builder_spec.rb | spec/lib/html2rss/rss_builder_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::RssBuilder do
subject(:instance) do
described_class.new(channel:,
articles:,
stylesheets: [
{ href: 'rss.xsl', type: 'text/xsl' }
])
end
let(:channel) do
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors_spec.rb | spec/lib/html2rss/selectors_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::Selectors do
subject(:instance) { described_class.new(response, selectors:, time_zone:) }
let(:response) { Html2rss::RequestService::Response.new url: 'http://example.com', headers: { 'content-type': 'text/html' }, body: }
let(:select... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/error_spec.rb | spec/lib/html2rss/error_spec.rb | # frozen_string_literal: true
require 'nokogiri'
RSpec.describe Html2rss::Error do
it { expect(described_class).to be < StandardError }
end
| ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source_spec.rb | spec/lib/html2rss/auto_source_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource do
subject(:auto_source) { described_class.new(response, config) }
let(:config) { described_class::DEFAULT_CONFIG }
let(:url) { Html2rss::Url.from_relative('https://example.com', 'https://example.com') }
let(:headers) { { 'content-type': 'text/... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/config_spec.rb | spec/lib/html2rss/config_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::Config do
it { expect(described_class::InvalidConfig).to be < Html2rss::Error }
describe Html2rss::Config::MultipleFeedsConfig do
describe '::CONFIG_KEY_FEEDS' do
it { expect(described_class::CONFIG_KEY_FEEDS).to eq :feeds }
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/html_extractor_spec.rb | spec/lib/html2rss/html_extractor_spec.rb | # frozen_string_literal: true
require 'nokogiri'
RSpec.describe Html2rss::HtmlExtractor do
subject(:article_hash) { described_class.new(article_tag, base_url: 'https://example.com').call }
describe '.extract_visible_text' do
subject(:visible_text) { described_class.extract_visible_text(tag) }
let(:tag) ... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper_spec.rb | spec/lib/html2rss/auto_source/scraper_spec.rb | # frozen_string_literal: true
require 'rspec'
RSpec.describe Html2rss::AutoSource::Scraper do
it { is_expected.to be_a(Module) }
it { expect(described_class::SCRAPERS).to be_an(Array) }
describe '.from(parsed_body, opts)' do
context 'when suitable scraper is found' do
let(:parsed_body) do
Nok... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/cleanup_spec.rb | spec/lib/html2rss/auto_source/cleanup_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource::Cleanup do
let(:url) { Html2rss::Url.from_relative('http://example.com', 'http://example.com') }
let(:articles) do
[
instance_double(Html2rss::RssBuilder::Article,
valid?: true,
url: Html2rss::U... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper/json_state_spec.rb | spec/lib/html2rss/auto_source/scraper/json_state_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource::Scraper::JsonState do
let(:base_url) { Html2rss::Url.from_relative('https://example.com', 'https://example.com') }
def load_fixture(name)
file = File.join(__dir__, '../../../..', 'fixtures/auto_source/json_state', name)
File.read(file)
e... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper/schema_spec.rb | spec/lib/html2rss/auto_source/scraper/schema_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource::Scraper::Schema do
# Test factories for maintainability
def build_script_tag(json_content)
Nokogiri::HTML("<script type=\"application/ld+json\">#{json_content}</script>")
end
def mock_logging
allow(Html2rss::Log).to receive(:warn)
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper/html_spec.rb | spec/lib/html2rss/auto_source/scraper/html_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource::Scraper::Html do
let(:html) do
<<~HTML
<!DOCTYPE html>
<html>
<head>
<title>Sample Document</title>
</head>
<body>
<h1>Main Heading</h1>
<article>
<h2>Article 1 Headline</h2>
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper/semantic_html_spec.rb | spec/lib/html2rss/auto_source/scraper/semantic_html_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource::Scraper::SemanticHtml do
describe '.options_key' do
specify { expect(described_class.options_key).to eq(:semantic_html) }
end
describe '.articles?' do
let(:parsed_body) do
Nokogiri::HTML.parse <<~HTML
<html><body><article><... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper/rss_feed_detector_spec.rb | spec/lib/html2rss/auto_source/scraper/rss_feed_detector_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource::Scraper::RssFeedDetector do
subject(:instance) { described_class.new(parsed_body, url:) }
let(:url) { 'https://example.com' }
let(:parsed_body) { Nokogiri::HTML(html) }
describe '.articles?' do
context 'when RSS feed links are present' do... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper/schema/category_extractor_spec.rb | spec/lib/html2rss/auto_source/scraper/schema/category_extractor_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::AutoSource::Scraper::Schema::CategoryExtractor do
describe '.call' do
subject(:categories) { described_class.call(schema_object) }
context 'when schema object has field categories' do
let(:schema_object) do
{
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper/schema/list_item_spec.rb | spec/lib/html2rss/auto_source/scraper/schema/list_item_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource::Scraper::Schema::ListItem do
let(:schema_object) do
{ item: { '@id': '123', name: 'Test Item', description: 'Test Description', url: 'http://example.com/foobar' } }
end
let(:url) { 'http://example.com' }
let(:list_item) { described_class.ne... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper/schema/item_list_spec.rb | spec/lib/html2rss/auto_source/scraper/schema/item_list_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource::Scraper::Schema::ItemList do
subject(:instance) { described_class.new(schema_object, url: nil) }
let(:schema_object) do
{
'@context': 'https://schema.org',
'@type': 'ItemList',
itemListElement: [
{
'@type': ... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/auto_source/scraper/schema/thing_spec.rb | spec/lib/html2rss/auto_source/scraper/schema/thing_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::AutoSource::Scraper::Schema::Thing do
subject(:instance) { described_class.new(schema_object, url: 'https://example.com') }
let(:schema_object) do
{ '@type': 'ScholarlyArticle', title: 'Baustellen der Nation' }
end
specify { expect(described_class::S... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/rendering/description_builder_spec.rb | spec/lib/html2rss/rendering/description_builder_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'nokogiri'
RSpec.describe Html2rss::Rendering::DescriptionBuilder do
describe '#call' do
context 'when base is plain text' do
subject(:description) { described_class.new(base:, title: 'Sample instance', url: 'http://example.com', enclosures: nil,... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/rendering/image_renderer_spec.rb | spec/lib/html2rss/rendering/image_renderer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::Rendering::ImageRenderer do
describe '#to_html' do
context 'with valid title' do
it 'renders an img tag with escaped title', :aggregate_failures do # rubocop:disable RSpec/ExampleLength
renderer = described_class.new(url:... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/rendering/media_table_renderer_spec.rb | spec/lib/html2rss/rendering/media_table_renderer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'nokogiri'
RSpec.describe Html2rss::Rendering::MediaTableRenderer do
describe '#to_html' do
context 'when no media is available' do
subject(:renderer) { described_class.new(enclosures: [], image: nil) }
it 'returns nil' do
expect(r... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/request_service/response_spec.rb | spec/lib/html2rss/request_service/response_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::RequestService::Response do
subject(:instance) { described_class.new(body:, headers:, url: Html2rss::Url.from_relative('https://example.com', 'https://example.com')) }
describe '#headers' do
subject(:returned_headers) { instance.hea... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/request_service/context_spec.rb | spec/lib/html2rss/request_service/context_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::RequestService::Context do
describe '#initialize' do
subject(:instance) { described_class.new(url:, headers:) }
let(:url) { 'http://www.example.com' }
let(:headers) { {} }
context 'with a valid URL (String)' do
it '... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/request_service/strategy_spec.rb | spec/lib/html2rss/request_service/strategy_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::RequestService::Strategy do
subject(:instance) { described_class.new(ctx) }
let(:ctx) { Html2rss::RequestService::Context.new(url: 'https://example.com') }
describe '#execute' do
it do
expect { instance.execute }.to raise_e... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/request_service/browserless_strategy_spec.rb | spec/lib/html2rss/request_service/browserless_strategy_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'climate_control'
RSpec.describe Html2rss::RequestService::BrowserlessStrategy do
subject(:instance) { described_class.new(ctx) }
let(:ctx) { Html2rss::RequestService::Context.new(url: 'https://example.com') }
describe '#execute' do
let(:response... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/request_service/puppet_commander_spec.rb | spec/lib/html2rss/request_service/puppet_commander_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'puppeteer'
RSpec.describe Html2rss::RequestService::PuppetCommander do
let(:ctx) do
instance_double(Html2rss::RequestService::Context,
url: Html2rss::Url.from_relative('https://example.com', 'https://example.com'),
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/extractors_spec.rb | spec/lib/html2rss/selectors/extractors_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::Extractors do
describe '.get(attribute_options, xml)' do
context 'with valid extractor name' do
it do
expect(described_class.get({ extractor: 'static' }, nil)).to be_nil
end
end
end
end
| ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors_spec.rb | spec/lib/html2rss/selectors/post_processors_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::PostProcessors do
describe '::NAME_TO_CLASS' do
specify(:aggregate_failures) do
expect(described_class::NAME_TO_CLASS).to be_a(Hash)
expect(described_class::NAME_TO_CLASS).to include(
:gsub, :html_to_markdown, :markdown_to_html... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/object_to_xml_converter_spec.rb | spec/lib/html2rss/selectors/object_to_xml_converter_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::ObjectToXmlConverter do
describe '.call' do
context 'with object being an object' do
let(:object) { { 'data' => [{ 'title' => 'Headline', 'url' => 'https://example.com' }] } }
let(:xml) do
'<object><data><array><object><title>H... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/config_spec.rb | spec/lib/html2rss/selectors/config_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::Selectors::Config do
subject(:result) { described_class.call(config) }
let(:config) do
{}
end
describe 'Items' do
let(:config) do
{ items: { selector: '.article' } }
end
it { is_expected.to be_success }
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/extractors/static_spec.rb | spec/lib/html2rss/selectors/extractors/static_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::Extractors::Static do
subject { described_class.new(nil, options).get }
let(:options) { instance_double(Struct::StaticOptions, static: 'Foobar') }
it { is_expected.to eq 'Foobar' }
end
| ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/extractors/text_spec.rb | spec/lib/html2rss/selectors/extractors/text_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::Extractors::Text do
subject { described_class.new(xml, options).get }
let(:xml) { Nokogiri.HTML('<p>Lorem <b>ipsum</b> dolor ...</p>') }
let(:options) { instance_double(Struct::TextOptions, 'selector' => 'p') }
it { is_expected.to eq 'Lorem ip... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/extractors/html_spec.rb | spec/lib/html2rss/selectors/extractors/html_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::Extractors::Html do
subject { described_class.new(xml, options).get }
let(:xml) { Nokogiri.HTML('<p>Lorem <b>ipsum</b> dolor ...</p>') }
let(:options) { instance_double(Struct::HtmlOptions, selector: 'p') }
it { is_expected.to eq '<p>Lorem <b>... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/extractors/attribute_spec.rb | spec/lib/html2rss/selectors/extractors/attribute_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::Extractors::Attribute do
subject { described_class.new(xml, options).get }
let(:xml) { Nokogiri.HTML('<div><time datetime="2019-07-01">...</time></div>') }
let(:options) { instance_double(Struct::AttributeOptions, selector: 'time', attribute: 'da... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/extractors/href_spec.rb | spec/lib/html2rss/selectors/extractors/href_spec.rb | # frozen_string_literal: true
require 'nokogiri'
RSpec.describe Html2rss::Selectors::Extractors::Href do
subject { described_class.new(xml, options).get }
let(:channel) { { url: 'https://example.com' } }
let(:options) { instance_double(Struct::HrefOptions, selector: 'a', channel:) }
context 'with relative h... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/sanitize_html_spec.rb | spec/lib/html2rss/selectors/post_processors/sanitize_html_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::PostProcessors::SanitizeHtml do
it { expect(described_class).to be < Html2rss::Selectors::PostProcessors::Base }
describe '#get' do
subject { described_class.new(html, config:).get }
let(:config) do
{
channel: { title: 'Examp... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/gsub_spec.rb | spec/lib/html2rss/selectors/post_processors/gsub_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::PostProcessors::Gsub do
it { expect(described_class).to be < Html2rss::Selectors::PostProcessors::Base }
context 'with args validation' do
context 'without pattern option' do
it do
expect do
described_class.new('hello',
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/parse_uri_spec.rb | spec/lib/html2rss/selectors/post_processors/parse_uri_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::PostProcessors::ParseUri do
subject do
described_class.new(url, context).get
end
let(:context) do
Html2rss::Selectors::Context.new(
config: { channel: { url: 'http://example.com' } }
)
end
it { expect(described_class).to be... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/parse_time_spec.rb | spec/lib/html2rss/selectors/post_processors/parse_time_spec.rb | # frozen_string_literal: true
require 'tzinfo'
RSpec.describe Html2rss::Selectors::PostProcessors::ParseTime do
it { expect(described_class).to be < Html2rss::Selectors::PostProcessors::Base }
context 'with known time_zone' do
{
'America/New_York' => 'Mon, 01 Jul 2019 12:00:00 -0400',
'Europe/Lon... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/markdown_to_html_spec.rb | spec/lib/html2rss/selectors/post_processors/markdown_to_html_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::PostProcessors::MarkdownToHtml do
subject { described_class.new(markdown, config:).get }
let(:html) do
['<h1>Section</h1>',
'<p>Price: 12.34</p>',
'<ul>',
'<li>Item 1</li>',
'<li>Item 2</li>',
'</ul>',
"<p><code>pu... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/html_to_markdown_spec.rb | spec/lib/html2rss/selectors/post_processors/html_to_markdown_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::PostProcessors::HtmlToMarkdown do
subject { described_class.new(html, config:).get }
let(:markdown) do
[
"# Very interesting\n Breaking news: I'm a deprecated tag \n ",
'[](https... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/base_spec.rb | spec/lib/html2rss/selectors/post_processors/base_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::PostProcessors::Base do
subject(:instance) { described_class.new(value, context) }
let(:value) { 'test' }
describe '.expect_options' do
let(:context) { Html2rss::Selectors::Context.new({ options: { key1: 'value1', key2: 'value2' } }) }
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/template_spec.rb | spec/lib/html2rss/selectors/post_processors/template_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::PostProcessors::Template do
subject { described_class.new('Hi', options:, item:, scraper:).get }
let(:item) { Object.new }
let(:scraper) { instance_double(Html2rss::Selectors) }
before do
allow(scraper).to receive(:select).with(:name, item... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/substring_spec.rb | spec/lib/html2rss/selectors/post_processors/substring_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::Selectors::PostProcessors::Substring do
it { expect(described_class).to be < Html2rss::Selectors::PostProcessors::Base }
context 'with end' do
subject { described_class.new('Foo bar and baz', options: { start: 4, end: 6 }).get }
it { is_expected.to e... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/selectors/post_processors/html_transformers/wrap_img_in_a_spec.rb | spec/lib/html2rss/selectors/post_processors/html_transformers/wrap_img_in_a_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::Selectors::PostProcessors::HtmlTransformers::WrapImgInA do
subject(:transformer) { described_class.new }
describe '#call' do
subject(:call) { transformer.call(node_name:, node:) }
let(:node_name) { 'img' }
let(:node) { Noko... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/rss_builder/article_spec.rb | spec/lib/html2rss/rss_builder/article_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::RssBuilder::Article do
subject(:instance) { described_class.new(**options) }
let(:options) { { title: 'Sample instance', url: 'http://example.com', description: 'By John Doe' } }
describe '#initialize' do
it 'stores the options as a hash' do
expe... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/rss_builder/enclosure_spec.rb | spec/lib/html2rss/rss_builder/enclosure_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::RssBuilder::Enclosure do
describe '.guess_content_type_from_url(url)' do
{
'https://example.com/image.jpg' => 'image/jpeg',
'https://example.com/image.png' => 'image/png',
'https://example.com/image.gif' => 'image/gif... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/rss_builder/stylesheet_spec.rb | spec/lib/html2rss/rss_builder/stylesheet_spec.rb | # frozen_string_literal: true
RSpec.describe Html2rss::RssBuilder::Stylesheet do
let(:rss_maker) { RSS::Maker::RSS20.new }
let(:stylesheet_config) do
described_class.new(
href: 'http://example.com/style.css',
type: 'text/css',
media: 'all'
)
end
describe '.add' do
it 'adds styles... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/rss_builder/channel_spec.rb | spec/lib/html2rss/rss_builder/channel_spec.rb | # frozen_string_literal: true
require 'timecop'
RSpec.describe Html2rss::RssBuilder::Channel do
subject(:instance) { described_class.new(response, overrides:) }
let(:overrides) { {} }
let(:response) { build_response(body:, headers:, url:) }
let(:body) { '' }
let(:headers) { default_headers }
let(:url) { ... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/config/dynamic_params_spec.rb | spec/lib/html2rss/config/dynamic_params_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::Config::DynamicParams do
describe '.call' do
let(:params) { { 'name' => 'John', 'age' => '30' } }
context 'when value is a String' do
it 'replaces format string with given params' do
value = 'Hello, %<name>s. You are... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/config/request_headers_spec.rb | spec/lib/html2rss/config/request_headers_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Html2rss::Config::RequestHeaders do
subject(:normalized) do
described_class.normalize(headers, channel_language:, url:)
end
let(:headers) { {} }
let(:channel_language) { 'de-DE' }
let(:url) { 'https://example.com/feed' }
describe '.b... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/html_extractor/enclosure_extractor_spec.rb | spec/lib/html2rss/html_extractor/enclosure_extractor_spec.rb | # frozen_string_literal: true
require 'nokogiri'
RSpec.describe Html2rss::HtmlExtractor::EnclosureExtractor do
describe '.call' do
subject(:enclosures) { described_class.call(article_tag, base_url) }
let(:base_url) { 'http://example.com' }
# Helper method to create article tag from HTML
def articl... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/spec/lib/html2rss/html_extractor/image_extractor_spec.rb | spec/lib/html2rss/html_extractor/image_extractor_spec.rb | # frozen_string_literal: true
require 'nokogiri'
RSpec.describe Html2rss::HtmlExtractor::ImageExtractor do
let(:article_tag) { Nokogiri::HTML.fragment(html) }
describe '.call' do
subject(:url) { described_class.call(article_tag, base_url: 'https://example.com').to_s.encode('UTF-8') }
let(:html) do
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/lib/html2rss.rb | lib/html2rss.rb | # frozen_string_literal: true
require 'zeitwerk'
loader = Zeitwerk::Loader.for_gem
loader.inflector.inflect('cli' => 'CLI')
loader.setup
require 'logger'
##
# The Html2rss namespace.
module Html2rss
##
# The logger instance.
Log = Logger.new($stdout)
Log.level = ENV.fetch('LOG_LEVEL', :warn).upcase.to_sym
... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/lib/html2rss/request_service.rb | lib/html2rss/request_service.rb | # frozen_string_literal: true
require 'singleton'
require 'forwardable'
module Html2rss
##
# Requests website URLs to retrieve their HTML for further processing.
# Provides strategies, e.g. integrating Browserless.io.
class RequestService
include Singleton
class UnknownStrategy < Html2rss::Error; end... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/lib/html2rss/html_extractor.rb | lib/html2rss/html_extractor.rb | # frozen_string_literal: true
module Html2rss
##
# HtmlExtractor is responsible for extracting details (headline, url, images, etc.)
# from an article_tag.
class HtmlExtractor
INVISIBLE_CONTENT_TAGS = %w[svg script noscript style template].to_set.freeze
HEADING_TAGS = %w[h1 h2 h3 h4 h5 h6].freeze
N... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/lib/html2rss/category_extractor.rb | lib/html2rss/category_extractor.rb | # frozen_string_literal: true
module Html2rss
##
# CategoryExtractor is responsible for extracting categories from HTML elements
# by looking for CSS class names containing common category-related terms.
class CategoryExtractor
# Common category-related terms to look for in class names
CATEGORY_TERMS =... | ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
html2rss/html2rss | https://github.com/html2rss/html2rss/blob/400e796540e82a69e1f1e014b6f89c626acf32fd/lib/html2rss/version.rb | lib/html2rss/version.rb | # frozen_string_literal: true
##
# The Html2rss namespace.
module Html2rss
VERSION = '0.17.0'
public_constant :VERSION
end
| ruby | MIT | 400e796540e82a69e1f1e014b6f89c626acf32fd | 2026-01-04T17:45:12.820049Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.