Created
April 7, 2009 18:11
-
-
Save edavis10/91368 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ################################################## | |
| # Factory girl | |
| ################################################## | |
| # Redmine specific Factories | |
| Factory.define :user do |u| | |
| u.mail { Faker::Internet.email } | |
| u.firstname { Faker::Name.first_name } | |
| u.lastname { Faker::Name.last_name } | |
| u.login { Faker::Internet.user_name } | |
| end | |
| Factory.define :project do |p| | |
| p.name { Faker::Name.name } | |
| p.identifier { Faker::Internet.domain_word.downcase } | |
| p.enabled_modules {|modules| | |
| mod = [] | |
| ['issue_tracking', 'statuses'].each do |name| | |
| mod << modules.association(:enabled_module, :name => name) | |
| end | |
| mod | |
| } | |
| end | |
| Factory.define :enabled_module do |em| | |
| em.name { 'issue_tracking' } | |
| end | |
| Factory.define :member do |m| | |
| m.project {|project| project.association(:project) } | |
| m.user {|user| user.association(:user) } | |
| m.role {|role| role.association(:role) } | |
| end | |
| Factory.sequence :role_position do |n| | |
| n | |
| end | |
| Factory.define :role do |r| | |
| r.name { Faker::Name.name } | |
| r.position { Factory.next :role_position } | |
| r.permissions { [ :view_statuses ] } | |
| end | |
| # Plugin specific Factories | |
| Factory.define :status do |s| | |
| s.user {|user| user.association(:user)} | |
| s.project {|project| project.association(:project)} | |
| s.message { Faker::Company.bs } | |
| end | |
| ################################################## | |
| # Machinist | |
| ################################################## | |
| # Redmine Shams | |
| Sham.mail { Faker::Internet.email } | |
| Sham.name { Faker::Name.name } | |
| Sham.firstname { Faker::Name.first_name } | |
| Sham.lastname { Faker::Name.last_name } | |
| Sham.login { Faker::Internet.user_name } | |
| Sham.project_name { Faker::Company.name } | |
| Sham.identifier { Faker::Internet.domain_word.downcase } | |
| Sham.message { Faker::Company.bs } | |
| Sham.position {|index| index } | |
| # Plugin Shams | |
| Sham.permissions { | |
| [ | |
| :view_statuses | |
| ] | |
| } | |
| # Redmine specific blueprints | |
| User.blueprint do | |
| firstname | |
| lastname | |
| login | |
| end | |
| Project.blueprint do | |
| name { Sham.project_name } | |
| identifier | |
| enabled_modules | |
| end | |
| def make_project_with_enabled_modules(attributes = {}) | |
| Project.make(attributes) do |project| | |
| ['issue_tracking', 'statuses'].each do |name| | |
| project.enabled_modules.make(:name => name) | |
| end | |
| end | |
| end | |
| EnabledModule.blueprint do | |
| project | |
| name { 'issue_tracking' } | |
| end | |
| Member.blueprint do | |
| project | |
| user | |
| role | |
| end | |
| Role.blueprint do | |
| name | |
| position | |
| permissions | |
| end | |
| # Plugin specific blueprints | |
| Status.blueprint do | |
| user | |
| project | |
| message | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment