adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.3, 2.7.5, 2.6.9: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
jmcgnh has joined #ruby
<apple-corps> That looks like it worked. I'm in ok shape. I'm not sure why it seems like many of the plugins are missing but I'm trying to add those now
<weaksauce> solid
hololeap has joined #ruby
hololeap_ has quit [Ping timeout: 276 seconds]
random-jellyfish has quit [Ping timeout: 256 seconds]
nat_of_cy has quit [Remote host closed the connection]
ivzhh has quit [Quit: WeeChat 2.8]
taupiqueur has quit [Ping timeout: 265 seconds]
<apple-corps> So we have a sort of functional development environment! woo hoo! I'm now going to try to get a handle on understanding the testing framework. For example I posted the test https://discuss.elastic.co/t/testing-aggregates-logstash-aggregate-plugin-more-than-one-filter-which-defines-timeout-options-but-only-defining-once/289644 and I think I have a
<apple-corps> lack of understanding the logstash dev-utils. So I might get some help trying pry or another debugger
vit has quit [Ping timeout: 245 seconds]
ivzhh has joined #ruby
graywolf has quit [Quit: WeeChat 3.3]
jhawthorn_ has quit [Quit: ZNC 1.8.2 - https://znc.in]
jhawthorn has joined #ruby
<nakilon> ox1eef what I've seen materialize is amount of time spent on fixing it in legacy code at my job; all this spagetti of requiring files with no relation to runtime process access workflows produces tons of complex errors
m_antis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<nakilon> weird that when I have a local gem version specified in Gemfile as path: "...", then when I do "bundle exec ruby -rthat_gem" it goes insane and requires it not from the specified path but from some default installed locaton and then versions mismatch and it crash
<nakilon> but when I replace '-rsome_gem -e "..."' with -e 'require "some_gem"; ...' it does not go mad and works fine
<nakilon> by "crash" I mean it somehow requires the gem twice from different locations, throws warning and then fails to redefine the VERSION; maybe it's all just because the gem I use has such weird stuff as lin/some-gem.rb: require "some_gem" though, idk
<apple-corps> I'm trying to understand this ruby method https://github.com/elastic/logstash-devutils/blob/master/lib/logstash/devutils/rspec/logstash_helpers.rb#L67 in the context of the invocation   sample("message" => message, "type" => "nginx") found https://gquintana.github.io/2016/09/07/Testing-Logstash-configuration.html
<apple-corps> Looking at the method signature:   def sample(sample_event, validation_source: :output, &block)
<apple-corps> I would assume that the invocation: sample("message" => message, "type" => "nginx") do... calls the sample method with the sample event  set to "message"=>message
justBOOMER is now known as justache
<apple-corps> and I assume the do .. from the invocation https://gquintana.github.io/2016/09/07/Testing-Logstash-configuration.html is the &block from the signature
<apple-corps> But what I don't understand, how is the hash type passed and how do i see that reflected in the method signature
<apple-corps> I'm also not familiar with that  validation_source: :output syntax. Can one of the great ruby wizards elucidate me?
<sam113101> it's the same as :validation_source => :output
<apple-corps> sam113101 afraid I don't follow. Is that how you define hash parameters for a method in ruby?
<sam113101> no, it's just sugar for hashes with symbols as keys
<sam113101> you can use that syntax anywhere
<sam113101> anywhere you would want a hash with symbols as keys
<apple-corps>   def sample(sample_event, validation_source: :output, &block)
<apple-corps> Yeah so the signature above I see 3 parameters. sample_event, validation_source: :output, &block
<apple-corps> so the second parameter ``` validation_source: :output parameter ``` does that syntax mean that parameter accepts a hash or key => value pair?
<sam113101> actually wait
<apple-corps> guess I could try to use a ruby shell and see...
<sam113101> man my ruby is rusty
<sam113101> turns out that they are indeed keyword arguments
<apple-corps> It's a little strange then when you look at the invocation, but maybe the signature changed or the author has a sense of humor
<apple-corps> sample("message" => message, "type" => "nginx") do...
<sam113101> in my days you didn't have those, you used hashes instead, but you could still write the hashes without their {}'s if they were the last argument to the function
<apple-corps> because it looks like sample event is "message"=>message
<apple-corps> validation source is "type"=> "nginx"
<apple-corps> and then I think the block is everything in the do ....
<apple-corps> But still not sure if I'm reading it right
<apple-corps> Do you think I am correct about these/
<apple-corps> ?
<sam113101> no
<sam113101> sample("message" => message, "type" => "nginx") is the same as sample({"message" => message, "type" => "nginx"})
<sam113101> so inside the function sample_event will be {"message" => message, "type" => "nginx"}
<sam113101> :validation_source will be :output because it's the default and you're not changing it
<apple-corps> so is :output the syntax you use to set a default value ?
<apple-corps> Trying to understand that second parameter now that we understand the first one
<apple-corps> IE what is validation_source: :output
<sam113101> 'validation_source:' is a keyword argument, ':output' is its default value, which happens to be a symbol (starts with a :)
<sam113101> you could have a string, integer, array, anything
<sam113101> def test(a: "hello"); puts a; end
<apple-corps> so is that how keyword arguments work, you can provide a default value like that. So they could have put validation_source: "candy" and it's default value would be the string candy?
<sam113101> sorry if I'm slow, I started using ruby in 2011 I think and I've only used it infrequently, I'm out of the loop on everything, keyword arguments are still new to me but it seems like they've been here for a gigantic while, I don't know what happened lol
<apple-corps> I think what I just said to some degree you are showing
<apple-corps> in your function. So I digress.
<apple-corps> So think I understand the function now. I assume I was right that the block refers to the block of code between do..end
<apple-corps> &block that is
<sam113101> yeah, you provide a default value that way, and when you don't then you don't have to provide a value at all, they're not required when calling the function, but you can make them required by setting no default value
<sam113101> def test(a: 0); puts a; end
<sam113101> you can call test without any argument, test() for example
<sam113101> and a will be 0
<sam113101> but if you do
<sam113101> def test(a:); puts a; end
<sam113101> if you call it without argument, i.e. test(), it will complain
<sam113101> in my days we would use options hashes to accomplish more or less the same thing, and we had to check those things manually
<sam113101> and yes &block will be the block
<apple-corps> I'm trying to call that sample to test a logstash config
<apple-corps> I keep passing the test in every execution, totally bogus
<apple-corps> Except if I connect a debugger, then the test always fails which makes it difficult to debug
<apple-corps> Seems like if I invoke the logger on subject.get("key") then I get a ConfigurationError. But it's just happy passing tests with the insist ... in the block whether insist / reject is true false :(
jpw has joined #ruby
<apple-corps>   Then it looks like the insist / reject blocks just don't execute. When I put an expect or any code that does something I get a strange logstash configuration error.
Rounin has quit [Ping timeout: 256 seconds]
lunarkitty has joined #ruby
nat_of_cy has joined #ruby
jetchisel has quit [Ping timeout: 268 seconds]
random-jellyfish has joined #ruby
fercell has quit [Ping timeout: 245 seconds]
fercell has joined #ruby
tkonto has joined #ruby
vit has joined #ruby
vit has quit [Client Quit]
jetchisel has joined #ruby
teclator has joined #ruby
pandabot has quit [Quit: learn aoc code]
tkonto has quit [Ping timeout: 265 seconds]
lunarkitty has quit [Quit: Connection closed for inactivity]
random-jellyfish has quit [Ping timeout: 256 seconds]
taupiqueur has joined #ruby
random-jellyfish has joined #ruby
taupiqueur has quit [Ping timeout: 265 seconds]
taupiqueur has joined #ruby
taupiqueur has quit [Quit: taupiqueur]
taupiqueur has joined #ruby
_ht has joined #ruby
jpw has quit [Remote host closed the connection]
reset has quit [Quit: reset]
ua_ has quit [Ping timeout: 260 seconds]
hololeap_ has joined #ruby
hololeap has quit [Ping timeout: 276 seconds]
fef has joined #ruby
hololeap_ has quit [Remote host closed the connection]
hololeap_ has joined #ruby
ua_ has joined #ruby
pandabot has joined #ruby
pandabot has quit [Client Quit]
pandabot has joined #ruby
random-jellyfish has quit [Ping timeout: 256 seconds]
fef has quit [Remote host closed the connection]
fef has joined #ruby
dohtem has quit [Quit: Connection closed for inactivity]
jetchisel has quit [Ping timeout: 245 seconds]
_ht_ has joined #ruby
_ht has quit [Ping timeout: 265 seconds]
m_antis has joined #ruby
Rounin has joined #ruby
m_antis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
m_antis has joined #ruby
gfawcett- has joined #ruby
m_antis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gfawcett- has quit [Ping timeout: 265 seconds]
roadie has joined #ruby
hololeap_ is now known as hololeap
_ht_ has quit [Ping timeout: 240 seconds]
_ht has joined #ruby
bandithijo has joined #ruby
m_antis has joined #ruby
dohtem has joined #ruby
random-jellyfish has joined #ruby
m_antis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bandithijo has quit [Ping timeout: 256 seconds]
jpw has joined #ruby
Inline has quit [Ping timeout: 268 seconds]
m_antis has joined #ruby
roadie has quit [Ping timeout: 265 seconds]
grenierm has quit [Quit: grenierm]
grenierm has joined #ruby
grenierm has quit [Client Quit]
fef has quit [Quit: Leaving]
yxhuvud has quit [Read error: Connection reset by peer]
roadie has joined #ruby
m_antis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yxhuvud has joined #ruby
roadie has quit [Ping timeout: 265 seconds]
roadie has joined #ruby
m_antis has joined #ruby
roadie has quit [Ping timeout: 245 seconds]
Al2O3 has quit [Ping timeout: 260 seconds]
Inline has joined #ruby
Al2O3 has joined #ruby
roadie has joined #ruby
<libsys> hello people
<libsys> I'm testing with minitest... how could I scope a setup function while using assert style?
<libsys> like when using the spec syntax one does with describe
<libsys> or I should simply create a funciton, call it on each test which uses it and be done with that
glider_ is now known as glider
roadie has quit [Ping timeout: 265 seconds]
roadie has joined #ruby
ur5us has joined #ruby
tkonto has joined #ruby
roadie` has joined #ruby
tkonto has quit [Quit: tkonto]
jpw has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 265 seconds]
roadie` has quit [Ping timeout: 265 seconds]
darkxploit has quit [Remote host closed the connection]
roadie` has joined #ruby
<libsys> also, how could I mock `Rack::Response.new(content).finish`? I call this function inside a method and I'd like to not depend on the actual implementation of that
<libsys> I could simply monkey patch the function, but that affects my other non-related tests
<ox1eef> libsys: my recommendation would be to use rspec.
<libsys> bruh, I'd like to stick to my current test suite xd
<libsys> I've already done some tests
<ox1eef> :)
<ox1eef> fair enough, but it is so easy to solve that mocking issue you had with rspec. with minitest - i'm not sure, been a long, long time since i tried it.
dohtem has quit [Quit: Connection closed for inactivity]
reset has joined #ruby
vigumnov has quit [Quit: ZNC 1.8.2 - https://znc.in]
roadie` has quit [Remote host closed the connection]
roadie` has joined #ruby
roadie` has quit [Ping timeout: 250 seconds]
victori has joined #ruby
nat_of_cy has quit [Remote host closed the connection]
_ht has quit [Remote host closed the connection]
roadie` has joined #ruby
roadie` has quit [Ping timeout: 265 seconds]
roadie` has joined #ruby
roadie` has quit [Ping timeout: 265 seconds]
m_antis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bandithijo has joined #ruby
roadie` has joined #ruby
KramerC has quit [Ping timeout: 268 seconds]
KramerC has joined #ruby
BSaboia has joined #ruby
FetidToot8 has joined #ruby
FetidToot has quit [Ping timeout: 256 seconds]
FetidToot8 is now known as FetidToot
taupiqueur has quit [Remote host closed the connection]
taupiqueur_ has joined #ruby
FetidToot3 has joined #ruby
m_antis has joined #ruby
FetidToot has quit [Ping timeout: 256 seconds]
FetidToot3 is now known as FetidToot
taupiqueur has joined #ruby
taupiqueur_ has quit [Ping timeout: 265 seconds]
roadie` has quit [Ping timeout: 265 seconds]
vit has joined #ruby
dohtem has joined #ruby
vit is now known as Guest6777
Guest6777 has quit [Client Quit]
vit has joined #ruby
vit is now known as Guest8270
roadie` has joined #ruby
roadie` has quit [Ping timeout: 268 seconds]
Inline has quit [Remote host closed the connection]
roadie` has joined #ruby
taupiqueur_ has joined #ruby
taupiqueur has quit [Ping timeout: 265 seconds]
roadie` has quit [Ping timeout: 265 seconds]
taupiqueur_ has quit [Remote host closed the connection]
taupiqueur has joined #ruby
bandithijo has quit [Ping timeout: 245 seconds]
Guest8270 has quit [Ping timeout: 265 seconds]
roadie` has joined #ruby
roadie` has quit [Ping timeout: 265 seconds]
taupiqueur has quit [Ping timeout: 265 seconds]
taupiqueur has joined #ruby
bandithijo has joined #ruby
taupiqueur has quit [Ping timeout: 268 seconds]
taupiqueur has joined #ruby
e2 has quit [Quit: Stable ZNC provider #bnc4you]
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
jetchisel has joined #ruby
pwnd_sfw has quit [Quit: Ping timeout (120 seconds)]
pwnd_sfw has joined #ruby