Giter VIP home page Giter VIP logo

camcorder's People

Contributors

achan avatar carsonreinke avatar etagwerker avatar ghempton avatar lcpriest avatar parndt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

camcorder's Issues

Using :example_group from metadata is deprecated warning [Rspec]

Hey @ghempton!

Thank you for developing this gem! It's been very useful so far. ๐Ÿ‘

The only issue that I've found is that it shows this warning:

Deprecation Warnings:

The `:example_group` key in an example group's metadata hash is deprecated. Use the example group's hash directly for the computed keys and `:parent_example_group` to access the parent example group metadata instead. Called from /Users/etagwerker/.rvm/gems/ruby-2.2.1@sender/gems/camcorder-0.0.4/lib/camcorder/rspec.rb:9:in `yield'.


If you need more of the backtrace for any of these deprecations to
identify where to make the necessary changes, you can configure
`config.raise_errors_for_deprecations!`, and it will turn the
deprecation warnings into errors, giving you the full backtrace.

1 deprecation warning total

This happens because Rspec has deprecated the usage of metadata[:example_group] - See: rspec/rspec-rails#1035

I tried to write a PR to fix this but I couldn't find a decent way to keep the current tree structure for the recordings.

Instead of using the recursive code that generates the nested folder, I could write an implementation that uses metadata[:full_description] to generate the recording file. The problem with this solution is that it wouldn't be backwards compatible. :(

What do you think?

Thanks!

What methods need to be used with `methods_with_side_effects`

I'm struggling to get this to work how I'd expect.

I have one ActiveJob that loops through emails in an inbox, finds a record based on the contents of each email, performs a state machine transition on the record and then moves that email to an 'Archive' folder via uid_copy and uid_store. After the loop has finished, the job calls imap.expunge, imap.logout and imap.disconnect.

The problem is that I need to run multiple tests for this worker, but the first time it runs it is archiving all mail and fails on subsequent tests.

How would I record once and perform multiple test?

I'm Not able to use it, got NoMethodError.

I'm trying this on irb console i.e
2.2.0 :001 > require 'gmail'
2.2.0 :002 > require 'camcorder'
2.2.0 :003> imap = Camcorder::Proxy.new(Net::IMAP,'imap.gmail.com', 993, true, nil, false)
this gives successful response as---- --

"Camcorder::Proxy:0x00000001c5c028 @klass="imap.gmail.com", @init_args=[993, true, nil, false], @recorder=Net::IMAP, @side_effects="e6bd2fbfc8ef76c22f26bd5758f20098" "

but after that I'm requesting for login i.e

2.2.0 :004 > imap.login('amolishere', 'amol123')

then i got response as ----------

NoMethodError: undefined method name' for "imap.gmail.com":String from /home/amol/.rvm/gems/ruby-2.2.0/gems/camcorder-0.0.4/lib/camcorder/proxy.rb:41:in_record'
from /home/amol/.rvm/gems/ruby-2.2.0/gems/camcorder-0.0.4/lib/camcorder/proxy.rb:52:in method_missing' from (irb):4 from /home/amol/.rvm/rubies/ruby-2.2.0/bin/irb:11:in

'

Please help me to solve this?

Thank you.

FYI, you may have to re-record cassettes with psych 2.1.0+

For future people including me, if you get a Camcorder::ProxyPlaybackError because it can't find a recording, it could be due to psych changes.

Because camcorder uses yaml to dump the args for each method call, if you upgrade to newer versions of psych that change the format (even slightly), you may have to rerecord your cassettes:

def _hash_args(args)
Digest::MD5.hexdigest(YAML.dump(args))
end

For example, psych 2.0.17 to 2.1.0 introduced this change.

irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> Psych::VERSION
=> "2.0.17"
irb(main):003:0> YAML.dump "078123423"
=> "--- 078123423\n...\n"
irb(main):004:0> require 'digest'
=> true
irb(main):005:0> Digest::MD5.hexdigest(YAML.dump("078123423"))
=> "9ad7bbd6de568e136bf7f30105dcbb8d"
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> Psych::VERSION
=> "2.1.0"
irb(main):003:0> YAML.dump "078123423"
=> "--- '078123423'\n"
irb(main):004:0> require 'digest'
=> true
irb(main):005:0> Digest::MD5.hexdigest(YAML.dump("078123423"))
=> "884af5b4d3e7878a214262fca58a9ae6"

See also: ManageIQ/manageiq-gems-pending#344

undefined method `record' for nil:NilClass

Given the code below:

require 'net/imap'
require 'camcorder'

Camcorder.intercept_constructor(Net::IMAP)

imap = Net::IMAP.new('outlook.office365.com', 993, ssl: true)
imap.login('[email protected]', 'password')
imap.select('INBOX')
imap.search(%w(NOT FLAGGED SINCE 21-Dec-2016))
imap.disconnect

I get the following exception:

camcorder-0.0.5/lib/camcorder/proxy.rb:42:in `_record': undefined method `record' for nil:NilClass (NoMethodError)
	from camcorder-0.0.5/lib/camcorder/proxy.rb:52:in `method_missing'
	from cam_test.rb:7:in `<main>'

Is there more setup needed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.