1/1/2024 0 Comments Installing ruby on rails mac![]() Starting with a clean db before each test is a good thing because we can create our testing environment on the fly and we're able to simulate different scenarios (let me know if you want to read more on the subject).Īnd to install Cucumber into our project do: $ bundle install DatabaseCleaner is a gem that will help with cleaning our database before each test run so that we always start with nothing in our database. What those lines above do is they add the cucumber-rails and database_cleaner gems to your project. You also need to setup Cucumber by generating it's config files. Go to your Gemfile and add these two lines to the test group. This last command will generate all the files you need for RSpec to run. Add the gem to the development and test environments like so. Install RSpecĪs a personal preference, I like to use Cucumber and RSpec for testing my Ruby on Rails apps.įirst thing is to add RSpec. I'll still need to create a repository on Github, and configure my testing tools. This marks the basic install as complete. You'll want to run rails db:migrate at this point so it creates your development and test databases. $ cp config/database.yml config/ĭon't forget to add config/database.yml to your. So I first make a copy that will be staged as an example config, and then I edit my own version. The config/database.yml file should not be staged into your version controll system, because it's going to be different for every developer (unless you're using Docker or something similar). I like to use RSpec instead of Minitest, and I also like to skip the initial bundle install because there are a few more tweaks I need to make before installing all the gems. ![]() $ rails new my_cool_app -skip-test -skip-bundle -database =postgresql Now that you have the latest version of Ruby, and the latest version of Rails, you can go ahead and create your project. How to create a new Ruby on Rails project ![]() $ cd ~/WorkĪs you can see, that's another way of creating the gemset if it doesn't exist. Just because I like to keep all the dependencies separate for each project, I like to start with a fresh gemset. It will mark the current gemset with a => sign. You can confirm that with rvm gemset list. $ rvm /Users/cezar/.rvm/gems/ruby-2.5.1 with gemset my_cool_app Ruby-2.5.1 - #gemset created - #generating my_cool_app wrappers.Īnd to use that gemset you use this. Like I said previously, I like to use on gemset per project. To keep your gems together, you can create gemsets. You can check out the list ruby versions you have installed with rvm list. ![]() Īnd if you want to make that version of Ruby the default, you can use the -default flag. You should see something like ruby 2.5.1p57 ( revision 63029). Once that's done, installing a version of Ruby is so easy. If you are on a mac, you can just copy paste these two lines into your terminal (see the RVM install page and the post install configuration section for more info). To get that, I always use a separate gemset for each project. The reason I'm using RVM is because it makes it easy to switch from one project to the next, and have all the dependencies in a separate folder that is specific to that project. I've grown accustomed to RVM, and so I'm going to show you how to install Ruby using RVM. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |