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