<adam12>
With Sequel, I usually open a transaction around the test that always rolls back.
<adam12>
I've used "fixtures" in the last, but lately I just make an `Examples` namespace inside the object and some simple setup code there.
<adam12>
So I might `User::Example.active` which returns an instance of User, or `User::Example.admin`. etc.
<adam12>
It's nice that they are usable outside of the test too, such as if I'm futzing around at the console.
jenrzzz has joined #ruby
otisolsen70_ has quit [Read error: Connection reset by peer]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 255 seconds]
crivic is now known as crivic-away
crivic-away has quit [Quit: crivic was here]
osc4rpt has quit [Remote host closed the connection]
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
osc4rpt has joined #ruby
<adam12>
$ sudo zfs list -o compressratio -H tank/gemdocs/yard
<adam12>
5.50x
<adam12>
It's beautiful.
jenrzzz_ has joined #ruby
polishdub has joined #ruby
jenrzzz_ has quit [Ping timeout: 255 seconds]
szkl has quit [Quit: Connection closed for inactivity]
Pixi__ has joined #ruby
Pixi` has quit [Ping timeout: 255 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
jenrzzz_ has joined #ruby
___nick___ has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
osc4rpt has quit [Ping timeout: 255 seconds]
___nick___ has quit [Client Quit]
osc4rpt has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 272 seconds]
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
osc4rpt has quit [Ping timeout: 260 seconds]
osc4rpt has joined #ruby
jenrzzz_ has joined #ruby
<rapha>
[0x1eef_]: it does the job of keeping rails from removing seeds before testing? because its name would kinda like imply the opposite lol
jenrzzz_ has quit [Ping timeout: 255 seconds]
___nick___ has quit [Ping timeout: 264 seconds]
<[0x1eef_]>
IIRC there's a specific setting for that. But I only know it via rspec as: 'global fixtures'. I've found that to be the most problematic. There's implicit state that's not declared in the tests but somewhere else, and you usually have to know that implicit state pretty well. I think it's at odd withs good testing practices.
donofrio has quit [Read error: Connection reset by peer]
donofrio has joined #ruby
_ht has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 264 seconds]
<henk>
rubocop is not happy about the complexity of the function (or method?) in https://git.netwichtig.de/cgit/user/henk/code/ruby/macir.git/tree/macir.rb?h=feature/challenges_per_apex&id=e3a206b8484ef7919053a38e4e6b92492c8a8642#n162 it says "Metrics/AbcSize: Assignment Branch Condition size for wait_for_challenge_on_ns is too high. [<7, 18, 4> 19.72/17]" among other things. I’m unsure what would be a
<henk>
good way to split it up further. it all seems so tightly related. any advice? and if it’s "ignore rubocop, it’s fine in this case"
jenrzzz has joined #ruby
<[0x1eef_]>
rapha: Probably you want to 'fixture :something' in the superclass of your tests. Maybe subclass ActiveSupport::TestCase, and then call the fixture name you want to be ever-present. That's how I understood how 'global fixtures' work in a vanilla Rails environment.
jenrzzz has quit [Ping timeout: 264 seconds]
<[0x1eef_]>
henk: Can you shorten that link?
jenrzzz has joined #ruby
<adam12>
henk: Maybe there's a method in there called `get_one_answer` or something.
<adam12>
or maybe it's called `propogated?`
<rapha>
not using any fixtures [0x1eef_] ... i would have understood if it emptied the DB once you load (a) fixture(s). but it's just doing it anyways. it's alright though, i don't need whatever rails/test_help is offering.
<adam12>
henk: (I'm saying Extract Method for the inside of `loop` that does a singular fetch of something)
<[0x1eef_]>
Don't go against the grain :) It is normal for the database to be tore down and set back up before every test. You can have the equivalent to the seeds. They're known as 'global fixtures' or maybe just fixtures in vanilla Rails.
<rapha>
henk: fwiw i think rubocop is a nazi
<adam12>
I'm not sure if this is a good method to break down tho. Rubocop might be off it's rails a bit.
<henk>
[0x1eef_]: errr, I guess … I heard there are "short url services" but I have never used one. do you have a preferred one?
<adam12>
I'd maybe try running `flog` on it and see if it has the same complaints.
<[0x1eef_]>
Any is good. My screen is small and using urxvt so if it spans across two lines I usually can't open it.
<rapha>
[0x1eef_]: sure, if this wasn't a legacy app with lots of seeds. also, if i didn't intensely dislike the indirection introduced by fixtures.
<[0x1eef_]>
rapha: Fair enough. I'd still try to stay within conventions /best practices as much as I could. The next Rails developer that comes along will probably have a hard time understanding why it works that way.
<henk>
[0x1eef_]: which client?
<[0x1eef_]>
weechat
<henk>
[0x1eef_]: do you know about "raw mode" I think it’s called, by default mapped to meta-l ? works nicely for me for long links.
<henk>
adam12: yeah, I was thinking the same but that singular fetch is only one line anyway, then checking its value is also only 3 lines. so at most I could reduce it by 3 lines AFAICT. is that worth it?
<adam12>
henk: I normally like to "unroll" my loops so I'd be looking to extract method anyways.
nmollerup has joined #ruby
<rapha>
i'm that developer already, [0x1eef_]. right now, anything that lets me get the test coverage up quickly and without much effort, that's a good thing. otherwise the refactoring that needs to happen would just break my neck.
<rapha>
(aside from that i'd agree with you)
<henk>
rapha: yeah, some things are a bit much, seems to me … I’ll figure it out over time (:
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
<rapha>
henk: fwiw i really like standard.rb (which uses rubocop internally). you can't configure it (that's the point), but you can disable everything and then enable things bit by bit, the ones you feel ready for.
<rapha>
btw [0x1eef_] thanks for sharing database cleaner! that'll be a real gem in any non-rails app :)
<adam12>
Could Extract Method the resolver setup too.
<adam12>
Again, this could be a bad metric from Rubocop and would ultimately need a judgement call. Sometimes there's methods that make sense to extract, and sometimes it just makes a call order that is undecipherable.
<henk>
rapha: I had heard about it but it’s not in debian, so I’m not using it d-:
<rapha>
henk: what about gems you really need and which are not in debian? (which, in the case of debian, is an awful lot)
<henk>
adam12: is "Extract Method" something special? some function in some tool?
<henk>
rapha: I’ll deal with that when I have to (; so far I didn’t
Linux_Kerio has quit [Quit: Konversation terminated!]
Linux_Kerio has joined #ruby
jenrzzz has joined #ruby
jenrzzz_ has joined #ruby
Linux_Kerio has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 255 seconds]
<[0x1eef_]>
rapha: I've always used it with Rails. :) Usually with factory_bot. Easy to define associations, and traits for specific states. Your approach makes sense but one day you'll probably want to get closer to being a 'normal' rails application.
jenrzzz_ has quit [Ping timeout: 260 seconds]
<[0x1eef_]>
henk: I haven't heard of that. I'll probably take a look :) I think there could be something I can set in .Xresources as well.
<henk>
[0x1eef_]: not much to "take a look", just press alt-l and see whether that fixes the url (: it’s just toggle, click url, toggle back. at least for me … not perfect but good enough for me and less added complexity and stuff to remember and/or lost screen space than some url bar or whatever …
kerunaru has quit [Quit: Iridium IRC Client]
kerunaru has joined #ruby
<[0x1eef_]>
Ah I see! The URL is still too long to copy. That's the less cool side of 1368x768.