sábado, 14 de mayo de 2016

How i got my first merge to master

To this two week I was very busy, I began the week making the testing from all the classes. And again the project of ICS was really helpful to do that. I try to made all the cases that i could think. The some test was easy to do, but other not that much. A difficult test was of the controller, in the past i was make the test from the controller with the view but this time I needed test if i was creating the instance of the importation. Also I needed test if the file had the correct parameter. At the beginning I just need help, then I asked for help to Cardoce and Jesus, but they were too busy. To don't delay them I searched help in slack. Almost immediately Macho and Arnoldo bring me your help. Thanks to this help I saw my error and could make the test from the controller.
This is code to do the instance of the controller and check the file:

   let(:catalog_path) do
      Rails.root.join('spec/fixtures/transaction_catalog.csv')
    end
    let(:file) { Rack::Test::UploadedFile.new(catalog_path, 'csv') }

    it 'calls Import::Catalog with correct params' do
      sign_in
      expect(Import::Transactions).to receive(:new).with(file).and_call_original

      post :import, file: file
    end

    it ' imports the uploaded catalog' do
      sign_in
      expect_any_instance_of(Import::Transactions).to receive(:import!)

      post :import, file: file
    end
First declare a file to be loaded and in the test I load the file and compared with the the same but without the original, the other test i only check if some instance was created in the function


When I finished test, immediately I created the Pull request. To celebrate I post in to the slack channel my pull request. Them Jesus suggest me that first check the clean code with this gem. When I check my code by first time with the gem I was 463 fails. At the beginning I was asking to me: How this is possible?. When I checked the failures, the most part was of the original code, my fails was like 130. The most part of the errors was about the a space at the final of the line, also blank line between others. Fix the clean code take me too many time, i need to improve my clean code as fast as is possible.
To the Monday of this week i had a meeting with Tristan, this time he told me that I will gonna continue with the project. When I thought about that, i realize that my project was not modularize. So I begging to do it. The Wednesday Tristan send me a email saying me that merge my progress. I can finish the fix the pull request, but some late. When Jesus gonna merge develop to master appeared conflicts in the pull request. Then i fixed the inconsistencies. The project was merge at the 6:30 pm, I hope that Tristan  will not bother. 
The Friday i made the sender email, to send the emails i used this gem. At the beginning had some  problems to implements but was to use a bad configuration. If you are asking for my configuration, was that:

Pony.mail({
  :to => 'emailto@gmail.com',
  :from => 'emailform@gmail.com',
  :subject => 'subject',
  :body => 'body.',
  :attachments => {"file.iif" => File.read("path")},
  :via => :smtp,
  :via_options => {
    :address              => 'smtp.gmail.com',
    :port                 => '587',
    :enable_starttls_auto => true,
    :user_name            => '
emailto@gmail.com',
    :password             => 'YourPass',
    :authentication       => :login,
    :domain               => 'gmail.com'
  }
})

No hay comentarios:

Publicar un comentario