From 5811cd8eea8ec4914557c24823995d2b6b397046 Mon Sep 17 00:00:00 2001 From: Sam Livingston-Gray Date: Tue, 5 Mar 2024 09:23:56 -0800 Subject: [PATCH] whitespace --- lib/approvals/combination_approvals.rb | 48 ++++++++++++-------------- notes/how_to_publish.md | 21 +++++------ spec/combination_approvals_spec.rb | 13 ++++--- todo.md | 4 +-- 4 files changed, 40 insertions(+), 46 deletions(-) diff --git a/lib/approvals/combination_approvals.rb b/lib/approvals/combination_approvals.rb index c02ac58..d06c5e1 100644 --- a/lib/approvals/combination_approvals.rb +++ b/lib/approvals/combination_approvals.rb @@ -1,31 +1,29 @@ class CombinationApprovals - def self.verify_all_combinations(*arg_variations, namer:) - combo = new() - arg_variations.each do |list| - combo.arg(list) - end - - output = "" - combo.all_combinations.each do |args| - begin - result = yield *args - rescue StandardError => exception - result = "#{exception.inspect}" - end - output << "#{args} => #{result}\n" - end - Approvals.verify(output, namer: namer) - end - - def arg(values) - @args ||= [] - @args << values + def self.verify_all_combinations(*arg_variations, namer:) + combo = new() + arg_variations.each do |list| + combo.arg(list) end - def all_combinations() - first, *rest = *@args - first.product(*rest) + output = "" + combo.all_combinations.each do |args| + begin + result = yield *args + rescue StandardError => exception + result = "#{exception.inspect}" + end + output << "#{args} => #{result}\n" end + Approvals.verify(output, namer: namer) + end + def arg(values) + @args ||= [] + @args << values + end -end \ No newline at end of file + def all_combinations() + first, *rest = *@args + first.product(*rest) + end +end diff --git a/notes/how_to_publish.md b/notes/how_to_publish.md index 54e287b..a52eafc 100644 --- a/notes/how_to_publish.md +++ b/notes/how_to_publish.md @@ -1,16 +1,13 @@ # Publish ## Prereqs -- [ ] `brew install rbenv ruby-build` +- [ ] `brew install rbenv ruby-build` This installs [rbenv](https://github.com/rbenv/rbenv) -- [ ] `brew install openssl` -- [ ] `eval "$(rbenv init - zsh)"` +- [ ] `brew install openssl` +- [ ] `eval "$(rbenv init - zsh)"` **note:** this command will diff based on the shell. run `rbenv init` to find - - [ ] `RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl@3/3.0.3 rbenv install 3.1.2` - **note:** this path comes from - `brew info openssl` - ruby version comes from - `rbenv install -l` -## Build - - - + - [ ] `RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl@3/3.0.3 rbenv install 3.1.2` + **note:** this path comes from + `brew info openssl` + ruby version comes from + `rbenv install -l` +## Build diff --git a/spec/combination_approvals_spec.rb b/spec/combination_approvals_spec.rb index 9a48e23..378c0bb 100644 --- a/spec/combination_approvals_spec.rb +++ b/spec/combination_approvals_spec.rb @@ -6,28 +6,27 @@ def some_function(a1,b1,c1) "#{b1+c1} #{a1}s" end - + let(:namer) { |example| Approvals::Namers::RSpecNamer.new(example) } - specify "2 combos" do + specify "2 combos" do a = ["foo", "bar"] b = [1,3,5] c = [2,4] - CombinationApprovals.verify_all_combinations(a,b, c, namer:namer) do |a1,b1, c1| + CombinationApprovals.verify_all_combinations(a,b, c, namer:namer) do |a1,b1, c1| "#{b1+c1} #{a1}s" end CombinationApprovals.verify_all_combinations(a,b, c,namer:namer, &method(:some_function)) - end - specify "errors" do + + specify "errors" do a = ["foo", "bar"] b = [0,1,2] - CombinationApprovals.verify_all_combinations(a,b, namer:namer) do |a1,b1| + CombinationApprovals.verify_all_combinations(a,b, namer:namer) do |a1,b1| if b1 == 2 raise "There is no 2" end "#{b1} #{a1}s" end - end end diff --git a/todo.md b/todo.md index 6dcb0a4..b47bd0f 100644 --- a/todo.md +++ b/todo.md @@ -6,5 +6,5 @@ 2. check pending tests 3. check issues & pull requests -4. Update dependencies -5. +4. Update dependencies +5.