Total Pageviews

Saturday 3 September 2016

关于rails

How to install Rails

  sudo gem install rails

Create the application

  rails url_shortener

Install the RSpec-Rails gem

Edit environments/test.rb and add the following
Then run
rake gems:install RAILS_ENV=test
script/generate rspec

If you are using Rubymine

  • Go to Project Settings > Ruby SDK and Gems
  • Click 'Attach gems'
    • Add Rspec
    • Add Rspec-rails

Model

Generate the Url model

script/generate rspec_model Url

Modify the generated migration to create the database schema

rake db:migrate db:test:prepare

Modify the generated model spec. Add tests for your model.

Controller

script/server
from https://github.com/britt/tech-talk