Mattscilipoti-model_steps is a project mainly written in Ruby, based on the MIT license.
Step Definitions for cucumber which support ActiveRecord Models
= mattscilipoti-model_steps
Attempt to answer 4 needs:
Attempt:
Assume: User belongs_to Organization User has_many Courses Course belongs_to Topic User has_friendly_id :login
Note: it is dependent on friendly_id: http://github.com/norman/friendly_id
General: a step that ends in colon (:) expects a cucumber table.
This will call: Factory(:user, :login => 'tester', :first_name => 'joe', :last_name => 'tester') Factory(:user, :login => 'anon', :first_name => 'John', :last_name => 'Doe')
Comparison:
pickle:
Single:
Given a user exists with login: "tester", first_name: "joe", last_name: "tester"
Multiple:
Given the following Users exist
|login |first_name |last_name |
|tester |joe |tester |
|anon |John |Doe |
factory_girl: Given
Possible options: User:"Matt" User|matt
This will identify that 'role' is an association and perform the equivalent of: Role.find_by_name('Admin') || Factory(:role, :name => 'Admin') #using Factory(:role, Topic.friendly_column_name => 'Admin')
B. ModelA has many ModelBs Given User:Matt has these Courses: |name |topic | |B101 |Biology | |CS101 |CompSci |
Executes:
Factory(:user, :course => :name => 'B101', :topic => Topic.find('Biology') || Factory(:topic, Topic.friendly_column_name => 'biology'))
Factory(:user, :course => :name => 'CS101', :topic => Topic.find('CompSci'))
Executes: Factory(:user_admin, :name => 'Jane')
Given a User(with associations) exists
Executes: Factory(:user_with_associations)
== Note on Patches/Pull Requests
== Thanks for your help and patches!
ccahoon, ngauthier
== Copyright
Copyright (c) 2009-10 Matt Scilipoti. See LICENSE for details.