adds organization factory and refactors ability_spec

This commit is contained in:
kikito
2015-08-12 18:24:57 +02:00
parent 674e2c5b8c
commit cb301c4426
2 changed files with 10 additions and 1 deletions

View File

@@ -8,6 +8,13 @@ FactoryGirl.define do
confirmed_at { Time.now }
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
sequence(:title) {|n| "Debate #{n} title"}
description 'Debate description'
@@ -39,4 +46,6 @@ FactoryGirl.define do
user
end
end

View File

@@ -46,7 +46,7 @@ describe Ability do
end
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(:edit, user) }