Fred-grais / transifex-interface-ruby

A Transifex API interface written in ruby
MIT License
5 stars 12 forks source link

Testing questions #2

Open czak opened 9 years ago

czak commented 9 years ago

Hi, I'm the guy who committed 996ef55c8405f18932. I needed the fix for an app I'm working on and it now works fine for me.

However I was not able to add a test case for the PR. I could use some help on how you do testing and how to set them up to get started. Are you using any kind of request mocking?

To be honest I'm confused by the very first spec: https://github.com/Fred-grais/transifex-interface-ruby/blob/master/spec/lib/transifex/configuration_spec.rb. How can both pass?

Fred-grais commented 9 years ago

Hello,

firstly thanks for the commit, i'm happy that this GEM was usefull to somebody.

About the mocking requests, i'm not using a such system. I'm querying the actual Transifex API. I know it is not a best practice but it is my first gem and i don't really know much about mocking requests, also i don't understand how mocking the API requests allow us to actually test the API in real conditions^^).

What you got to do if you want to test your modifications is in https://github.com/Fred-grais/transifex-interface-ruby/blob/master/spec/spec_helper.rb

You provide your own Transifex Credentials in reset_transifex_configuration and it should then perform the tests by querying the Transifex API ie create some projetc then delete it and so on...(it also should answer your last question)

Note that for some tests i used a project that was already created on my Transifex Account like in https://github.com/Fred-grais/transifex-interface-ruby/blob/master/spec/lib/transifex/project_languages_spec.rb (line 5)

So you could replace the Transifex::Project.new(slug) by Transifex::Projects.create(creation_params) in all the concerned files. I unfortunately don't have a functionnal Transifex Account anymore (trial expired).

2014-10-17 18:31 GMT+02:00 Łukasz Adamczak notifications@github.com:

Hi, I'm the guy who committed 996ef55 https://github.com/Fred-grais/transifex-interface-ruby/commit/996ef55c8405f18932db270f0b861e473d214d2a . I needed the fix for an app I'm working on and it now works fine for me.

However I was not able to add a test case for the PR. I could use some help on how you do testing and how to set them up to get started. Are you using any kind of request mocking?

To be honest I'm confused by the very first spec: https://github.com/Fred-grais/transifex-interface-ruby/blob/master/spec/lib/transifex/configuration_spec.rb. How can both pass?

— Reply to this email directly or view it on GitHub https://github.com/Fred-grais/transifex-interface-ruby/issues/2.