adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.2, 2.7.4, 2.6.8: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
edrx has joined #ruby
MalkbabY has joined #ruby
roshanavand has joined #ruby
roshanavand has quit [Remote host closed the connection]
roshanavand has joined #ruby
roshanavand has quit [Ping timeout: 244 seconds]
gr33n7007h has quit [Ping timeout: 252 seconds]
gr33n7007h has joined #ruby
Pancakes11 has joined #ruby
Pancakes11 has quit [Client Quit]
MalkbabY has quit [Quit: Leaving...]
hsiktas[m] has quit [*.net *.split]
nolesswrong has quit [*.net *.split]
nowaker_ has quit [*.net *.split]
wmoxam_ has quit [*.net *.split]
georgemp has quit [*.net *.split]
leftylink has quit [*.net *.split]
wmoxam has joined #ruby
nolesswrong has joined #ruby
Nowaker has joined #ruby
leftylink has joined #ruby
georgemp has joined #ruby
hsiktas[m] has joined #ruby
jpw_ has quit [Remote host closed the connection]
ur5us has joined #ruby
vit has joined #ruby
ur5us has quit [Ping timeout: 264 seconds]
edrx has left #ruby [Killed buffer]
dostoyevsky2 has quit [Quit: leaving]
dostoyevsky2 has joined #ruby
dostoyevsky2 has quit [Client Quit]
dostoyevsky2 has joined #ruby
goepsilongo has quit [Ping timeout: 245 seconds]
goepsilongo has joined #ruby
Bounga has joined #ruby
gr33n7007h has quit [Quit: WeeChat 3.3]
mahlon has quit [Quit: PotatoTech]
mahlon has joined #ruby
yosafbridge` has quit [Quit: Leaving]
yosafbridge has joined #ruby
Intelo has joined #ruby
<Intelo> While doing integration test for api testing. What is a good way to test? a) make api call inside test code and also directly check (fetch/select) entries in database those were supposed to be created by that api cal. b) in response of real api call, always return json of objects created in database (e.g user created, even if its a GET call and 200
<Intelo> response might have been ok, just to test what was created, I should return what was inserted / updated in database for each api call c) try to check one api with another api (this might not always be possible). e.g test create user api with user profile api. If user was created successfully, then profile api should return correct data. c) any
<Intelo> other?
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #ruby
<nakilon> Intelo I go for C
<nakilon> in my opinion you should do only unit-testing and functional/integration testing, not anything in between
<nakilon> so you use as high level methods as possible, i.e. just use api calls and don't access db at all
<nakilon> on my prevprevious job I had to spend half of the time fixing legacy tests that were not made in that in mind, spent time stupidly on throwing out sql requests, wrongly places procedures of connecting to db, etc.
fandre1986 has joined #ruby
<Intelo> nakilon ok so lets say I am testing a user registration api. It has name, email, address. How will I verify that the user actually got registered and the data was saved in the database?
goepsilongo_ has joined #ruby
goepsilongo has quit [Ping timeout: 252 seconds]
quazimodo has quit [Ping timeout: 258 seconds]
donofrio has quit [Read error: Connection reset by peer]
roadie has joined #ruby
goepsilongo_ has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
goepsilongo has joined #ruby
goepsilongo has quit [Client Quit]
roadie has quit [Ping timeout: 260 seconds]
<nakilon> Intelo try to log in?
BSaboia has joined #ruby
bhaak has quit [Ping timeout: 252 seconds]
roshanavand has joined #ruby
jpw has joined #ruby
crankharder has joined #ruby
<sagax> what you think about this? https://termbin.com/sxk2
<sagax> it's for dot-notation from yaml config file
<adam12> sagax: It looks OK generally, as long as you're not calling preload in a hotpath. Defining methods dynamically clears some caches in the Ruby VM, and in a hotpath it's absolute performance murder.
<adam12> sagax: Instead of defining on `self` (as cls), you could always define them inside a module and include that module too. It might help keep them organized.
jpw has quit [Ping timeout: 260 seconds]
roshanavand has quit [Ping timeout: 260 seconds]
kaleido has quit [Ping timeout: 260 seconds]
fandre1986 has quit [Quit: Connection closed]
<sagax> thanks
<Intelo> nakilon login will not tell the address
Starfoxxes has quit [Ping timeout: 245 seconds]
Bounga has quit [Remote host closed the connection]
steerpike has joined #ruby
<steerpike> hi, can i ask questions about rspec in here?
Starfoxxes has joined #ruby
<steerpike> i get these errors https://paste.ee/r/qIPy5 when running the example here: https://www.tutorialspoint.com/rspec/rspec_introduction.htm
<steerpike> is it an issue with the version?
<steerpike> i'm using ruby 2.6.4
Intelo has quit [Quit: Client closed]
<steerpike> is there a better place to ask questions?
mantis_ has joined #ruby
kaleido has joined #ruby
kaleido has quit [Changing host]
kaleido has joined #ruby
mantis_ has quit [Remote host closed the connection]
<havenwood> steerpike: that looks like a smart quote with `class”` in the error?
<havenwood> steerpike: show the whole file?
<steerpike> it's on the tutorialspoint page near the bottom
<havenwood> >> 'class”'.grapheme_clusters.last.ord
<havenwood> #=> 8221
<havenwood> >> 'class”'.grapheme_clusters.last.bytes
<havenwood> #=> [226, 128, 157]
<steerpike> i don't know what that means
<havenwood> >> 8221.chr(Encoding::UTF_8)
<havenwood> #=> "”"
<havenwood> steerpike: There's a UTF-8 character for a smart quote, and one is following the word "class" in your code.
<havenwood> I suspect smart quotes are being used where actual quotes were intended, so `class` is being evaluated as code rather than String content.
<steerpike> oh.. the context!
<steerpike> success!
<steerpike> thank you
<havenwood> no prob, you're welcome
<havenwood> happy coding!
<steerpike> :)
<adam12> Those dang smart quotes.
<kaleido> not so smart after all, amirite?
<adam12> LOL
<adam12> Smartly affecting copy-pasta for everyone everywhere.
_ht has joined #ruby
jpw has joined #ruby
<dviola> anyone familiar with roda here?
<adam12> dviola: yes
<dviola> adam12: I'm trying to make some GET requests where I'll be passing some "Authorization:Bearer" tokens, I'm unsure how to read those from roda
SuperLag has quit [Ping timeout: 260 seconds]
<dviola> e.g. http get http://localhost:3000/foo/bar 'Authorization:Bearer token'
SuperLag has joined #ruby
<adam12> dviola: If you have an object `r` inside your routing tree, you could probably do `r.get_header("Authorization")`
<dviola> adam12: interesting, let me try that
<adam12> dviola: `r` is just the current request, so anywhere in your routing tree that's in the context of Roda, you could do `request.get_header("Authorization")` as well. But `r` is the common shorthand.
<dviola> makes sense
<dviola> I get nil
<dviola> I get it now with r.get_header("HTTP_AUTHORIZATION") after adding plugin :request_headers
<adam12> dviola: Ah. Yes, Rack sometimes mutates header names.
<adam12> dviola: If you use request_headers plugin, the syntax is nicer, since you can use `r.headers`.
<dviola> env['HTTP_AUTHORIZATION'] also works
<dviola> nice
<dviola> adam12: thanks a lot :)
<adam12> dviola: cheers.
<adam12> I sometimes look at `env` to see what the header name is
bhaak has joined #ruby
Rounin has joined #ruby
___nick___ has joined #ruby
orbyt has joined #ruby
donofrio has joined #ruby
seabre has joined #ruby
<nakilon> infernix log in and call some "look into my profile" http api endponit that should show the address
<adam12> Progress on yjit is looking interesting.
<adam12> Variable width allocation merged too.. interesting.
motherr has joined #ruby
vit has quit [Quit: Konversation terminated!]
jpw has quit [Ping timeout: 260 seconds]
jpw has joined #ruby
Inline has quit [Read error: Connection reset by peer]
crankharder has quit [Ping timeout: 260 seconds]
jpw_ has joined #ruby
crankharder has joined #ruby
jpw has quit [Ping timeout: 260 seconds]
crankhar1er has joined #ruby
crankhar1er has quit [Client Quit]
crankharder has quit [Quit: leaving]
crankharder has joined #ruby
crankharder has quit [Client Quit]
Inline has joined #ruby
crankharder has joined #ruby
___nick___ has quit [Ping timeout: 260 seconds]
hololeap has quit [Remote host closed the connection]
hololeap has joined #ruby
quazimodo has joined #ruby
ur5us has joined #ruby
_ht has quit [Remote host closed the connection]
crankharder has quit [Ping timeout: 265 seconds]
pwnd_sfw has quit [Quit: Ping timeout (120 seconds)]
Inline has quit [Remote host closed the connection]
pwnd_sfw has joined #ruby
Inline has joined #ruby
motherr has quit [Quit: zzz]
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
fercell has quit [Ping timeout: 264 seconds]
SuperLag has quit [Ping timeout: 260 seconds]
SuperLag has joined #ruby
shuvarek has joined #ruby
<dviola> I'm trying to keep the JWT.decode separate from the rest of the code: https://gist.github.com/diegoviola/79c348f2cf1e4396cfcaaf8876752dbf#file-app-rb-L7-L13
<dviola> and not exactly sure how to refactor it
<dviola> would appreciate some advice
<dviola> it's some roda code
<adam12> dviola: Lots of ways.
<dviola> I don't want to do the jwt decode every time I call a route
motherr has joined #ruby
<dviola> adam12: oh, hmm
<adam12> dviola: Outside of route block, you can just define a regular method. That's available inside the route block.
<dviola> adam12: oh
<adam12> dviola: I'd just call it at the top of the routing tree.
<adam12> dviola: auth_token = ...; JWT.decode ...;
<adam12> dviola: That is, if every route is authenticated.
<dviola> adam12: oh! that's cool
<dviola> thanks
<adam12> You can use the error plugin to catch JWT::DecodeError, and then render your message there in one place.
<adam12> plugin :error_handler do |ex; case ex; when JWT::DecodeError; response.redirect("unauthorized", 401);
<adam12> Gotta run. bbiaf.
<dviola> thanks
jpw_ has quit [Remote host closed the connection]
orbyt has quit [Quit: Textual IRC Client: www.textualapp.com]
postmodern has joined #ruby
cuppajoeman has joined #ruby
<cuppajoeman> Hello there, I'm trying to install jekyll I'm using manjaro, so far I've run `sudo pacman -S ruby base-devel` then `gem install jekyll bundler` added ruby to my path , and then ran `bundle exec jekyll serve` I've also run `bundle add webrick` to no avail, the error I get is this: `/usr/lib/ruby/3.0.0/pathname.rb:49:in `basename': no implicit conversion of nil into String (TypeError)` THe full error I get is this:
postmodern has quit [Remote host closed the connection]
<cuppajoeman> When running with `--trace` the error becomes: bundler: failed to load command: jekyll (/home/ccn/.local/share/gem/ruby/3.0.0/bin/jekyll)
<cuppajoeman> The output of running /home/ccn/.local/share/gem/ruby/3.0.0/bin/jekyll (https://pastebin.com/raw/6D7MdXBr)
ur5us has quit [Ping timeout: 264 seconds]