adds organization factory and refactors ability_spec
This commit is contained in:
@@ -8,6 +8,13 @@ FactoryGirl.define do
|
|||||||
confirmed_at { Time.now }
|
confirmed_at { Time.now }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
factory :organization, class: User do
|
||||||
|
organization_name 'org'
|
||||||
|
sequence(:email) { |n| "org#{n}@madrid.es" }
|
||||||
|
password 'pleaseverifyme'
|
||||||
|
confirmed_at { Time.now }
|
||||||
|
end
|
||||||
|
|
||||||
factory :debate do
|
factory :debate do
|
||||||
sequence(:title) {|n| "Debate #{n} title"}
|
sequence(:title) {|n| "Debate #{n} title"}
|
||||||
description 'Debate description'
|
description 'Debate description'
|
||||||
@@ -39,4 +46,6 @@ FactoryGirl.define do
|
|||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ describe Ability do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "Organization" do
|
describe "Organization" do
|
||||||
let(:user) { create(:user, organization_name: "Organization") }
|
let(:user) { create(:organization) }
|
||||||
|
|
||||||
it { should be_able_to(:show, user) }
|
it { should be_able_to(:show, user) }
|
||||||
it { should be_able_to(:edit, user) }
|
it { should be_able_to(:edit, user) }
|
||||||
|
|||||||
Reference in New Issue
Block a user