Skip to content

Instantly share code, notes, and snippets.

@gkop
Created October 31, 2012 02:40
Show Gist options
  • Save gkop/3984493 to your computer and use it in GitHub Desktop.
Save gkop/3984493 to your computer and use it in GitHub Desktop.
10/30 Rails class
# this goes in config/
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test: &test
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
cucumber:
<<: *test
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# authentication
gem 'devise'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# fancy REPL (IRB replacement)
gem 'pry'
# turns pry into a full-fledged debugger
gem 'pry-nav'
gem 'sqlite3'
# take people's money
gem 'stripe'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platform => :ruby
gem 'uglifier', '>= 1.0.3'
end
group :test do
gem 'cucumber-rails', :require => false
# database_cleaner is not required, but highly recommended
gem 'database_cleaner'
gem 'rspec-rails'
end
gem 'jquery-rails'
Feature: Make a blog post
Scenario: Make post with uploaded photo
Given I am a logged in user
And I am on the new post page
When I fill in "Name" with "Stewie"
And I fill in "Title" with "Woof woof"
And I fill in "Content" with "Look at this bone I found"
And I click "Create Post"
#And I attach the file "spec/data/ring_nebula_1987.jpg" to "artwork_image"
Then I should see "Post was successfully created."
And I should see "Stewie"
And I should see "Woof woof"
And I should see "Look at this bone I found"
# this goes in features/step_definitions/
Given /^I am a logged in user$/ do
# Getting things set up
@current_user = User.new
@current_user.email = "gabe@example.com"
@current_user.password = "password"
@current_user.password_confirmation = "password"
@current_user.save
visit "/users/sign_in"
fill_in "user_email", :with => "gabe@example.com"
fill_in "user_password", :with => "password"
click_button "Sign in"
page.should have_content("Signed in successfully.")
end
Given /^I am on the new post page$/ do
visit "/posts/new"
end
When /^I fill in "(.*?)" with "(.*?)"$/ do |field, value|
fill_in field, :with => value
end
When /^I click "(.*?)"$/ do |button|
click_button button
end
Then /^I should see "(.*?)"$/ do |text|
page.should have_content(text)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment