September 22, 2010
Comments Off
group :development do
gem ‘rspec-rails’, ’2.0.0.beta.18′
end
group :test do
gem ‘rspec’, ’2.0.0.beta.18′
end
save gemfile
do “bundle install” in terminal or command line
to use rspec instead of rails default test::unit you have to:
rails generate rspec:install
if you are using git you can remove the tests for views and helpers
git rm -r spec/helpers
git rm -r spec/views
rspec spec/:
rspec runs the program and spec/ runs the particular directory.
rspec results come green and red. green means the test passes while red means it fails.
TTD writes a failing test first to make sure we are testing for the right thing.
describe “GET ‘about’” do
it “should be successful” do
get ‘about’
response.should be_success
end
end
the first line will be the REST function for the about page. the 2nd line will be what is spit back out. the third line will get that page, and the 4th line is the method performed in the test.
“render_views” must be added to test the views along with the controller.
this test should fail because there is no about page.
September 12, 2010
Comments Off
Once again, this is more for my benefit than anything else since I keep forgetting how to upload the app through the command line.
*Make sure you have the heroku gem. If not, I suggest you do that through the command line.
$ heroku create
$ git push heroku master (this is assuming you have already pushed your project up to github.com
$ heroku rake db:migrate (if you already have models created in for your database, then this will merge whatever’s in it)
if you have data that would also like to upload then:
(sudo) install gem taps
$ heroku db:push
September 10, 2010
Comments Off
This is mainly for me, since I cant seem to memorize this process.
After creating the gemfile, go ahead do the bundle install in the command line, or terminal. Then:
git init
git add .
git commit -m “message”
git remote add origin git@github.com:git_username/app_name.git
git push origin master