Syntax for specs adjusted for consistency reasons
is_expected.to has been replaced by should is_expected.not_to has been replaced by should_not
This commit is contained in:
@@ -104,7 +104,7 @@ describe Abilities::Common do
|
|||||||
|
|
||||||
it { should be_able_to(:destroy, own_budget_investment_image) }
|
it { should be_able_to(:destroy, own_budget_investment_image) }
|
||||||
it { should_not be_able_to(:destroy, budget_investment_image) }
|
it { should_not be_able_to(:destroy, budget_investment_image) }
|
||||||
it { is_expected.not_to be_able_to(:manage, ProposalDashboardAction) }
|
it { should_not be_able_to(:manage, ProposalDashboardAction) }
|
||||||
|
|
||||||
describe 'flagging content' do
|
describe 'flagging content' do
|
||||||
it { should be_able_to(:flag, debate) }
|
it { should be_able_to(:flag, debate) }
|
||||||
@@ -162,16 +162,16 @@ describe Abilities::Common do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'proposals dashboard' do
|
describe 'proposals dashboard' do
|
||||||
it { is_expected.to be_able_to(:dashboard, own_proposal) }
|
it { should be_able_to(:dashboard, own_proposal) }
|
||||||
it { is_expected.not_to be_able_to(:dashboard, proposal) }
|
it { should_not be_able_to(:dashboard, proposal) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'publishing proposals' do
|
describe 'publishing proposals' do
|
||||||
let(:draft_own_proposal) { create(:proposal, :draft, author: user) }
|
let(:draft_own_proposal) { create(:proposal, :draft, author: user) }
|
||||||
|
|
||||||
it { is_expected.to be_able_to(:publish, draft_own_proposal) }
|
it { should be_able_to(:publish, draft_own_proposal) }
|
||||||
it { is_expected.not_to be_able_to(:publish, own_proposal) }
|
it { should_not be_able_to(:publish, own_proposal) }
|
||||||
it { is_expected.not_to be_able_to(:publish, proposal) }
|
it { should_not be_able_to(:publish, proposal) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "when level 2 verified" do
|
describe "when level 2 verified" do
|
||||||
|
|||||||
@@ -34,5 +34,5 @@ describe Abilities::Everyone do
|
|||||||
|
|
||||||
it { should be_able_to(:read_results, finished_budget) }
|
it { should be_able_to(:read_results, finished_budget) }
|
||||||
it { should_not be_able_to(:read_results, reviewing_ballot_budget) }
|
it { should_not be_able_to(:read_results, reviewing_ballot_budget) }
|
||||||
it { is_expected.not_to be_able_to(:manage, ProposalDashboardAction) }
|
it { should_not be_able_to(:manage, ProposalDashboardAction) }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,25 +20,25 @@ describe ProposalDashboardAction do
|
|||||||
let(:request_to_administrators) { true }
|
let(:request_to_administrators) { true }
|
||||||
let(:action_type) { 'resource' }
|
let(:action_type) { 'resource' }
|
||||||
|
|
||||||
it { is_expected.to be_valid }
|
it { should be_valid }
|
||||||
|
|
||||||
context 'when validating title' do
|
context 'when validating title' do
|
||||||
context 'and title is blank' do
|
context 'and title is blank' do
|
||||||
let(:title) { nil }
|
let(:title) { nil }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and title is very short' do
|
context 'and title is very short' do
|
||||||
let(:title) { 'abc' }
|
let(:title) { 'abc' }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and title is very long' do
|
context 'and title is very long' do
|
||||||
let(:title) { 'a' * 81 }
|
let(:title) { 'a' * 81 }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -46,19 +46,19 @@ describe ProposalDashboardAction do
|
|||||||
context 'and description is blank' do
|
context 'and description is blank' do
|
||||||
let(:description) { nil }
|
let(:description) { nil }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and description is very short' do
|
context 'and description is very short' do
|
||||||
let(:description) { 'abc' }
|
let(:description) { 'abc' }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and description is very long' do
|
context 'and description is very long' do
|
||||||
let(:description) { 'a' * 256 }
|
let(:description) { 'a' * 256 }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -66,19 +66,19 @@ describe ProposalDashboardAction do
|
|||||||
context 'and day_offset is nil' do
|
context 'and day_offset is nil' do
|
||||||
let(:day_offset) { nil }
|
let(:day_offset) { nil }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and day_offset is negative' do
|
context 'and day_offset is negative' do
|
||||||
let(:day_offset) { -1 }
|
let(:day_offset) { -1 }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and day_offset is not an integer' do
|
context 'and day_offset is not an integer' do
|
||||||
let(:day_offset) { 1.23 }
|
let(:day_offset) { 1.23 }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -86,19 +86,19 @@ describe ProposalDashboardAction do
|
|||||||
context 'and required_supports is nil' do
|
context 'and required_supports is nil' do
|
||||||
let(:required_supports) { nil }
|
let(:required_supports) { nil }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and required_supports is negative' do
|
context 'and required_supports is negative' do
|
||||||
let(:required_supports) { -1 }
|
let(:required_supports) { -1 }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and required_supports is not an integer' do
|
context 'and required_supports is not an integer' do
|
||||||
let(:required_supports) { 1.23 }
|
let(:required_supports) { 1.23 }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -108,13 +108,13 @@ describe ProposalDashboardAction do
|
|||||||
context 'and no request_to_administrators' do
|
context 'and no request_to_administrators' do
|
||||||
let(:request_to_administrators) { false }
|
let(:request_to_administrators) { false }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and request_to_administrators' do
|
context 'and request_to_administrators' do
|
||||||
let(:request_to_administrators) { true }
|
let(:request_to_administrators) { true }
|
||||||
|
|
||||||
it { is_expected.to be_valid }
|
it { should be_valid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -124,14 +124,14 @@ describe ProposalDashboardAction do
|
|||||||
context 'and no request_to_administrators' do
|
context 'and no request_to_administrators' do
|
||||||
let(:request_to_administrators) { false }
|
let(:request_to_administrators) { false }
|
||||||
|
|
||||||
it { is_expected.to be_valid }
|
it { should be_valid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when action type is nil' do
|
context 'when action type is nil' do
|
||||||
let(:action_type) { nil }
|
let(:action_type) { nil }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -17,24 +17,24 @@ describe ProposalExecutedDashboardAction do
|
|||||||
let(:executed_at) { Time.current }
|
let(:executed_at) { Time.current }
|
||||||
let(:comments) { '' }
|
let(:comments) { '' }
|
||||||
|
|
||||||
it { is_expected.to be_valid }
|
it { should be_valid }
|
||||||
|
|
||||||
context 'when proposal is nil' do
|
context 'when proposal is nil' do
|
||||||
let(:proposal) { nil }
|
let(:proposal) { nil }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when proposal_dashboard_action is nil' do
|
context 'when proposal_dashboard_action is nil' do
|
||||||
let(:proposal_dashboard_action) { nil }
|
let(:proposal_dashboard_action) { nil }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when executed_at is nil' do
|
context 'when executed_at is nil' do
|
||||||
let(:executed_at) { nil }
|
let(:executed_at) { nil }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the action sends a request to the administrators' do
|
context 'when the action sends a request to the administrators' do
|
||||||
@@ -43,19 +43,19 @@ describe ProposalExecutedDashboardAction do
|
|||||||
context 'and comments are blank' do
|
context 'and comments are blank' do
|
||||||
let(:comments) { '' }
|
let(:comments) { '' }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and comments have value' do
|
context 'and comments have value' do
|
||||||
let(:comments) { Faker::Lorem.sentence }
|
let(:comments) { Faker::Lorem.sentence }
|
||||||
|
|
||||||
it { is_expected.to be_valid }
|
it { should be_valid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when it has been already executed' do
|
context 'when it has been already executed' do
|
||||||
let!(:executed) { create(:proposal_executed_dashboard_action, proposal: proposal, proposal_dashboard_action: proposal_dashboard_action) }
|
let!(:executed) { create(:proposal_executed_dashboard_action, proposal: proposal, proposal_dashboard_action: proposal_dashboard_action) }
|
||||||
|
|
||||||
it { is_expected.not_to be_valid }
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user