From 6f5097f1885179196ea56d97fe1fcdd2c027b096 Mon Sep 17 00:00:00 2001 From: revonetworx Date: Thu, 12 Jun 2025 18:49:20 +0000 Subject: [PATCH 1/7] Start draft PR From ff1c570f79867e292579bea702c7c04aeffc3b78 Mon Sep 17 00:00:00 2001 From: revonetworx Date: Thu, 12 Jun 2025 18:49:51 +0000 Subject: [PATCH 2/7] Add comprehensive .gitignore --- .gitignore | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 76a0bf1..e97cbc1 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,52 @@ -_site -.sass-cache +# Ruby specific +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +# Bundler specific Gemfile.lock +.bundle/ +vendor/bundle + +# Jekyll specific +_site/ +.sass-cache/ +.jekyll-metadata +.jekyll-cache/ + +# Dependency directories +node_modules/ +jspm_packages/ + +# Environment variables +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor/IDE files +.idea/ +.vscode/ +*.swp +*.swo +*~ + +# System files +.DS_Store +Thumbs.db \ No newline at end of file From 192db2ed9fd69f87efbefc31b6e60a8d38ec9254 Mon Sep 17 00:00:00 2001 From: revonetworx Date: Thu, 12 Jun 2025 18:49:58 +0000 Subject: [PATCH 3/7] Create author metadata validation script --- src/author_validator.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/author_validator.rb diff --git a/src/author_validator.rb b/src/author_validator.rb new file mode 100644 index 0000000..6bf40f0 --- /dev/null +++ b/src/author_validator.rb @@ -0,0 +1,12 @@ +class AuthorValidator + MAX_NAME_LENGTH = 100 + + def self.validate(author) + return false if author.nil? || author.strip.empty? + return false if author.length > MAX_NAME_LENGTH + + # Optional: Additional validation rules can be added here + # For example, validate allowed characters, no special rules for now + true + end +end \ No newline at end of file From 97971d0957030dad4ef6237bb3979ac2afc217a0 Mon Sep 17 00:00:00 2001 From: revonetworx Date: Thu, 12 Jun 2025 18:50:12 +0000 Subject: [PATCH 4/7] Add tests for author validator --- test/author_validator_spec.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/author_validator_spec.rb diff --git a/test/author_validator_spec.rb b/test/author_validator_spec.rb new file mode 100644 index 0000000..b5fd44a --- /dev/null +++ b/test/author_validator_spec.rb @@ -0,0 +1,35 @@ +require_relative '../src/author_validator' + +RSpec.describe AuthorValidator do + describe '.validate' do + context 'when author is valid' do + it 'returns true for a standard name' do + expect(AuthorValidator.validate('John Doe')).to be true + end + + it 'returns true for a name at max length' do + long_name = 'a' * 100 + expect(AuthorValidator.validate(long_name)).to be true + end + end + + context 'when author is invalid' do + it 'returns false for nil author' do + expect(AuthorValidator.validate(nil)).to be false + end + + it 'returns false for empty string' do + expect(AuthorValidator.validate(''))).to be false + end + + it 'returns false for whitespace-only string' do + expect(AuthorValidator.validate(' ')).to be false + end + + it 'returns false for name exceeding max length' do + long_name = 'a' * 101 + expect(AuthorValidator.validate(long_name)).to be false + end + end + end +end \ No newline at end of file From 53057d367193f977308cddb7a265d9abe334144d Mon Sep 17 00:00:00 2001 From: revonetworx Date: Thu, 12 Jun 2025 18:50:18 +0000 Subject: [PATCH 5/7] Add Gemfile with RSpec dependency --- Gemfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index ded3333..18fbb16 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ -source "https://rubygems.org" +source 'https://rubygems.org' -gem "github-pages", ">= 25" -gem 'webrick' -gem 'csv' \ No newline at end of file +group :development, :test do + gem 'rspec', '~> 3.12' +end \ No newline at end of file From 17d09b2dc08ff4a214ce59521b7c14c2f2c9eb55 Mon Sep 17 00:00:00 2001 From: revonetworx Date: Thu, 12 Jun 2025 18:50:34 +0000 Subject: [PATCH 6/7] Add RSpec configuration --- .rspec | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .rspec diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..5255835 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--color +--format documentation +--require spec_helper \ No newline at end of file From 1caa489706a040f379b7bf7d5f6f4011b9a34d0d Mon Sep 17 00:00:00 2001 From: revonetworx Date: Thu, 12 Jun 2025 18:50:45 +0000 Subject: [PATCH 7/7] Add RSpec spec_helper configuration --- spec/spec_helper.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 spec/spec_helper.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..81a3a69 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,11 @@ +RSpec.configure do |config| + config.expect_with :rspec do |expectations| + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + config.mock_with :rspec do |mocks| + mocks.verify_partial_doubles = true + end + + config.shared_context_metadata_behavior = :apply_to_host_groups +end \ No newline at end of file