dysfigured has quit [Read error: Connection reset by peer]
Sembei has joined #ruby
astrobunny has joined #ruby
astrobunny has quit [Remote host closed the connection]
astrobunny has joined #ruby
dysfigured has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
raynold has joined #ruby
dysfigured has quit [Quit: I hate quit messages.]
dysfigured has joined #ruby
Sembei has quit [Ping timeout: 240 seconds]
MyMind has joined #ruby
arescorpio has joined #ruby
kn-928_ has joined #ruby
kn-928 has quit [Ping timeout: 260 seconds]
houhoulis has quit [Remote host closed the connection]
bronson has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bronson has quit [Ping timeout: 252 seconds]
govg has quit [Ping timeout: 240 seconds]
banisterfiend has quit [Ping timeout: 248 seconds]
arescorpio has quit [Ping timeout: 240 seconds]
elbuki has joined #ruby
<elbuki>
Hello, how would you test a web scraper class?
houhoulis has joined #ruby
<baweaver>
Ask yourself some questions: What, When, Then
<baweaver>
What are you testing?
<baweaver>
When it does something, then what do you expect it to do?
<baweaver>
What: Web scraper. When: Parsing a page. Then: it gives you a parsed page object, AST, or something
kn-928_ has quit [Quit: WeeChat 1.9]
<baweaver>
What: WebScraper.tokenize. When: Passed an HTML block. Then: I expect it returns a tokenized AST (abstract syntax tree)
<baweaver>
To translate that to RSpec: What = describe, When = describe / context, Then = it / expect
<elbuki>
What: Web scraper. When: The HTML content is fetched from a website. Then: Returns an array of hashes.
harai_ has joined #ruby
<elbuki>
... depending on the content
<baweaver>
Yep, that would be a high level test or an Acceptance Test
<baweaver>
Basically what you need to verify to show it's working
<baweaver>
Also known as a Behavior Test
<elbuki>
test should not involve internet connection?
<baweaver>
Unit tests shouldn't
<baweaver>
Acceptance / Behavior - Criteria for a finished app behavior; Integration - union of unit functions working together; Unit - a function / method in isolation (no internet)
<baweaver>
Integration is if you have a bunch of units that come together to make a larger function flow, like tokenize would call a few other helper methods.
<baweaver>
For a Unit test you would stub everything and make that function work in complete isolation of others except for exactly what you tell it to use.
<baweaver>
That said you should probably use Nokogiri.
<elbuki>
I do.
<elbuki>
The main concern here is that if the website where I'm scraping content is available or not.
<elbuki>
I understand now that unit tests are not for that.
<baweaver>
Ah. You could always check the HTTP code of the site
<baweaver>
when response.code is > 299 then (error happens, test this)
__Yiota has joined #ruby
<elbuki>
I'm using `Net::HTTP.get(URI.parse(url))`.
<elbuki>
Returns a SocketException when the page is not resolved.
Salve has joined #ruby
<elbuki>
And returns a string representation of HTML when the page is fetched sucessfully.
<baweaver>
What version of Ruby?
<elbuki>
I haven't found a way to test that since it involves content fetching.
<baweaver>
I'd have to look how to stub in minitest or testunit, but I'd think they'd be similar
Slinky_Pete has joined #ruby
<baweaver>
basically you allow an object to receive a specific message and return a response you want instead
<elbuki>
Like mocking?
<baweaver>
yep
<baweaver>
mocking, stubbing, same thing with some slight semantical differences I'm sure someone will remind me of in a minute
<elbuki>
I'll try that, thanks.
Slinky_Pete has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
Salve has quit [Remote host closed the connection]
jameser has quit [Client Quit]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has joined #ruby
orbyt_ has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chalkmonster has quit [Ping timeout: 240 seconds]
selim has quit [Ping timeout: 260 seconds]
selim has joined #ruby
chalkmonster has joined #ruby
dviola has joined #ruby
humon has joined #ruby
pilne has quit [Quit: Quitting!]
G_ is now known as G
__Yiota has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
imode has quit [Ping timeout: 240 seconds]
cadillac_ has quit [Quit: I quit]
cadillac_ has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
harai_ has quit [Ping timeout: 264 seconds]
Silthias has quit [Ping timeout: 240 seconds]
Silthias has joined #ruby
jameser has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
<elbuki>
is there a way to use 'pry' in development only without requiring it in the code?
<elbuki>
I don't want to have that require 'pry' in the production code.
jdawgaz has joined #ruby
<nofxx>
elbuki, you can always don't commit heh.. but how are you running the thing?
rabajaj has joined #ruby
<elbuki>
I include it in the Gemfile, require it in the main file and invoke it by using 'binding.pry'.
<nofxx>
no, I mean..how you run the code: ruby app.rb ./some/console, rake
<nofxx>
you can -r iirc.. ruby -r gem, it may work only having the gem, w/o having to modify Gemfile
<nofxx>
but, 'correct way' lets say, would be have a development only in Gemfile
<nofxx>
development only group*
enterprisey has quit [Ping timeout: 248 seconds]
<nofxx>
also check out byebug if in newer ruby
astrobun_ has joined #ruby
astrobunny has quit [Ping timeout: 246 seconds]
lektrik has joined #ruby
<elbuki>
I have it in the development group.
<elbuki>
I use rackup to bring the server up.
bronson has joined #ruby
<nofxx>
elbuki, ah, now I got it... no, you should not need the require if it's in the Gemfile
<nofxx>
maybe not loading the group? enviroment stuff
houhoulis has quit [Remote host closed the connection]
enterprisey has joined #ruby
<elbuki>
I'll check, thanks.
knight33 has joined #ruby
humon has quit [Remote host closed the connection]
hinbody has quit [Ping timeout: 240 seconds]
lexruee has quit [Ping timeout: 240 seconds]
<elbuki>
So, when the app is started, bundler should require all the gems specified in the Gemfile, so it's not necessary to manually require them in any part of the app?
gix has quit [Ping timeout: 248 seconds]
lexruee has joined #ruby
govg has joined #ruby
ashZ_ has quit [Quit: Leaving]
gix has joined #ruby
hinbody has joined #ruby
bronson has quit [Remote host closed the connection]
dviola has quit [Read error: Connection reset by peer]
rafasc has left #ruby [#ruby]
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
daveomcd has quit [Ping timeout: 240 seconds]
opekktar has joined #ruby
daveomcd has joined #ruby
uZiel has joined #ruby
belmoussaoui has joined #ruby
lagweezle is now known as lagweezle_away
opekktar has quit [Quit: WeeChat 1.9]
jdawgaz has joined #ruby
harai_ has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Emmanuel_Chanel has quit [Remote host closed the connection]
<ule>
matthewd: sorry about that, indeed it says that
govg has joined #ruby
<ule>
thank you very much!
<ule>
ops
<ule>
actually didn't work
cadillac_ has joined #ruby
Defenestrate has joined #ruby
bronson has joined #ruby
<ule>
wait nvm
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
jameser has quit [Ping timeout: 248 seconds]
belmoussaoui has quit [Ping timeout: 255 seconds]
synthroi_ has quit [Remote host closed the connection]
bronson has quit [Ping timeout: 240 seconds]
vondruch_ has joined #ruby
vondruch has quit [Ping timeout: 246 seconds]
vondruch_ is now known as vondruch
tvw has quit [Remote host closed the connection]
DLSteve has joined #ruby
ForeignBiscuit is now known as ResidentBiscuit
synthroid has joined #ruby
JD2020 has joined #ruby
gregf_ has quit [Ping timeout: 260 seconds]
JD2020X has quit [Ping timeout: 264 seconds]
funkytwig has quit [Ping timeout: 240 seconds]
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
rrichardsr3 has quit [Quit: He who dares .... wins.]
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
haylon_ has joined #ruby
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
jdawgaz has joined #ruby
haylon_ has quit [Remote host closed the connection]
jdawgaz has quit [Client Quit]
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
adam_ is now known as adam12
jdawgaz has joined #ruby
rasca_ has joined #ruby
lxsameer has quit [Quit: WeeChat 1.7]
<rasca_>
Hi everyone, I have a problem when using `bundle install` to upgrade gitlab. The `google-protobuf` and `grpc` gems are being installed as 64 bit whereas all the others are 32bit resulting in a `LoadError: wrong ELF class`. How can I tell bundler to install the 32 bit version or install it from source inside vendor/bundle?
aupadhye has quit [Ping timeout: 255 seconds]
lxsameer has joined #ruby
LastWhisper____ has joined #ruby
ams__ has joined #ruby
ta_ has quit [Remote host closed the connection]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<je0rsh>
normally i just use the mem method as if it were the @mem instance variable...but i'm getting nil when i hit it
cagomez has joined #ruby
<je0rsh>
only when i'm trying to make modifications to it though
<je0rsh>
i think
laphoriag99 is now known as laphoraig49
<je0rsh>
am i in the wrong channel? is there like a ... ruby for newbs channel
<elbuki>
yes, it's ruby in general
bronson has joined #ruby
<elbuki>
it's just that the people here is not very responsive
<elbuki>
are*
<Papierkorb>
je0rsh: Most won't click on a link without explanation, Here in the channel, what you're trying to do, what you tried, and what issue you're facing.
<je0rsh>
no worries, i was just being a little impatient
<elbuki>
You could post your problem in Stack Overflow, you can get further assistance in there
<je0rsh>
papierkorb, i thought i did that
<je0rsh>
sorry
claudiuinberlin has joined #ruby
jnollette has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
bronson has quit [Ping timeout: 255 seconds]
<phaul>
je0rsh: I think mem is a local variable not the function call you think it is
<je0rsh>
so in this case... self.mem += n, is self.mem the method or the instance variable....the method, right?
<Papierkorb>
je0rsh: Two issues in fact: 1) your use of += invokes `Array#+`, which would expect an array. You wanted to use `#<<`. 2) `a += b` expands to: `a = a + b`. You'd be returning a copy of the returned array, and not actually modifying it like you intended.
<je0rsh>
yeah, i tried the a = a + b too
<je0rsh>
i just threw this example together after i was having the actual issue somewhere else
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<je0rsh>
so i wasn't paying too much attention to the args expected by methods
<je0rsh>
i was mostly concerned with the return value of mem
<je0rsh>
thanks for updating the gist though, that helps a bunch
<je0rsh>
and the self.mem too
phaul has quit [Ping timeout: 255 seconds]
<je0rsh>
yeah,
<je0rsh>
the way i normally use it is... `mem.push(n)`
<je0rsh>
which worked fine
<je0rsh>
thanks everyone
jdawgaz has joined #ruby
nopolitica has joined #ruby
__Yiota has joined #ruby
Dimik has quit [Ping timeout: 240 seconds]
funkytwig has quit [Ping timeout: 260 seconds]
funkytwig has joined #ruby
naftilos76 has quit [Quit: Αποχώρησε]
raynold has joined #ruby
machinewar has joined #ruby
laphoraig49 is now known as laphoraig97
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
__Yiota has joined #ruby
marxarelli has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
zachk has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
JD2020 has joined #ruby
<pizzaops>
I don't know how I've never run into this before, but I can't seem to find good info - is there a way to pass arguments in a Gemfile for use by bundler? E.g. if I normally need to do `gem install libv8 -v 'XX.XX.XX' -- --with-system-v8`, is there a way to actually specify the `-- --with-system-v8` in the Gemfile?
cagomez has quit [Remote host closed the connection]
duckpupp1 has quit [Ping timeout: 240 seconds]
cagomez has joined #ruby
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
marxarelli has joined #ruby
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
cagomez_ has joined #ruby
Ltem has quit [Quit: Leaving]
Slinky_Pete has joined #ruby
nowhereman has joined #ruby
cagomez has quit [Ping timeout: 240 seconds]
ivanskie has joined #ruby
cagomez_ has quit [Ping timeout: 248 seconds]
ldnunes has quit [Quit: Leaving]
spt0 has joined #ruby
hahuang65 has joined #ruby
benlieb has joined #ruby
<machinewar>
Algebr`: a gem is a Ruby library, rake is a build tool - think command line scripts in Ruby, bundler is for managing Ruby libraries (gems)
Slinky_Pete has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Algebr`>
got it
marxarelli has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
[Butch] has quit [Quit: I'm out . . .]
nowhereman has quit [Ping timeout: 248 seconds]
<Algebr`>
if bundler is for manage libraries, then why do I do gem install instead of bundle install?
DTZUZO has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elbuki has joined #ruby
sepp2k1 has quit [Read error: Connection reset by peer]
Pisuke has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
<machinewar>
if you don't have a gemfile you can gem install libraries
<machinewar>
for example if you just want to play around with some library
<machinewar>
most Ruby projects will use a Gemfile + bundler though because then if I want to work on your project, I just git clone it, and run bundle install
mim1k has joined #ruby
mson has joined #ruby
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nopolitica has quit [Ping timeout: 264 seconds]
mim1k has quit [Ping timeout: 248 seconds]
machinewar has quit []
tcopeland has quit [Quit: tcopeland]
Pisuke has joined #ruby
orbyt_ has joined #ruby
lagweezle_away is now known as lagweezle
DTZUZU has quit [Ping timeout: 255 seconds]
DTZUZO has quit [Ping timeout: 240 seconds]
mtkd has quit [Ping timeout: 264 seconds]
DTZUZO has joined #ruby
mtkd has joined #ruby
DTZUZU has joined #ruby
Dimik has joined #ruby
Pisuke has quit [Ping timeout: 252 seconds]
<jakinov>
Hi, I'm writting plugin for some application. The app is event based, and each event is in some custom object type, I'm trying to get that event object into another custom object type. Both objects have the exact same keys/fields and structure (e.g. if u represneted each in json they'd look the exact same). How can I easily make the values of the keys/fields (and all the nested keys/fields) in my second object be the same as the first
<havenwood>
graft: There's a milestone and branch but it's just future-looking, breaking changes.
<graft>
i see... so upgrading bundler would do Algebr` right
<havenwood>
I don't know when release is planned.
<Algebr`>
well I do: bundler --version Bundler version 1.16.0.pre.2, so that seems right
<Algebr`>
so I'm thinking its traveling ruby itself which is using the insufficent bundler version
elsevero has quit [Ping timeout: 240 seconds]
milardovich has quit []
Slinky_Pete has joined #ruby
<jakinov>
havenwood: I'll repost with more details and examples if I need to. I just got an answer from stackoverflow and yours, Going to play around. Thanks for the help!