mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
Fix for can_create? weirdness
This commit is contained in:
parent
5f0d09b5f1
commit
24eb454f11
2 changed files with 5 additions and 8 deletions
|
@ -99,8 +99,8 @@ class Issue < ActiveRecord::Base
|
||||||
cuser and !cuser.nil? and ((author == cuser) or cuser.admin?)
|
cuser and !cuser.nil? and ((author == cuser) or cuser.admin?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_create? cuser, params = {}
|
def can_create? cuser
|
||||||
Verification.contain params, [:title, :category_id, :text]
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_update? cuser
|
def can_update? cuser
|
||||||
|
|
|
@ -35,12 +35,9 @@ describe 'User' do
|
||||||
expect(issue.can_show? user).to be_false
|
expect(issue.can_show? user).to be_false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe 'can_create? is weird and broken' do
|
describe 'can_create?' do
|
||||||
it "returns true if no params" do
|
it "returns true" do
|
||||||
expect(issue.can_create? user).to be_true
|
expect(issue.can_create? nil).to be_true
|
||||||
end
|
|
||||||
it 'returns false if no params' do
|
|
||||||
expect(issue.can_create? user, {foo: "bar"}).to be_false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe 'can_update?' do
|
describe 'can_update?' do
|
||||||
|
|
Loading…
Reference in a new issue