Skip to content

Instantly share code, notes, and snippets.

View seyyah's full-sized avatar

seyyah seyyah

View GitHub Profile
# NOT: v2: <https://gist.github.com/3180446>
# v1
@question_new
Scenario: I should be able to new/create Question
Given I am logged as "author"
And I have "author, osce_author" roles
When I visit the questions list page
And I click link titled "New" in the "Page Header Actions" section
And I fill the form with:
@seyyah
seyyah / gist:3176162
Created July 25, 2012 13:22 — forked from mgreenly/gist:1109325
database cleaner multiple connections single orm outside of rails
RSpec.configure do |config|
config.before(:suite) do
ActiveRecord::Base.establish_connection database['one']
DatabaseCleaner.strategy = :deletion
ActiveRecord::Base.establish_connection config.database['two']
DatabaseCleaner.strategy = :deletion
end
config.before(:each) do
# encoding: utf-8
class User
has_many :questions, foreign_key: 'author_id'
has_many :questions, foreign_key: 'editor_id'
end
class Question
attr_accessible :author, :editor
belongs_to :author, foreign_key: 'author_id', class_name: 'User'
# encoding: utf-8
# vim: tabstop=2:softtabstop=2:shiftwidth=2:noexpandtab
Feature: user ...
Scenario Outline: login
Given I visit "/" page
#And I am not logged in
And an user exists with login "<uname>" and password "<pass>"
And I fill in "username" with "<uname2>"
And I fill in "password" with "<pass2>"
When I press "<action>"
Feature: Forms steps
Steps for various forms interaction
Scenario: Simple form steps
Given I am on the form page
When I fill in "Name" with "my name"
And I fill in "Describe yourself" with:
"""
this usefull
# http://tomafro.net/2009/05/automatching-rails-paths-in-cucumber
module NavigationHelpers
def path_to(page_name)
case page_name
when /the home page/
root_path
when /the new client page/
new_client_path
# http://www.cowboycoded.com/2011/01/05/better-web-steps-for-cucumber-with-capybara/
class String
def csserize
self.downcase.gsub(" ","-")
end
end
module WithinHelpers
def with_scope(locator,css_type=nil)
# http://aslakhellesoy.com/post/11055981222/the-training-wheels-came-off
module LoginSteps
def login(name, password)
visit('/login')
fill_in('User name', with: name)
fill_in('Password', with: password)
click_button('Log in')
end
end
Feature: Sign up
As a site owner
I want users to sign up
So I can establish stronger relationships with my users
Scenario: Sign up
Given I am Fred
When I sign up
Then I should be registered
Feature: Sign in
As a registered user
I want to sign in
So I can be recognised by the site
Scenario: Sign in
Given I am registered as 'Fred'
When I sign in
Then I should be signed in