Ruby on Rails Flashcards

1
Q

Using a web API

A
  1. Construct a URI request using URI class.
  2. Issue the request using Net::HTTP
  3. Parse the XML response
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

RSpec specfile example

A

require ‘spec_helper’

describe MovieController do
  describe 'searching TMDb' do
    ...
  end
end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Testing a spec file

A
  1. Manually type ‘rspec spec/controllers/xxx_controller_spec.rb’
  2. Use ‘autotest’ tool: Once you type ‘autotest’, then whenever you update a file, the RSpec will update the test results.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Setting up RSpec

A
  1. The following two lines must be added in Gemfile
    gem ‘ZenTest’
    gem ‘rspec-rails’
  2. Type ‘bundle install’ as usual.
  3. Before using Rspec, you must do ‘rails generate rspec:install’. This is just a one-time thing, and will generate the necessary directories/files.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly