artisan-core 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/artisan/activity/activity_interactor.rb +18 -0
- data/lib/artisan/activity/activity_presenter.rb +35 -0
- data/lib/artisan/activity/formatters/diff_changes.rb +41 -0
- data/lib/artisan/activity/formatters/name.rb +22 -0
- data/lib/artisan/activity/formatters/source.rb +16 -0
- data/lib/artisan/activity/formatters/temporal.rb +20 -0
- data/lib/artisan/activity/iteration_auditor.rb +44 -0
- data/lib/artisan/activity/project_auditor.rb +28 -0
- data/lib/artisan/activity/story_auditor.rb +42 -0
- data/lib/artisan/callbacks.rb +27 -0
- data/lib/artisan/crud_strategy.rb +23 -0
- data/lib/artisan/event_mailer.rb +22 -0
- data/lib/artisan/inviter.rb +36 -0
- data/lib/artisan/iterations/iteration_point_calculator.rb +28 -0
- data/lib/artisan/iterations/iteration_presenter.rb +20 -0
- data/lib/artisan/iterations/iteration_workflow_interactor.rb +60 -0
- data/lib/artisan/iterations/iteration_workflow_presenter.rb +11 -0
- data/lib/artisan/iterations/iterations.rb +47 -0
- data/lib/artisan/iterations/iterations_interactor.rb +48 -0
- data/lib/artisan/iterations/move_to_backlog.rb +28 -0
- data/lib/artisan/iterations/story_tags.rb +15 -0
- data/lib/artisan/member.rb +52 -0
- data/lib/artisan/no_op_callbacks.rb +6 -0
- data/lib/artisan/projects/api_key_generator.rb +26 -0
- data/lib/artisan/projects/archive_interactor.rb +29 -0
- data/lib/artisan/projects/completed_stories_presenter.rb +20 -0
- data/lib/artisan/projects/iteration_numberer.rb +15 -0
- data/lib/artisan/projects/project_creator.rb +51 -0
- data/lib/artisan/projects/projects_interactor.rb +58 -0
- data/lib/artisan/projects/projects_presenter.rb +46 -0
- data/lib/artisan/projects/story_point_summer.rb +16 -0
- data/lib/artisan/reports/average_stat_per_iteration_data.rb +55 -0
- data/lib/artisan/reports/burn_up_chart.rb +46 -0
- data/lib/artisan/reports/high_charts_data_retriever.rb +77 -0
- data/lib/artisan/reports/high_charts_interactor.rb +31 -0
- data/lib/artisan/reports/percentage_of_commitments_met_data.rb +47 -0
- data/lib/artisan/reports/signoff/pdf.rb +161 -0
- data/lib/artisan/reports/signoff/report.rb +120 -0
- data/lib/artisan/reports/velocity_report.rb +43 -0
- data/lib/artisan/repository.rb +51 -0
- data/lib/artisan/stories/pert_calculator.rb +62 -0
- data/lib/artisan/stories/stories_interactor.rb +78 -0
- data/lib/artisan/stories/story_collection.rb +66 -0
- data/lib/artisan/stories/story_exporter.rb +45 -0
- data/lib/artisan/stories/story_numberer.rb +15 -0
- data/lib/artisan/stories/story_presenter.rb +23 -0
- data/lib/artisan/stories/story_sorter.rb +37 -0
- data/lib/artisan/story_board.rb +45 -0
- data/lib/artisan/story_column_changer.rb +71 -0
- data/lib/artisan/story_exporter.rb +14 -0
- data/lib/artisan/team.rb +50 -0
- data/spec/crud_strategy_spec.rb +100 -0
- data/spec/event_mailer_spec.rb +86 -0
- data/spec/inviter_spec.rb +58 -0
- data/spec/member_spec.rb +58 -0
- data/spec/repository_spec.rb +32 -0
- data/spec/story_board_spec.rb +36 -0
- data/spec/story_collection_spec.rb +61 -0
- data/spec/story_column_changer_spec.rb +222 -0
- data/spec/story_exporter_spec.rb +25 -0
- data/spec/story_sorter_spec.rb +67 -0
- data/spec/team_spec.rb +107 -0
- metadata +128 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'artisan/story_exporter'
|
2
|
+
|
3
|
+
class Story;end;
|
4
|
+
|
5
|
+
describe StoryExporter do
|
6
|
+
|
7
|
+
context "#to_json" do
|
8
|
+
|
9
|
+
it "exports null to empty" do
|
10
|
+
StoryExporter.new(nil).to_json.should == "{}"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns empty hash if there is no story" do
|
14
|
+
StoryExporter.new(nil).to_json.should == "{}"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "calls to_json on the model" do
|
18
|
+
story = mock(Story)
|
19
|
+
story.should_receive(:to_json).with(:except => StoryExporter::UNNECESSARY_FIELDS, :include => {:assigned_user => {:only => :full_name, :methods => [:gravatar_url]}}).and_return("some_json")
|
20
|
+
StoryExporter.new(story).to_json.should == "some_json"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "artisan/stories/story_sorter"
|
2
|
+
require "artisan/stories/stories_interactor"
|
3
|
+
require "artisan-memory-repository/models/project"
|
4
|
+
require "artisan-memory-repository/models/user"
|
5
|
+
require "artisan-memory-repository/models/iteration"
|
6
|
+
require "artisan-memory-repository/models/story"
|
7
|
+
require "active_support/all"
|
8
|
+
|
9
|
+
describe Artisan::Stories::StorySorter do
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
@project = Artisan::Repository.project.create(:name => "project")
|
13
|
+
@project.stories = []
|
14
|
+
@project.stories.stub!(:where).and_return(@project.stories)
|
15
|
+
|
16
|
+
@iteration = Artisan::Repository.iteration.new(:start_date => "2011-01-01", :finish_date => "2011-01-02")
|
17
|
+
@iteration.stories = []
|
18
|
+
@project.iterations = [@iteration]
|
19
|
+
|
20
|
+
@user = Artisan::Repository.user.new(:email => "test@example.com", :login => "login", :full_name => "some name")
|
21
|
+
end
|
22
|
+
|
23
|
+
#TODO - PWP - intermitten failure
|
24
|
+
it "should save order in the backlog" do
|
25
|
+
story1 = Artisan::Repository.story.new(:name => 'story1')
|
26
|
+
story2 = Artisan::Repository.story.new(:name => 'story2')
|
27
|
+
story3 = Artisan::Repository.story.new(:name => 'story3')
|
28
|
+
|
29
|
+
@project.stories << story1
|
30
|
+
@project.stories << story2
|
31
|
+
@project.stories << story3
|
32
|
+
@project.stories.stub!(:backlog).and_return(@project.stories)
|
33
|
+
|
34
|
+
Artisan::Stories::StorySorter.new(@project, 'backlog', [story2.id.to_s, story3.id.to_s, story1.id.to_s], @iteration).sort
|
35
|
+
|
36
|
+
Artisan::Stories::StoriesInteractor.new(@project.id, nil).backlog.stories.sort_by{|story| story.position}.map(&:name).should == ["story2", "story3", "story1"]
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should save order in the ready column" do
|
40
|
+
story1 = Artisan::Repository.story.new(:name => 'story1')
|
41
|
+
story2 = Artisan::Repository.story.new(:name => 'story2')
|
42
|
+
story3 = Artisan::Repository.story.new(:name => 'story3')
|
43
|
+
|
44
|
+
@iteration.stories << story1
|
45
|
+
@iteration.stories << story2
|
46
|
+
@iteration.stories << story3
|
47
|
+
|
48
|
+
@iteration.stories.should_receive(:ready).and_return(@iteration.stories)
|
49
|
+
|
50
|
+
Artisan::Stories::StorySorter.new(@project, 'ready', [story2.id.to_s, story3.id.to_s, story1.id.to_s], @iteration).sort
|
51
|
+
|
52
|
+
story2.position.should == 1
|
53
|
+
story3.position.should == 2
|
54
|
+
story1.position.should == 3
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should not blow up if it doesn't have the story" do
|
58
|
+
story = Artisan::Repository.story.new(:name => 'story1', :assigned_user => @user, :complete => true, :accepted_at => Date.today, :accepted_by_user => @user)
|
59
|
+
@iteration.stories << story
|
60
|
+
@iteration.stories.should_receive(:accepted).and_return(@iteration.stories)
|
61
|
+
|
62
|
+
Artisan::Stories::StorySorter.new(@project, 'accepted', [story.id.to_s, 233], @iteration).sort
|
63
|
+
|
64
|
+
story.position.should == 1
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
data/spec/team_spec.rb
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
require "artisan/team"
|
2
|
+
require "artisan-memory-repository/user_repository"
|
3
|
+
require "artisan-memory-repository/project_repository"
|
4
|
+
require "artisan/member"
|
5
|
+
|
6
|
+
require 'spec_helper'
|
7
|
+
|
8
|
+
class Member;end;
|
9
|
+
|
10
|
+
|
11
|
+
describe Team, "add team member" do
|
12
|
+
let(:project_repo) { Artisan::Repository.project }
|
13
|
+
let(:user_repo) { Artisan::Repository.user }
|
14
|
+
let(:project) { project_repo.create }
|
15
|
+
|
16
|
+
let(:current_user) do
|
17
|
+
user_repo.create(:full_name => "paul", :login => "anothertest")
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:new_user) do
|
21
|
+
user_repo.create(:full_name => "a name", :login => "a-testtest")
|
22
|
+
end
|
23
|
+
|
24
|
+
before(:each) { user_repo.destroy_all }
|
25
|
+
|
26
|
+
it "only lets an admin add a project" do
|
27
|
+
user_management = Team.new(project, nil)
|
28
|
+
user_management.add_team_member(new_user)
|
29
|
+
user_management.user?(new_user).should be_true
|
30
|
+
end
|
31
|
+
|
32
|
+
it "adds new owners" do
|
33
|
+
user_management = Team.new(project, nil)
|
34
|
+
user_management.add_team_owner(new_user)
|
35
|
+
user_management.owner?(new_user).should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "doesn't add another record if the user is already on the project" do
|
39
|
+
project_repo.add_member(project, current_user, true)
|
40
|
+
user_management = Team.new(project, nil)
|
41
|
+
project.users.size.should == 1
|
42
|
+
end
|
43
|
+
|
44
|
+
it "is an owner of the project" do
|
45
|
+
project_repo.add_member(project, current_user, true)
|
46
|
+
|
47
|
+
Team.new(project, nil).owner?(current_user).should be_true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "is not an owner if there is no project" do
|
51
|
+
Team.new(nil, nil).owner?(current_user).should be_false
|
52
|
+
end
|
53
|
+
|
54
|
+
it "user doesn't have the project" do
|
55
|
+
Team.new(project, nil).owner?(current_user).should be_false
|
56
|
+
end
|
57
|
+
|
58
|
+
it "user isn't the owner" do
|
59
|
+
Team.new(project, nil).owner?(current_user).should be_false
|
60
|
+
end
|
61
|
+
|
62
|
+
it "is a user of the project" do
|
63
|
+
project_repo.add_member(project, current_user, false)
|
64
|
+
|
65
|
+
Team.new(project, nil).owner?(current_user).should be_false
|
66
|
+
Team.new(project, nil).user?(current_user).should be_true
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
describe Team, "#owners" do
|
71
|
+
it "lists owners" do
|
72
|
+
project_repo.add_member(project, current_user, true)
|
73
|
+
project_repo.add_member(project, new_user, true)
|
74
|
+
|
75
|
+
owners = Team.new(project, nil).owners
|
76
|
+
owners.should be_include(new_user)
|
77
|
+
owners.should be_include(current_user)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
describe "user_management#remove_user" do
|
83
|
+
|
84
|
+
it "doesn't blow up if you can't find the user" do
|
85
|
+
Team.new(project, current_user).remove_user(new_user)
|
86
|
+
lambda{Team.new(project, current_user).remove_user(new_user)}.should_not raise_error
|
87
|
+
end
|
88
|
+
|
89
|
+
it "removes the user" do
|
90
|
+
project_repo.add_member(project, new_user, false)
|
91
|
+
|
92
|
+
Team.new(project, nil).remove_user(new_user)
|
93
|
+
|
94
|
+
project_repo.is_member?(project, new_user).should be_false
|
95
|
+
end
|
96
|
+
|
97
|
+
it "takes the user off the email lists when removed" do
|
98
|
+
@members = double(:remove_from_email_lists => nil)
|
99
|
+
Artisan::Member.stub!(:new).and_return(@members)
|
100
|
+
@members.should_receive(:remove_from_email_lists)
|
101
|
+
|
102
|
+
project_repo.add_member(project, new_user, false)
|
103
|
+
|
104
|
+
Team.new(project, nil).remove_user(new_user)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: artisan-core
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- 8th Light Craftsmen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2012-10-10 00:00:00 Z
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Artisan Core behavior
|
17
|
+
email: paul@8thlight.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- lib/artisan/activity/activity_interactor.rb
|
26
|
+
- lib/artisan/activity/activity_presenter.rb
|
27
|
+
- lib/artisan/activity/formatters/diff_changes.rb
|
28
|
+
- lib/artisan/activity/formatters/name.rb
|
29
|
+
- lib/artisan/activity/formatters/source.rb
|
30
|
+
- lib/artisan/activity/formatters/temporal.rb
|
31
|
+
- lib/artisan/activity/iteration_auditor.rb
|
32
|
+
- lib/artisan/activity/project_auditor.rb
|
33
|
+
- lib/artisan/activity/story_auditor.rb
|
34
|
+
- lib/artisan/callbacks.rb
|
35
|
+
- lib/artisan/crud_strategy.rb
|
36
|
+
- lib/artisan/event_mailer.rb
|
37
|
+
- lib/artisan/inviter.rb
|
38
|
+
- lib/artisan/iterations/iteration_point_calculator.rb
|
39
|
+
- lib/artisan/iterations/iteration_presenter.rb
|
40
|
+
- lib/artisan/iterations/iteration_workflow_interactor.rb
|
41
|
+
- lib/artisan/iterations/iteration_workflow_presenter.rb
|
42
|
+
- lib/artisan/iterations/iterations.rb
|
43
|
+
- lib/artisan/iterations/iterations_interactor.rb
|
44
|
+
- lib/artisan/iterations/move_to_backlog.rb
|
45
|
+
- lib/artisan/iterations/story_tags.rb
|
46
|
+
- lib/artisan/member.rb
|
47
|
+
- lib/artisan/no_op_callbacks.rb
|
48
|
+
- lib/artisan/projects/api_key_generator.rb
|
49
|
+
- lib/artisan/projects/archive_interactor.rb
|
50
|
+
- lib/artisan/projects/completed_stories_presenter.rb
|
51
|
+
- lib/artisan/projects/iteration_numberer.rb
|
52
|
+
- lib/artisan/projects/project_creator.rb
|
53
|
+
- lib/artisan/projects/projects_interactor.rb
|
54
|
+
- lib/artisan/projects/projects_presenter.rb
|
55
|
+
- lib/artisan/projects/story_point_summer.rb
|
56
|
+
- lib/artisan/reports/average_stat_per_iteration_data.rb
|
57
|
+
- lib/artisan/reports/burn_up_chart.rb
|
58
|
+
- lib/artisan/reports/high_charts_data_retriever.rb
|
59
|
+
- lib/artisan/reports/high_charts_interactor.rb
|
60
|
+
- lib/artisan/reports/percentage_of_commitments_met_data.rb
|
61
|
+
- lib/artisan/reports/signoff/pdf.rb
|
62
|
+
- lib/artisan/reports/signoff/report.rb
|
63
|
+
- lib/artisan/reports/velocity_report.rb
|
64
|
+
- lib/artisan/repository.rb
|
65
|
+
- lib/artisan/stories/pert_calculator.rb
|
66
|
+
- lib/artisan/stories/stories_interactor.rb
|
67
|
+
- lib/artisan/stories/story_collection.rb
|
68
|
+
- lib/artisan/stories/story_exporter.rb
|
69
|
+
- lib/artisan/stories/story_numberer.rb
|
70
|
+
- lib/artisan/stories/story_presenter.rb
|
71
|
+
- lib/artisan/stories/story_sorter.rb
|
72
|
+
- lib/artisan/story_board.rb
|
73
|
+
- lib/artisan/story_column_changer.rb
|
74
|
+
- lib/artisan/story_exporter.rb
|
75
|
+
- lib/artisan/team.rb
|
76
|
+
- spec/crud_strategy_spec.rb
|
77
|
+
- spec/event_mailer_spec.rb
|
78
|
+
- spec/inviter_spec.rb
|
79
|
+
- spec/member_spec.rb
|
80
|
+
- spec/repository_spec.rb
|
81
|
+
- spec/story_board_spec.rb
|
82
|
+
- spec/story_collection_spec.rb
|
83
|
+
- spec/story_column_changer_spec.rb
|
84
|
+
- spec/story_exporter_spec.rb
|
85
|
+
- spec/story_sorter_spec.rb
|
86
|
+
- spec/team_spec.rb
|
87
|
+
homepage: http://8thlight.com
|
88
|
+
licenses: []
|
89
|
+
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: -751255112709990634
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: "0"
|
110
|
+
requirements: []
|
111
|
+
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 1.8.24
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: Artisan Core
|
117
|
+
test_files:
|
118
|
+
- spec/crud_strategy_spec.rb
|
119
|
+
- spec/event_mailer_spec.rb
|
120
|
+
- spec/inviter_spec.rb
|
121
|
+
- spec/member_spec.rb
|
122
|
+
- spec/repository_spec.rb
|
123
|
+
- spec/story_board_spec.rb
|
124
|
+
- spec/story_collection_spec.rb
|
125
|
+
- spec/story_column_changer_spec.rb
|
126
|
+
- spec/story_exporter_spec.rb
|
127
|
+
- spec/story_sorter_spec.rb
|
128
|
+
- spec/team_spec.rb
|