Geeks With Blogs

News Please visit me at my new blog!!

profile for Aligned at Stack Overflow, Q&A for professional and enthusiast programmers
"free in Christ Jesus from the law of sin and death." Romans 8:2 (ESV) Check out the Falling Plates video on YouTube.
more about the Gospel
And then listen to Francis Chan speaking at LifeLight in SD.



Programming and Learning from SD

I jumped into the world of GitHub pull requests after making a feature request to Jasmine. My pull request is to add toHaveBeenCalledOnce and toHaveBeenCalledTimes after they said they’d look at a pull request from my feature request for it.

This was my first time, so I had to look up some guides. Thankfully, StackOverflow had the answer and GitHub  has a nice guide and Jasmine had a straightforward contributors guide.

After making my fork and starting my branch, I tried to run the tests only in the command line with grunt execSpecsWithNode. I still missed some tests (I was trying not to spend too much time on it) which you can see in my first pull request and was pointed out by Travis CI. So the next day I had to get Ruby running to be able to debug the tests in a browser.

Steps to creating a pull request:

  1. Create a fork of the repo
  2. use git and create a branch
  3. commit and push to the branch
  4. Create pull request from your forked github.com page, by navigating to your fork, then your branch, then click create pull request.
  5. Here’s how to sync your fork with main

Git instructions from the Jasmine Contributors Guide.

git clone git@github.com:yourUserName/jasmine.git              # Clone your fork
cd jasmine                                                     # Change directory
git remote add upstream https://github.com/jasmine/jasmine.git # Assign original repository to a remote named 'upstream'
git fetch upstream                                             # Pull in changes not present in your local repository
git checkout -b my-new-feature                                 # Create your feature branch
git commit -am 'Add some feature'                              # Commit your changes
git push origin my-new-feature                                 # Push to the branch

I had some troubles getting the tests running in the browser. I had never used Ruby before and bundle didn’t seem to get everything and I ran gem install x a few different times.

To Get Ruby Running on Windows 7 (not exact steps but some things I tried):

  1. “To install the Ruby dependencies, you will need Ruby, Rubygems, and Bundler available” (from the contributors guide)
    1. Get these from http://rubyinstaller.org/downloads/
    2. install the devKit
  2. run bundle in the command line
  3. Run rake jasmine
  4. if you get:

    rake aborted!
    LoadError: cannot load such file -- jasmine
    C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in
    require' C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require'
    c:/Users/vendor-klogan/Source/Repos/jasmine/Rakefile:4:in <top (required)>' C:/Ruby22-x64/lib/ruby/2.2.0/rake/rake_module.rb:28:inload'
    C:/Ruby22-x64/lib/ruby/2.2.0/rake/rake_module.rb:28:in load_rakefile' C:/Ruby22-x64/lib/ruby/2.2.0/rake/application.rb:689:inraw_load_rakefile'
    C:/Ruby22-x64/lib/ruby/2.2.0/rake/application.rb:94:in block in load_rakefile' C:/Ruby22-x64/lib/ruby/2.2.0/rake/application.rb:176:instandard_exception_hand
    ling'
    C:/Ruby22-x64/lib/ruby/2.2.0/rake/application.rb:93:in load_rakefile' C:/Ruby22-x64/lib/ruby/2.2.0/rake/application.rb:77:inblock in run'
    C:/Ruby22-x64/lib/ruby/2.2.0/rake/application.rb:176:in standard_exception_hand ling' C:/Ruby22-x64/lib/ruby/2.2.0/rake/application.rb:75:inrun'
    C:/Ruby22-x64/bin/rake:33:in `

  5. then I ran these gem installs manually

    gem install jasmine
    gem install jasmine_selenium_runner
    gem anchorman

  6. try rake jasmine again
  7. it worked for me (hopefully for you), then http://localhost:8888/ will run the tests!

I’ve heard how people like Ruby, with the gems and similarity to npm I’m starting to see why they do.

After I fixed my failing tests and pushed to my repo, Travis CI automatically picked up the commit and started running the build. That was unexpected and very cool!

Conclusion:

Pull requests are easy to make on Github and the guides are straight forward. I just needed to take the time to go through the process.

Update: And it’s merged! You can now use the new matcher toHaveBeenCalledOnce() and toHaveBeenCalledTimes(x:int)

Posted on Wednesday, June 3, 2015 9:05 PM | Back to top


Comments on this post: My Github Pull Request for Jasmine Experience

# re: My Github Pull Request for Jasmine Experience
Requesting Gravatar...
Thank`s I find it so usefull and it seems to be a future thighish. Have a nice day, Craig!
Left by Craig on Jun 10, 2015 3:46 PM

Your comment:
 (will show your gravatar)


Copyright © Aligned | Powered by: GeeksWithBlogs.net