only level 2 users can create spending proposals
This commit is contained in:
@@ -2,14 +2,23 @@ require 'rails_helper'
|
||||
|
||||
feature 'Spending proposals' do
|
||||
|
||||
let(:author) { create(:user, :level_two) }
|
||||
|
||||
scenario 'Index' do
|
||||
visit spending_proposals_path
|
||||
|
||||
expect(page).to_not have_link('Create spending proposal', href: new_spending_proposal_path)
|
||||
expect(page).to have_link('verify your account')
|
||||
|
||||
login_as(author)
|
||||
|
||||
visit spending_proposals_path
|
||||
|
||||
expect(page).to have_link('Create spending proposal', href: new_spending_proposal_path)
|
||||
expect(page).to_not have_link('verify your account')
|
||||
end
|
||||
|
||||
scenario 'Create' do
|
||||
author = create(:user)
|
||||
login_as(author)
|
||||
|
||||
visit new_spending_proposal_path
|
||||
@@ -26,7 +35,7 @@ feature 'Spending proposals' do
|
||||
end
|
||||
|
||||
scenario 'Captcha is required for proposal creation' do
|
||||
login_as(create(:user))
|
||||
login_as(author)
|
||||
|
||||
visit new_spending_proposal_path
|
||||
fill_in 'spending_proposal_title', with: 'Build a skyscraper'
|
||||
@@ -47,7 +56,6 @@ feature 'Spending proposals' do
|
||||
end
|
||||
|
||||
scenario 'Errors on create' do
|
||||
author = create(:user)
|
||||
login_as(author)
|
||||
|
||||
visit new_spending_proposal_path
|
||||
|
||||
@@ -51,4 +51,6 @@ describe "Abilities::Administrator" do
|
||||
it { should_not be_able_to(:comment_as_moderator, proposal) }
|
||||
|
||||
it { should be_able_to(:manage, Annotation) }
|
||||
|
||||
it { should be_able_to(:manage, SpendingProposal) }
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ describe "Abilities::Common" do
|
||||
it { should_not be_able_to(:vote_featured, Proposal) }
|
||||
|
||||
it { should be_able_to(:index, SpendingProposal) }
|
||||
it { should be_able_to(:create, SpendingProposal) }
|
||||
it { should_not be_able_to(:create, SpendingProposal) }
|
||||
|
||||
it { should_not be_able_to(:comment_as_administrator, debate) }
|
||||
it { should_not be_able_to(:comment_as_moderator, debate) }
|
||||
@@ -87,6 +87,8 @@ describe "Abilities::Common" do
|
||||
|
||||
it { should be_able_to(:vote, Proposal) }
|
||||
it { should be_able_to(:vote_featured, Proposal) }
|
||||
|
||||
it { should be_able_to(:create, SpendingProposal) }
|
||||
end
|
||||
|
||||
describe "when level 3 verified" do
|
||||
@@ -94,5 +96,7 @@ describe "Abilities::Common" do
|
||||
|
||||
it { should be_able_to(:vote, Proposal) }
|
||||
it { should be_able_to(:vote_featured, Proposal) }
|
||||
|
||||
it { should be_able_to(:create, SpendingProposal) }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user