Skip to content

Commit

Permalink
whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
geeksam committed Mar 5, 2024
1 parent 7b9a6e3 commit 5811cd8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 46 deletions.
48 changes: 23 additions & 25 deletions lib/approvals/combination_approvals.rb
Original file line number Diff line number Diff line change
@@ -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
def all_combinations()
first, *rest = *@args
first.product(*rest)
end
end
21 changes: 9 additions & 12 deletions notes/how_to_publish.md
Original file line number Diff line number Diff line change
@@ -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
13 changes: 6 additions & 7 deletions spec/combination_approvals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

2. check pending tests
3. check issues & pull requests
4. Update dependencies
5.
4. Update dependencies
5.

0 comments on commit 5811cd8

Please sign in to comment.