@@ -25,5 +25,5 config.action_controller.session = { | |||||
25 | config.action_controller.allow_forgery_protection = false |
|
25 | config.action_controller.allow_forgery_protection = false | |
26 |
|
26 | |||
27 | config.gem "thoughtbot-shoulda", :lib => "shoulda", :source => "http://gems.github.com" |
|
27 | config.gem "thoughtbot-shoulda", :lib => "shoulda", :source => "http://gems.github.com" | |
28 |
config.gem " |
|
28 | config.gem "edavis10-object_daddy", :lib => "object_daddy" | |
29 | config.gem "mocha" |
|
29 | config.gem "mocha" |
@@ -1,6 +1,7 | |||||
1 | class Issue < ActiveRecord::Base |
|
1 | class Issue < ActiveRecord::Base | |
2 | generator_for :subject, :method => :next_subject |
|
2 | generator_for :subject, :method => :next_subject | |
3 | generator_for :author, :method => :next_author |
|
3 | generator_for :author, :method => :next_author | |
|
4 | generator_for :priority, :method => :fetch_priority | |||
4 |
|
5 | |||
5 | def self.next_subject |
|
6 | def self.next_subject | |
6 | @last_subject ||= 'Subject 0' |
|
7 | @last_subject ||= 'Subject 0' | |
@@ -12,4 +13,8 class Issue < ActiveRecord::Base | |||||
12 | User.generate_with_protected! |
|
13 | User.generate_with_protected! | |
13 | end |
|
14 | end | |
14 |
|
15 | |||
|
16 | def self.fetch_priority | |||
|
17 | IssuePriority.first || IssuePriority.generate! | |||
|
18 | end | |||
|
19 | ||||
15 | end |
|
20 | end |
@@ -1,30 +1,16 | |||||
1 | module ObjectDaddyHelpers |
|
1 | module ObjectDaddyHelpers | |
2 | # TODO: The gem or official version of ObjectDaddy doesn't set |
|
2 | # TODO: Remove these three once everyone has ported their code to use the | |
3 | # protected attributes so they need to be wrapped. |
|
3 | # new object_daddy version with protected attribute support | |
4 | def User.generate_with_protected(attributes={}) |
|
4 | def User.generate_with_protected(attributes={}) | |
5 |
|
|
5 | User.generate(attributes) | |
6 | user.save |
|
|||
7 | user |
|
|||
8 | end |
|
6 | end | |
9 |
|
7 | |||
10 | # TODO: The gem or official version of ObjectDaddy doesn't set |
|
|||
11 | # protected attributes so they need to be wrapped. |
|
|||
12 | def User.generate_with_protected!(attributes={}) |
|
8 | def User.generate_with_protected!(attributes={}) | |
13 |
|
|
9 | User.generate!(attributes) | |
14 | user.save! |
|
|||
15 | user |
|
|||
16 | end |
|
10 | end | |
17 |
|
11 | |||
18 | # TODO: The gem or official version of ObjectDaddy doesn't set |
|
|||
19 | # protected attributes so they need to be wrapped. |
|
|||
20 | def User.spawn_with_protected(attributes={}) |
|
12 | def User.spawn_with_protected(attributes={}) | |
21 |
|
|
13 | User.spawn(attributes) | |
22 | user.login = User.next_login |
|
|||
23 | attributes.each do |attr,v| |
|
|||
24 | user.send("#{attr}=", v) |
|
|||
25 | end |
|
|||
26 | end |
|
|||
27 | user |
|
|||
28 | end |
|
14 | end | |
29 |
|
15 | |||
30 | # Generate the default Query |
|
16 | # Generate the default Query |
@@ -555,7 +555,7 class ProjectTest < ActiveSupport::TestCase | |||||
555 | end |
|
555 | end | |
556 |
|
556 | |||
557 | should "copy issues" do |
|
557 | should "copy issues" do | |
558 |
@source_project.issues << Issue.generate!(:status |
|
558 | @source_project.issues << Issue.generate!(:status => IssueStatus.find_by_name('Closed'), | |
559 | :subject => "copy issue status", |
|
559 | :subject => "copy issue status", | |
560 | :tracker_id => 1, |
|
560 | :tracker_id => 1, | |
561 | :assigned_to_id => 2, |
|
561 | :assigned_to_id => 2, |
General Comments 0
You need to be logged in to leave comments.
Login now