If this is your first install, create a database with:
initdb /usr/local/var/postgres
If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.0.4/org.postgresql.postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
If this is an upgrade and you already have the org.postgresql.postgres.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
cp /usr/local/Cellar/postgresql/9.0.4/org.postgresql.postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
Or start manually with:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
And stop with:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
If you want to install the postgres gem, including ARCHFLAGS is recommended:
env ARCHFLAGS="-arch x86_64" gem install pg
To install gems without sudo, see the Homebrew wiki.
To Start the server
su postgres
postgres -D /usr/local/var/postgres/data/
Fixing issue with postgres template1 not using utf8 encoding
http://jacobian.org/writing/pg-encoding-ubuntu/
Wednesday, June 1, 2011
Tuesday, May 10, 2011
Using Cucumber to test a CFWheels application
Having developed Rails apps and Coldfusion apps simultaneously for the last few years, it bugged me that there was no easy way to get the benefits of Cucumber while developing a CFWheels application.
Though others have probably been doing something similar for years, it wasn't until today that I realized that there was no reasonable reason why I couldn't, as long as both my rails application and my cfwheels app could reach the same database, then I could use Cucumber, with fixtures, models and DatabaseCleaner, to test the application with some ability to adjust the test data as I went along. Heck, I could even use the models in some step definitions if I wanted to.
I develop on a Mac Book Pro with VMWare running a SQL Server instance. I have previously developed a Rails application that connects to SQL Server and uses Cucumber for testing, so I know that can be done.
So, I created a new Rails app
I edited the Gemfile and added the following (since this 'app' will only be used to run cuc tests, I didn't need to group these statements in a development or test area):
I ran bundle install to ensure I had the gems. Then I ran
to bootstrap the cucumber setup.
I had already added an entry in my hosts file that points to the local host, so I modified my cucumber env file with the following:
I wrote a quick test to see if I could get it to open the browser and point to the login page of the application.
with the following step:
And lo behold, my CFWheels app opened. More on actually running real tests and setting up fixtures in the next post.
Though others have probably been doing something similar for years, it wasn't until today that I realized that there was no reasonable reason why I couldn't, as long as both my rails application and my cfwheels app could reach the same database, then I could use Cucumber, with fixtures, models and DatabaseCleaner, to test the application with some ability to adjust the test data as I went along. Heck, I could even use the models in some step definitions if I wanted to.
I develop on a Mac Book Pro with VMWare running a SQL Server instance. I have previously developed a Rails application that connects to SQL Server and uses Cucumber for testing, so I know that can be done.
So, I created a new Rails app
user$ rails new cfw_cucumber_tests
I edited the Gemfile and added the following (since this 'app' will only be used to run cuc tests, I didn't need to group these statements in a development or test area):
gem 'cucumber'
gem 'cucumber-rails'
gem 'capybara'gem 'database_cleaner'gem 'activerecord-sqlserver-adapter'
I ran bundle install to ensure I had the gems. Then I ran
rails generate cucumber:install
to bootstrap the cucumber setup.
I had already added an entry in my hosts file that points to the local host, so I modified my cucumber env file with the following:
require 'cucumber/rails'
require 'capybara'
require 'capybara/dsl'
require 'capybara/cucumber'
Capybara.default_driver = :selenium
Capybara.app_host = 'http://isaac.local'
World(Capybara)
I wrote a quick test to see if I could get it to open the browser and point to the login page of the application.
Scenario: I can see the home page
Given I am starting on the home page
with the following step:
Given /^I am starting on the home page$/ do
visit('/index.cfm/login')
endAnd lo behold, my CFWheels app opened. More on actually running real tests and setting up fixtures in the next post.
Subscribe to:
Posts (Atom)