saucy 0.2.40 → 0.2.41

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,6 @@
10
10
  :admins => current_account.admins %>
11
11
  <%= form.buttons do -%>
12
12
  <%= form.commit_button %>
13
- <%= link_to 'Cancel', account_projects_path(current_account) %>
13
+ <li><%= link_to 'Cancel', account_projects_path(current_account) %></li>
14
14
  <% end -%>
15
15
  <% end -%>
@@ -3,8 +3,9 @@ module Saucy
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- before_filter :authorize_admin, :except => [:show]
7
- before_filter :ensure_active_account, :only => [:show, :destroy, :index]
6
+ before_filter :authorize_member, :only => :show
7
+ before_filter :authorize_admin, :except => [:show]
8
+ before_filter :ensure_active_account, :only => [:show, :destroy, :index]
8
9
  layout Saucy::Layouts.to_proc
9
10
  end
10
11
 
@@ -24,12 +25,11 @@ module Saucy
24
25
  end
25
26
 
26
27
  def edit
27
- @project = ::Project.find_by_keyword!(params[:id])
28
+ current_project
28
29
  end
29
30
 
30
31
  def update
31
- @project = ::Project.find_by_keyword!(params[:id])
32
- if @project.update_attributes params[:project]
32
+ if current_project.update_attributes params[:project]
33
33
  flash[:success] = 'Project was updated.'
34
34
  redirect_to account_projects_url(current_account)
35
35
  else
@@ -38,19 +38,24 @@ module Saucy
38
38
  end
39
39
 
40
40
  def show
41
- @project = ::Project.find_by_keyword!(params[:id])
41
+ current_project
42
42
  end
43
43
 
44
44
  def destroy
45
- @project = ::Project.find_by_keyword!(params[:id])
46
- @project.destroy
45
+ current_project.destroy
47
46
  flash[:success] = "Project has been deleted"
48
- redirect_to account_projects_url(@project.account)
47
+ redirect_to account_projects_url(current_project.account)
49
48
  end
50
49
 
51
50
  def index
52
51
  @projects = current_account.projects
53
52
  end
53
+
54
+ private
55
+
56
+ def current_project
57
+ @project ||= ::Project.find_by_keyword!(params[:id])
58
+ end
54
59
  end
55
60
  end
56
61
  end
@@ -30,6 +30,19 @@ describe ProjectsController, "new", :as => :account_admin do
30
30
  end
31
31
  end
32
32
 
33
+ describe ProjectsController, "#show as another user" do
34
+ let(:account) { Factory(:account) }
35
+ let(:user) { Factory(:user) }
36
+ let(:project) { Factory(:project) }
37
+ before do
38
+ sign_in_as(user)
39
+ get :show, :account_id => account.to_param, :id => project.to_param
40
+ end
41
+
42
+ it { should respond_with(:redirect) }
43
+ it { should set_the_flash.to(/do not have permission/) }
44
+ end
45
+
33
46
  describe ProjectsController, "create", :as => :account_admin do
34
47
  before do
35
48
  @project_count = Project.count
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saucy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 71
5
- prerelease:
4
+ hash: 69
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 40
10
- version: 0.2.40
9
+ - 41
10
+ version: 0.2.41
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc.
@@ -18,11 +18,10 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-03-10 00:00:00 -05:00
21
+ date: 2011-03-11 00:00:00 -05:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
- type: :runtime
26
25
  requirement: &id001 !ruby/object:Gem::Requirement
27
26
  none: false
28
27
  requirements:
@@ -33,11 +32,11 @@ dependencies:
33
32
  - 1
34
33
  - 2
35
34
  version: "1.2"
36
- version_requirements: *id001
35
+ type: :runtime
37
36
  name: formtastic
38
37
  prerelease: false
38
+ version_requirements: *id001
39
39
  - !ruby/object:Gem::Dependency
40
- type: :runtime
41
40
  requirement: &id002 !ruby/object:Gem::Requirement
42
41
  none: false
43
42
  requirements:
@@ -49,11 +48,11 @@ dependencies:
49
48
  - 0
50
49
  - 3
51
50
  version: 3.0.3
52
- version_requirements: *id002
51
+ type: :runtime
53
52
  name: railties
54
53
  prerelease: false
54
+ version_requirements: *id002
55
55
  - !ruby/object:Gem::Dependency
56
- type: :runtime
57
56
  requirement: &id003 !ruby/object:Gem::Requirement
58
57
  none: false
59
58
  requirements:
@@ -65,11 +64,11 @@ dependencies:
65
64
  - 6
66
65
  - 2
67
66
  version: 2.6.2
68
- version_requirements: *id003
67
+ type: :runtime
69
68
  name: braintree
70
69
  prerelease: false
70
+ version_requirements: *id003
71
71
  - !ruby/object:Gem::Dependency
72
- type: :runtime
73
72
  requirement: &id004 !ruby/object:Gem::Requirement
74
73
  none: false
75
74
  requirements:
@@ -81,11 +80,11 @@ dependencies:
81
80
  - 3
82
81
  - 3
83
82
  version: 1.3.3
84
- version_requirements: *id004
83
+ type: :runtime
85
84
  name: sham_rack
86
85
  prerelease: false
86
+ version_requirements: *id004
87
87
  - !ruby/object:Gem::Dependency
88
- type: :runtime
89
88
  requirement: &id005 !ruby/object:Gem::Requirement
90
89
  none: false
91
90
  requirements:
@@ -97,11 +96,11 @@ dependencies:
97
96
  - 1
98
97
  - 2
99
98
  version: 1.1.2
100
- version_requirements: *id005
99
+ type: :runtime
101
100
  name: sinatra
102
101
  prerelease: false
102
+ version_requirements: *id005
103
103
  - !ruby/object:Gem::Dependency
104
- type: :development
105
104
  requirement: &id006 !ruby/object:Gem::Requirement
106
105
  none: false
107
106
  requirements:
@@ -113,9 +112,10 @@ dependencies:
113
112
  - 2
114
113
  - 6
115
114
  version: 0.2.6
116
- version_requirements: *id006
115
+ type: :development
117
116
  name: aruba
118
117
  prerelease: false
118
+ version_requirements: *id006
119
119
  description: Clearance-based Rails engine for Software as a Service (Saas) that provides account and project management
120
120
  email: support@thoughtbot.com
121
121
  executables: []
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
291
  requirements: []
292
292
 
293
293
  rubyforge_project:
294
- rubygems_version: 1.6.1
294
+ rubygems_version: 1.3.7
295
295
  signing_key:
296
296
  specification_version: 3
297
297
  summary: Clearance-based Rails engine for SaaS