diff --git a/.rubocop.yml b/.rubocop.yml
index 6868a1bb8..dd7793ad7 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -71,4 +71,7 @@ RSpec/EmptyLineAfterSubject:
Enabled: true
RSpec/ExampleLength:
- Enabled: false
\ No newline at end of file
+ Enabled: false
+
+RSpec/ExampleWording:
+ Enabled: true
\ No newline at end of file
diff --git a/spec/controllers/admin/api/stats_controller_spec.rb b/spec/controllers/admin/api/stats_controller_spec.rb
index 8dd948086..69c7d9b50 100644
--- a/spec/controllers/admin/api/stats_controller_spec.rb
+++ b/spec/controllers/admin/api/stats_controller_spec.rb
@@ -6,7 +6,7 @@ describe Admin::Api::StatsController do
let(:user) { create(:administrator).user }
context 'events or visits not present' do
- it 'should respond with bad_request' do
+ it 'responds with bad_request' do
sign_in user
get :show
@@ -29,7 +29,7 @@ describe Admin::Api::StatsController do
create :ahoy_event, name: 'bar', time: time_3
end
- it 'should return single events formated for working with c3.js' do
+ it 'returns single events formated for working with c3.js' do
sign_in user
get :show, events: 'foo'
@@ -39,7 +39,7 @@ describe Admin::Api::StatsController do
expect(data).to eq "x" => ["2015-01-01", "2015-01-02"], "Foo" => [2, 1]
end
- it 'should return combined comma separated events formated for working with c3.js' do
+ it 'returns combined comma separated events formated for working with c3.js' do
sign_in user
get :show, events: 'foo,bar'
@@ -51,7 +51,7 @@ describe Admin::Api::StatsController do
end
context 'visits present' do
- it 'should return visits formated for working with c3.js' do
+ it 'returns visits formated for working with c3.js' do
time_1 = DateTime.parse("2015-01-01").in_time_zone
time_2 = DateTime.parse("2015-01-02").in_time_zone
@@ -70,7 +70,7 @@ describe Admin::Api::StatsController do
end
context 'visits and events present' do
- it 'should return combined events and visits formated for working with c3.js' do
+ it 'returns combined events and visits formated for working with c3.js' do
time_1 = DateTime.parse("2015-01-01").in_time_zone
time_2 = DateTime.parse("2015-01-02").in_time_zone
@@ -93,7 +93,7 @@ describe Admin::Api::StatsController do
end
context 'budget investments present' do
- it 'should return budget investments formated for working with c3.js' do
+ it 'returns budget investments formated for working with c3.js' do
time_1 = DateTime.parse("2017-04-01").in_time_zone
time_2 = DateTime.parse("2017-04-02").in_time_zone
diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb
index d06e1900f..e9b79340e 100644
--- a/spec/controllers/comments_controller_spec.rb
+++ b/spec/controllers/comments_controller_spec.rb
@@ -10,7 +10,7 @@ describe CommentsController do
@unverified_user = create(:user)
end
- it 'should create an comment if the comments are open' do
+ it 'creates an comment if the comments are open' do
sign_in @user
expect do
@@ -18,7 +18,7 @@ describe CommentsController do
end.to change { @question.reload.comments_count }.by(1)
end
- it 'should not create a comment if the comments are closed' do
+ it 'does not create a comment if the comments are closed' do
sign_in @user
@process.update_attribute(:debate_end_date, Date.current - 1.day)
@@ -27,7 +27,7 @@ describe CommentsController do
end.to_not change { @question.reload.comments_count }
end
- it 'should not create a comment for unverified users when the commentable requires it' do
+ it 'does not create a comment for unverified users when the commentable requires it' do
sign_in @unverified_user
expect do
diff --git a/spec/controllers/debates_controller_spec.rb b/spec/controllers/debates_controller_spec.rb
index 1744dfd82..899b04dca 100644
--- a/spec/controllers/debates_controller_spec.rb
+++ b/spec/controllers/debates_controller_spec.rb
@@ -11,7 +11,7 @@ describe DebatesController do
InvisibleCaptcha.timestamp_enabled = true
end
- it 'should create an ahoy event' do
+ it 'creates an ahoy event' do
sign_in create(:user)
@@ -26,7 +26,7 @@ describe DebatesController do
Setting['max_ratio_anon_votes_on_debates'] = 50
end
- it 'should allow vote if user is allowed' do
+ it 'allows vote if user is allowed' do
Setting["max_ratio_anon_votes_on_debates"] = 100
debate = create(:debate)
sign_in create(:user)
@@ -36,7 +36,7 @@ describe DebatesController do
end.to change { debate.reload.votes_for.size }.by(1)
end
- it 'should not allow vote if user is not allowed' do
+ it 'does not allow vote if user is not allowed' do
Setting["max_ratio_anon_votes_on_debates"] = 0
debate = create(:debate, cached_votes_total: 1000)
sign_in create(:user)
diff --git a/spec/controllers/legislation/annotations_controller_spec.rb b/spec/controllers/legislation/annotations_controller_spec.rb
index 834ec046f..59ca8c09e 100644
--- a/spec/controllers/legislation/annotations_controller_spec.rb
+++ b/spec/controllers/legislation/annotations_controller_spec.rb
@@ -10,7 +10,7 @@ describe Legislation::AnnotationsController do
@user = create(:user, :level_two)
end
- it 'should create an ahoy event' do
+ it 'creates an ahoy event' do
sign_in @user
post :create, process_id: @process.id,
@@ -24,7 +24,7 @@ describe Legislation::AnnotationsController do
expect(Ahoy::Event.last.properties['legislation_annotation_id']).to eq Legislation::Annotation.last.id
end
- it 'should not create an annotation if the draft version is a final version' do
+ it 'does not create an annotation if the draft version is a final version' do
sign_in @user
post :create, process_id: @process.id,
@@ -38,7 +38,7 @@ describe Legislation::AnnotationsController do
expect(response).to have_http_status(:not_found)
end
- it 'should create an annotation if the process allegations phase is open' do
+ it 'creates an annotation if the process allegations phase is open' do
sign_in @user
expect do
@@ -52,7 +52,7 @@ describe Legislation::AnnotationsController do
end.to change { @draft_version.annotations.count }.by(1)
end
- it 'should not create an annotation if the process allegations phase is not open' do
+ it 'does not create an annotation if the process allegations phase is not open' do
sign_in @user
@process.update_attribute(:allegations_end_date, Date.current - 1.day)
@@ -67,7 +67,7 @@ describe Legislation::AnnotationsController do
end.to_not change { @draft_version.annotations.count }
end
- it 'should create an annotation by parsing parameters in JSON' do
+ it 'creates an annotation by parsing parameters in JSON' do
sign_in @user
expect do
@@ -81,7 +81,7 @@ describe Legislation::AnnotationsController do
end.to change { @draft_version.annotations.count }.by(1)
end
- it 'should create a new comment on an existing annotation when range is the same' do
+ it 'creates a new comment on an existing annotation when range is the same' do
annotation = create(:legislation_annotation, draft_version: @draft_version, text: "my annotation",
ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],
range_start: "/p[1]", range_start_offset: 6, range_end: "/p[1]", range_end_offset: 11)
diff --git a/spec/controllers/legislation/answers_controller_spec.rb b/spec/controllers/legislation/answers_controller_spec.rb
index 629935643..7323d259f 100644
--- a/spec/controllers/legislation/answers_controller_spec.rb
+++ b/spec/controllers/legislation/answers_controller_spec.rb
@@ -10,7 +10,7 @@ describe Legislation::AnswersController do
@user = create(:user, :level_two)
end
- it 'should create an ahoy event' do
+ it 'creates an ahoy event' do
sign_in @user
post :create, process_id: @process.id, question_id: @question.id,
@@ -19,7 +19,7 @@ describe Legislation::AnswersController do
expect(Ahoy::Event.last.properties['legislation_answer_id']).to eq Legislation::Answer.last.id
end
- it 'should create an answer if the process debate phase is open' do
+ it 'creates an answer if the process debate phase is open' do
sign_in @user
expect do
@@ -28,7 +28,7 @@ describe Legislation::AnswersController do
end.to change { @question.reload.answers_count }.by(1)
end
- it 'should not create an answer if the process debate phase is not open' do
+ it 'does not create an answer if the process debate phase is not open' do
sign_in @user
@process.update_attribute(:debate_end_date, Date.current - 1.day)
diff --git a/spec/controllers/management/base_controller_spec.rb b/spec/controllers/management/base_controller_spec.rb
index 0f4a95d7e..60b4678f8 100644
--- a/spec/controllers/management/base_controller_spec.rb
+++ b/spec/controllers/management/base_controller_spec.rb
@@ -4,7 +4,7 @@ describe Management::BaseController do
describe 'managed_user' do
- it "should return existent user with session document info if present" do
+ it "returns existent user with session document info if present" do
session[:document_type] = "1"
session[:document_number] = "333333333E"
user = create(:user, :level_two, document_number: "333333333E")
@@ -13,7 +13,7 @@ describe Management::BaseController do
expect(managed_user).to eq user
end
- it "should return new user if no user have the session document info" do
+ it "returns new user if no user have the session document info" do
session[:document_type] = "1"
session[:document_number] = "333333333E"
managed_user = subject.send(:managed_user)
diff --git a/spec/controllers/management/sessions_controller_spec.rb b/spec/controllers/management/sessions_controller_spec.rb
index 0e2a18544..25d0afc6b 100644
--- a/spec/controllers/management/sessions_controller_spec.rb
+++ b/spec/controllers/management/sessions_controller_spec.rb
@@ -3,13 +3,13 @@ require 'rails_helper'
describe Management::SessionsController do
describe 'Sign in' do
- it "should deny access if wrong manager credentials" do
+ it "denies access if wrong manager credentials" do
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(false)
expect { get :create, login: "nonexistent", clave_usuario: "wrong"}.to raise_error CanCan::AccessDenied
expect(session[:manager]).to be_nil
end
- it "should redirect to management root path if authorized manager with right credentials" do
+ it "redirects to management root path if authorized manager with right credentials" do
manager = {login: "JJB033", user_key: "31415926", date: "20151031135905"}
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(manager)
@@ -18,7 +18,7 @@ describe Management::SessionsController do
expect(session[:manager][:login]).to eq "JJB033"
end
- it "should redirect to management root path if user is admin" do
+ it "redirects to management root path if user is admin" do
user = create(:administrator).user
sign_in user
get :create
@@ -26,7 +26,7 @@ describe Management::SessionsController do
expect(session[:manager][:login]).to eq "admin_user_#{user.id}"
end
- it "should redirect to management root path if user is manager" do
+ it "redirects to management root path if user is manager" do
user = create(:manager).user
sign_in user
get :create
@@ -34,7 +34,7 @@ describe Management::SessionsController do
expect(session[:manager][:login]).to eq "manager_user_#{user.id}"
end
- it "should deny access if user is not admin or manager" do
+ it "denies access if user is not admin or manager" do
sign_in create(:user)
expect { get :create}.to raise_error CanCan::AccessDenied
expect(session[:manager]).to be_nil
@@ -42,7 +42,7 @@ describe Management::SessionsController do
end
describe 'Sign out' do
- it "should destroy the session data and redirect" do
+ it "destroys the session data and redirect" do
session[:manager] = {user_key: "31415926", date: "20151031135905", login: "JJB033"}
session[:document_type] = "1"
session[:document_number] = "12345678Z"
diff --git a/spec/controllers/management/users_controller_spec.rb b/spec/controllers/management/users_controller_spec.rb
index 221d302b6..d30e5f27c 100644
--- a/spec/controllers/management/users_controller_spec.rb
+++ b/spec/controllers/management/users_controller_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe Management::UsersController do
describe 'logout' do
- it "should remove user data from the session" do
+ it "removes user data from the session" do
session[:manager] = {user_key: "31415926", date: "20151031135905", login: "JJB033"}
session[:document_type] = "1"
session[:document_number] = "12345678Z"
diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb
index 9ea61e9bb..17a17dc3c 100644
--- a/spec/controllers/pages_controller_spec.rb
+++ b/spec/controllers/pages_controller_spec.rb
@@ -3,27 +3,27 @@ require 'rails_helper'
describe PagesController do
describe 'Static pages' do
- it 'should include a privacy page' do
+ it 'includes a privacy page' do
get :show, id: :privacy
expect(response).to be_ok
end
- it 'should include a conditions page' do
+ it 'includes a conditions page' do
get :show, id: :conditions
expect(response).to be_ok
end
- it 'should include a general terms page' do
+ it 'includes a general terms page' do
get :show, id: :general_terms
expect(response).to be_ok
end
- it 'should include a terms page' do
+ it 'includes a terms page' do
get :show, id: :census_terms
expect(response).to be_ok
end
- it 'should include a accessibility page' do
+ it 'includes a accessibility page' do
get :show, id: :accessibility
expect(response).to be_ok
end
@@ -31,24 +31,24 @@ describe PagesController do
describe 'More info pages' do
- it 'should include a more info page' do
+ it 'includes a more info page' do
get :show, id: 'more_info/index'
expect(response).to be_ok
end
- it 'should include a how_to_use page' do
+ it 'includes a how_to_use page' do
get :show, id: 'more_info/how_to_use/index'
expect(response).to be_ok
end
- it 'should include a faq page' do
+ it 'includes a faq page' do
get :show, id: 'more_info/faq/index'
expect(response).to be_ok
end
end
describe 'Not found pages' do
- it 'should return a 404 message' do
+ it 'returns a 404 message' do
get :show, id: "nonExistentPage"
expect(response).to be_missing
end
diff --git a/spec/controllers/users/registrations_controller_spec.rb b/spec/controllers/users/registrations_controller_spec.rb
index ea73428f5..ce0acc880 100644
--- a/spec/controllers/users/registrations_controller_spec.rb
+++ b/spec/controllers/users/registrations_controller_spec.rb
@@ -9,7 +9,7 @@ describe Users::RegistrationsController do
end
context "when username is available" do
- it "should return true with no error message" do
+ it "returns true with no error message" do
get :check_username, username: "available username"
data = JSON.parse response.body, symbolize_names: true
@@ -19,7 +19,7 @@ describe Users::RegistrationsController do
end
context "when username is not available" do
- it "should return false with an error message" do
+ it "returns false with an error message" do
user = create(:user)
get :check_username, username: user.username
diff --git a/spec/customization_engine_spec.rb b/spec/customization_engine_spec.rb
index 08811e7d9..9c2c814b1 100644
--- a/spec/customization_engine_spec.rb
+++ b/spec/customization_engine_spec.rb
@@ -8,13 +8,13 @@ describe 'Customization Engine' do
let(:test_key) { I18n.t('account.show.change_credentials_link') }
let!(:default_path) { I18n.load_path }
- it "should load custom and override original locales" do
+ it "loads custom and override original locales" do
I18n.load_path += Dir[Rails.root.join('spec', 'support', 'locales', 'custom', '*.{rb,yml}')]
I18n.reload!
expect(test_key).to eq 'Overriden string with custom locales'
end
- it "should not override original locales" do
+ it "does not override original locales" do
I18n.load_path.delete_if {|item| item =~ /spec\/support\/locales\/custom/ }
I18n.load_path += Dir[Rails.root.join('spec', 'support', 'locales', '**', '*.{rb,yml}')]
I18n.reload!
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 61137912d..4dd775c73 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -3,19 +3,19 @@ require 'rails_helper'
describe ApplicationHelper do
describe "#author_of?" do
- it "should be true if user is the author" do
+ it "is true if user is the author" do
user = create(:user)
proposal = create(:proposal, author: user)
expect(author_of?(proposal, user)).to eq true
end
- it "should be false if user is not the author" do
+ it "is false if user is not the author" do
user = create(:user)
proposal = create(:proposal)
expect(author_of?(proposal, user)).to eq false
end
- it "should be false if user or authorable is nil" do
+ it "is false if user or authorable is nil" do
user = create(:user)
proposal = create(:proposal)
diff --git a/spec/helpers/proposals_helper_spec.rb b/spec/helpers/proposals_helper_spec.rb
index d71178d9d..87da34be3 100644
--- a/spec/helpers/proposals_helper_spec.rb
+++ b/spec/helpers/proposals_helper_spec.rb
@@ -3,43 +3,43 @@ require 'rails_helper'
describe ProposalsHelper do
describe "#progress_bar_percentage" do
- it "should be 0 if no votes" do
+ it "is 0 if no votes" do
proposal = create(:proposal)
expect(progress_bar_percentage(proposal)).to eq 0
end
- it "should be a between 1 and 100 if there are votes but less than needed" do
+ it "is between 1 and 100 if there are votes but less than needed" do
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success / 2)
expect(progress_bar_percentage(proposal)).to eq 50
end
- it "should be 100 if there are more votes than needed" do
+ it "is 100 if there are more votes than needed" do
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success * 2)
expect(progress_bar_percentage(proposal)).to eq 100
end
end
describe "#supports_percentage" do
- it "should be 0 if no votes" do
+ it "is 0 if no votes" do
proposal = create(:proposal)
expect(supports_percentage(proposal)).to eq "0%"
end
- it "should be a between 0.1 from 1 to 0.1% of needed votes" do
+ it "is between 0.1 from 1 to 0.1% of needed votes" do
proposal = create(:proposal, cached_votes_up: 1)
expect(supports_percentage(proposal)).to eq "0.1%"
end
- it "should be a between 1 and 100 if there are votes but less than needed" do
+ it "is between 1 and 100 if there are votes but less than needed" do
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success / 2)
expect(supports_percentage(proposal)).to eq "50%"
end
- it "should be 100 if there are more votes than needed" do
+ it "is 100 if there are more votes than needed" do
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success * 2)
expect(supports_percentage(proposal)).to eq "100%"
end
end
-end
\ No newline at end of file
+end
diff --git a/spec/helpers/text_helper_spec.rb b/spec/helpers/text_helper_spec.rb
index cc9300b7f..2b9884b9a 100644
--- a/spec/helpers/text_helper_spec.rb
+++ b/spec/helpers/text_helper_spec.rb
@@ -3,12 +3,12 @@ require 'rails_helper'
describe TextHelper do
describe "#first_paragraph" do
- it "should return the first paragraph of a text" do
+ it "returns the first paragraph of a text" do
text = "\n\nThis is the first paragraph\n\nThis is the second paragraph\n"
expect(first_paragraph(text)).to eq("This is the first paragraph")
end
- it "should return blank if the text is blank" do
+ it "returns blank if the text is blank" do
expect(first_paragraph("")).to eq("")
expect(first_paragraph(nil)).to eq("")
end
diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb
index 92ba3d6e4..544c65d82 100644
--- a/spec/helpers/users_helper_spec.rb
+++ b/spec/helpers/users_helper_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe UsersHelper do
describe '#humanize_document_type' do
- it "should return a humanized document type" do
+ it "returns a humanized document type" do
expect(humanize_document_type("1")).to eq "DNI"
expect(humanize_document_type("2")).to eq "Passport"
expect(humanize_document_type("3")).to eq "Residence card"
@@ -11,7 +11,7 @@ describe UsersHelper do
end
describe '#deleted_commentable_text' do
- it "should return the appropriate message for deleted debates" do
+ it "returns the appropriate message for deleted debates" do
debate = create(:debate)
comment = create(:comment, commentable: debate)
@@ -21,7 +21,7 @@ describe UsersHelper do
' (This debate has been deleted)')
end
- it "should return the appropriate message for deleted proposals" do
+ it "returns the appropriate message for deleted proposals" do
proposal = create(:proposal)
comment = create(:comment, commentable: proposal)
@@ -31,7 +31,7 @@ describe UsersHelper do
' (This proposal has been deleted)')
end
- it "should return the appropriate message for deleted budget investment" do
+ it "returns the appropriate message for deleted budget investment" do
investment = create(:budget_investment)
comment = create(:comment, commentable: investment)
@@ -43,12 +43,12 @@ describe UsersHelper do
end
describe '#comment_commentable_title' do
- it "should return a link to the comment" do
+ it "returns a link to the comment" do
comment = create(:comment)
expect(comment_commentable_title(comment)).to eq link_to comment.commentable.title, comment
end
- it "should return a hint if the commentable has been deleted" do
+ it "returns a hint if the commentable has been deleted" do
comment = create(:comment)
comment.commentable.hide
expect(comment_commentable_title(comment)).to eq('' + comment.commentable.title +
diff --git a/spec/helpers/verification_helper_spec.rb b/spec/helpers/verification_helper_spec.rb
index 43df6509f..5934018a4 100644
--- a/spec/helpers/verification_helper_spec.rb
+++ b/spec/helpers/verification_helper_spec.rb
@@ -3,18 +3,18 @@ require 'rails_helper'
describe VerificationHelper do
describe "#mask_phone" do
- it "should mask a phone" do
+ it "masks a phone" do
expect(mask_phone("612345678")).to eq("******678")
end
end
describe "#mask_email" do
- it "should mask a long email address" do
+ it "masks a long email address" do
expect(mask_email("isabel@example.com")).to eq("isa***@example.com")
expect(mask_email("antonio.perez@example.com")).to eq("ant**********@example.com")
end
- it "should mask a short email address" do
+ it "masks a short email address" do
expect(mask_email("an@example.com")).to eq("an@example.com")
expect(mask_email("ana@example.com")).to eq("ana@example.com")
expect(mask_email("aina@example.com")).to eq("ain*@example.com")
diff --git a/spec/helpers/votes_helper_spec.rb b/spec/helpers/votes_helper_spec.rb
index d695b881a..9f86a63b4 100644
--- a/spec/helpers/votes_helper_spec.rb
+++ b/spec/helpers/votes_helper_spec.rb
@@ -3,14 +3,14 @@ require 'rails_helper'
describe VotesHelper do
describe "#voted_for?" do
- it "should return true if voted for a proposal" do
+ it "returns true if voted for a proposal" do
proposal = create(:proposal)
votes = {proposal.id => true}
expect(voted_for?(votes, proposal)).to eq(true)
end
- it "should return false if not voted for a proposals" do
+ it "returns false if not voted for a proposals" do
proposal = create(:proposal)
votes = {proposal.id => nil}
@@ -19,7 +19,7 @@ describe VotesHelper do
end
describe "#votes_percentage" do
- it "should always sum 100%" do
+ it "alwayses sum 100%" do
debate = create(:debate)
create_list(:vote, 8, votable: debate, vote_flag: true)
create_list(:vote, 3, votable: debate, vote_flag: false)
diff --git a/spec/lib/manager_authenticator_spec.rb b/spec/lib/manager_authenticator_spec.rb
index 207786d62..ab94d0a3a 100644
--- a/spec/lib/manager_authenticator_spec.rb
+++ b/spec/lib/manager_authenticator_spec.rb
@@ -4,38 +4,38 @@ describe ManagerAuthenticator do
let(:authenticator) { described_class.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "20151031135905") }
describe 'initialization params' do
- it 'should cause auth to return false if blank login' do
+ it 'causes auth to return false if blank login' do
blank_login_authenticator = described_class.new(login: "", clave_usuario: "31415926", fecha_conexion: "20151031135905")
expect(blank_login_authenticator.auth).to be false
end
- it 'should cause auth to return false if blank user_key' do
+ it 'causes auth to return false if blank user_key' do
blank_user_key_authenticator = described_class.new(login: "JJB033", clave_usuario: "", fecha_conexion: "20151031135905")
expect(blank_user_key_authenticator.auth).to be false
end
- it 'should cause auth to return false if blank date' do
+ it 'causes auth to return false if blank date' do
blank_date_authenticator = described_class.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "")
expect(blank_date_authenticator.auth).to be false
end
end
describe '#auth' do
- it 'should return false if not manager_exists' do
+ it 'returns false if not manager_exists' do
allow(authenticator).to receive(:manager_exists?).and_return(false)
allow(authenticator).to receive(:application_authorized?).and_return(true)
expect(authenticator.auth).to be false
end
- it 'should return false if not application_authorized' do
+ it 'returns false if not application_authorized' do
allow(authenticator).to receive(:manager_exists?).and_return(true)
allow(authenticator).to receive(:application_authorized?).and_return(false)
expect(authenticator.auth).to be false
end
- it 'should return ok if manager_exists and application_authorized' do
+ it 'returns ok if manager_exists and application_authorized' do
allow(authenticator).to receive(:manager_exists?).and_return(true)
allow(authenticator).to receive(:application_authorized?).and_return(true)
@@ -44,14 +44,14 @@ describe ManagerAuthenticator do
end
describe 'SOAP' do
- it 'should call the verification user method' do
+ it 'calls the verification user method' do
message = { ub: {user_key: "31415926", date: "20151031135905"} }
allow(authenticator).to receive(:application_authorized?).and_return(true)
expect(authenticator.send(:client)).to receive(:call).with(:get_status_user_data, message: message)
authenticator.auth
end
- it 'should call the permissions check method' do
+ it 'calls the permissions check method' do
allow(authenticator).to receive(:manager_exists?).and_return(true)
expect(authenticator.send(:client)).to receive(:call).with(:get_applications_user_list, message: { ub: {user_key: "31415926"} })
authenticator.auth
diff --git a/spec/lib/tasks/settings_spec.rb b/spec/lib/tasks/settings_spec.rb
index 8a48dce15..4008cf784 100644
--- a/spec/lib/tasks/settings_spec.rb
+++ b/spec/lib/tasks/settings_spec.rb
@@ -22,7 +22,7 @@ describe 'Settings Rake' do
run_rake_task
end
- it 'should have per_page_code_head setting present and no per_page_code' do
+ it 'has per_page_code_head setting present and no per_page_code' do
expect(Setting.where(key: 'per_page_code_head').count).to eq(1)
expect(Setting['per_page_code_head']).to eq(nil)
expect(Setting.where(key: 'per_page_code').count).to eq(0)
@@ -36,7 +36,7 @@ describe 'Settings Rake' do
run_rake_task
end
- it 'should have per_page_code_head setting present and no per_page_code' do
+ it 'has per_page_code_head setting present and no per_page_code' do
expect(Setting.where(key: 'per_page_code_head').count).to eq(1)
expect(Setting['per_page_code_head']).to eq('per_page_code_head')
expect(Setting.where(key: 'per_page_code').count).to eq(0)
@@ -50,7 +50,7 @@ describe 'Settings Rake' do
run_rake_task
end
- it 'should have per_page_code_head setting present and no per_page_code' do
+ it 'has per_page_code_head setting present and no per_page_code' do
expect(Setting.where(key: 'per_page_code_head').count).to eq(1)
expect(Setting['per_page_code_head']).to eq('per_page_code_head')
expect(Setting.where(key: 'per_page_code').count).to eq(0)
@@ -64,7 +64,7 @@ describe 'Settings Rake' do
run_rake_task
end
- it 'should have per_page_code_head setting present and no per_page_code' do
+ it 'has per_page_code_head setting present and no per_page_code' do
expect(Setting.where(key: 'per_page_code_head').count).to eq(1)
expect(Setting['per_page_code_head']).to eq('per_page_code')
expect(Setting.where(key: 'per_page_code').count).to eq(0)
diff --git a/spec/models/activity_spec.rb b/spec/models/activity_spec.rb
index 4571cae42..aad181c55 100644
--- a/spec/models/activity_spec.rb
+++ b/spec/models/activity_spec.rb
@@ -2,14 +2,14 @@ require 'rails_helper'
describe Activity do
- it "should be valid for different actionables" do
+ it "is valid for different actionables" do
expect(build(:activity, actionable: create(:proposal))).to be_valid
expect(build(:activity, actionable: create(:debate))).to be_valid
expect(build(:activity, actionable: create(:comment))).to be_valid
expect(build(:activity, actionable: create(:user))).to be_valid
end
- it "should be a valid only with allowed actions" do
+ it "is a valid only with allowed actions" do
expect(build(:activity, action: "hide")).to be_valid
expect(build(:activity, action: "block")).to be_valid
expect(build(:activity, action: "restore")).to be_valid
@@ -17,7 +17,7 @@ describe Activity do
end
describe "log" do
- it "should create an activity entry" do
+ it "creates an activity entry" do
user = create(:user)
proposal = create(:proposal)
@@ -31,7 +31,7 @@ describe Activity do
end
describe "on" do
- it "should list all activity on an actionable object" do
+ it "lists all activity on an actionable object" do
proposal = create(:proposal)
activity1 = create(:activity, action: "hide", actionable: proposal)
activity2 = create(:activity, action: "restore", actionable: proposal)
@@ -49,7 +49,7 @@ describe Activity do
end
describe "by" do
- it "should list all activity of a user" do
+ it "lists all activity of a user" do
user1 = create(:user)
activity1 = create(:activity, user: user1)
activity2 = create(:activity, user: user1, action: "restore", actionable: create(:debate))
@@ -68,7 +68,7 @@ describe Activity do
end
describe "scopes by actionable" do
- it "should filter by actionable type" do
+ it "filters by actionable type" do
on_proposal = create(:activity, actionable: create(:proposal))
on_debate = create(:activity, actionable: create(:debate))
on_comment = create(:activity, actionable: create(:comment))
diff --git a/spec/models/ahoy/data_source_spec.rb b/spec/models/ahoy/data_source_spec.rb
index 9f68cdfe4..e8fc868af 100644
--- a/spec/models/ahoy/data_source_spec.rb
+++ b/spec/models/ahoy/data_source_spec.rb
@@ -15,18 +15,18 @@ describe Ahoy::DataSource do
create :ahoy_event, name: 'bar', time: time_3
end
- it 'should work without data sources' do
+ it 'works without data sources' do
ds = described_class.new
expect(ds.build).to eq x: []
end
- it 'should work with single data sources' do
+ it 'works with single data sources' do
ds = described_class.new
ds.add 'foo', Ahoy::Event.where(name: 'foo').group_by_day(:time).count
expect(ds.build).to eq :x => ["2015-01-01", "2015-01-02"], "foo" => [2, 1]
end
- it 'should combine data sources' do
+ it 'combines data sources' do
ds = described_class.new
ds.add 'foo', Ahoy::Event.where(name: 'foo').group_by_day(:time).count
ds.add 'bar', Ahoy::Event.where(name: 'bar').group_by_day(:time).count
diff --git a/spec/models/budget/ballot/line_spec.rb b/spec/models/budget/ballot/line_spec.rb
index 61d015504..401396569 100644
--- a/spec/models/budget/ballot/line_spec.rb
+++ b/spec/models/budget/ballot/line_spec.rb
@@ -11,7 +11,7 @@ describe Budget::Ballot::Line do
describe 'Validations' do
- it "should be valid and automatically denormallyze budget, group and heading when validated" do
+ it "is valid and automatically denormallyze budget, group and heading when validated" do
expect(ballot_line).to be_valid
expect(ballot_line.budget).to eq(budget)
expect(ballot_line.group).to eq(group)
@@ -19,24 +19,24 @@ describe Budget::Ballot::Line do
end
describe 'Money' do
- it "should not be valid if insufficient funds" do
+ it "is not valid if insufficient funds" do
investment.update(price: heading.price + 1)
expect(ballot_line).to_not be_valid
end
- it "should be valid if sufficient funds" do
+ it "is valid if sufficient funds" do
investment.update(price: heading.price - 1)
expect(ballot_line).to be_valid
end
end
describe 'Selectibility' do
- it "should not be valid if investment is unselected" do
+ it "is not valid if investment is unselected" do
investment.update(selected: false)
expect(ballot_line).to_not be_valid
end
- it "should be valid if investment is selected" do
+ it "is valid if investment is selected" do
investment.update(selected: true, price: 20000)
expect(ballot_line).to be_valid
end
@@ -48,7 +48,7 @@ describe Budget::Ballot::Line do
describe "by_investment" do
- it "should return ballot lines for an investment" do
+ it "returns ballot lines for an investment" do
investment1 = create(:budget_investment, :selected, heading: heading)
investment2 = create(:budget_investment, :selected, heading: heading)
diff --git a/spec/models/budget/ballot_spec.rb b/spec/models/budget/ballot_spec.rb
index e0eca4c38..de61fcaa9 100644
--- a/spec/models/budget/ballot_spec.rb
+++ b/spec/models/budget/ballot_spec.rb
@@ -4,14 +4,14 @@ describe Budget::Ballot do
describe "validations" do
- it "should be valid" do
+ it "is valid" do
budget = create(:budget)
ballot = create(:budget_ballot, budget: budget)
expect(ballot).to be_valid
end
- it "should not be valid with the same investment twice" do
+ it "is not valid with the same investment twice" do
budget = create(:budget)
group = create(:budget_group, budget: budget)
heading = create(:budget_heading, group: group)
diff --git a/spec/models/budget/investment/milestone_spec.rb b/spec/models/budget/investment/milestone_spec.rb
index 87a91bc9f..b6bfe1a7c 100644
--- a/spec/models/budget/investment/milestone_spec.rb
+++ b/spec/models/budget/investment/milestone_spec.rb
@@ -5,21 +5,21 @@ describe Budget::Investment::Milestone do
describe "Validations" do
let(:milestone) { build(:budget_investment_milestone) }
- it "Should be valid" do
+ it "is valid" do
expect(milestone).to be_valid
end
- it "Should not be valid without a title" do
+ it "is not valid without a title" do
milestone.title = nil
expect(milestone).to_not be_valid
end
- it "Should not be valid without a description" do
+ it "is not valid without a description" do
milestone.description = nil
expect(milestone).to_not be_valid
end
- it "Should not be valid without an investment" do
+ it "is not valid without an investment" do
milestone.investment_id = nil
expect(milestone).to_not be_valid
end
diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb
index ce8301609..2472b8bda 100644
--- a/spec/models/budget/investment_spec.rb
+++ b/spec/models/budget/investment_spec.rb
@@ -7,27 +7,27 @@ describe Budget::Investment do
it_behaves_like "notifiable"
end
- it "should be valid" do
+ it "is valid" do
expect(investment).to be_valid
end
- it "should not be valid without an author" do
+ it "is not valid without an author" do
investment.author = nil
expect(investment).to_not be_valid
end
describe "#title" do
- it "should not be valid without a title" do
+ it "is not valid without a title" do
investment.title = nil
expect(investment).to_not be_valid
end
- it "should not be valid when very short" do
+ it "is not valid when very short" do
investment.title = "abc"
expect(investment).to_not be_valid
end
- it "should not be valid when very long" do
+ it "is not valid when very long" do
investment.title = "a" * 81
expect(investment).to_not be_valid
end
@@ -61,20 +61,20 @@ describe Budget::Investment do
end
describe "#unfeasibility_explanation blank" do
- it "should be valid if valuation not finished" do
+ it "is valid if valuation not finished" do
investment.unfeasibility_explanation = ""
investment.valuation_finished = false
expect(investment).to be_valid
end
- it "should be valid if valuation finished and feasible" do
+ it "is valid if valuation finished and feasible" do
investment.unfeasibility_explanation = ""
investment.feasibility = "feasible"
investment.valuation_finished = true
expect(investment).to be_valid
end
- it "should not be valid if valuation finished and unfeasible" do
+ it "is not valid if valuation finished and unfeasible" do
investment.unfeasibility_explanation = ""
investment.feasibility = "unfeasible"
investment.valuation_finished = true
@@ -83,13 +83,13 @@ describe Budget::Investment do
end
describe "#price blank" do
- it "should be valid if valuation not finished" do
+ it "is valid if valuation not finished" do
investment.price = ""
investment.valuation_finished = false
expect(investment).to be_valid
end
- it "should be valid if valuation finished and unfeasible" do
+ it "is valid if valuation finished and unfeasible" do
investment.price = ""
investment.unfeasibility_explanation = "reason"
investment.feasibility = "unfeasible"
@@ -97,7 +97,7 @@ describe Budget::Investment do
expect(investment).to be_valid
end
- it "should not be valid if valuation finished and feasible" do
+ it "is not valid if valuation finished and feasible" do
investment.price = ""
investment.feasibility = "feasible"
investment.valuation_finished = true
@@ -228,7 +228,7 @@ describe Budget::Investment do
end
describe "by_admin" do
- it "should return investments assigned to specific administrator" do
+ it "returns investments assigned to specific administrator" do
investment1 = create(:budget_investment, administrator_id: 33)
create(:budget_investment)
@@ -240,7 +240,7 @@ describe Budget::Investment do
end
describe "by_valuator" do
- it "should return investments assigned to specific valuator" do
+ it "returns investments assigned to specific valuator" do
investment1 = create(:budget_investment)
investment2 = create(:budget_investment)
investment3 = create(:budget_investment)
@@ -261,7 +261,7 @@ describe Budget::Investment do
describe "scopes" do
describe "valuation_open" do
- it "should return all investments with false valuation_finished" do
+ it "returns all investments with false valuation_finished" do
investment1 = create(:budget_investment, valuation_finished: true)
investment2 = create(:budget_investment)
@@ -273,7 +273,7 @@ describe Budget::Investment do
end
describe "without_admin" do
- it "should return all open investments without assigned admin" do
+ it "returns all open investments without assigned admin" do
investment1 = create(:budget_investment, valuation_finished: true)
investment2 = create(:budget_investment, administrator: create(:administrator))
investment3 = create(:budget_investment)
@@ -286,7 +286,7 @@ describe Budget::Investment do
end
describe "managed" do
- it "should return all open investments with assigned admin but without assigned valuators" do
+ it "returns all open investments with assigned admin but without assigned valuators" do
investment1 = create(:budget_investment, administrator: create(:administrator))
investment2 = create(:budget_investment, administrator: create(:administrator), valuation_finished: true)
investment3 = create(:budget_investment, administrator: create(:administrator))
@@ -300,7 +300,7 @@ describe Budget::Investment do
end
describe "valuating" do
- it "should return all investments with assigned valuator but valuation not finished" do
+ it "returns all investments with assigned valuator but valuation not finished" do
investment1 = create(:budget_investment)
investment2 = create(:budget_investment)
investment3 = create(:budget_investment, valuation_finished: true)
@@ -316,7 +316,7 @@ describe Budget::Investment do
end
describe "valuation_finished" do
- it "should return all investments with valuation finished" do
+ it "returns all investments with valuation finished" do
investment1 = create(:budget_investment)
investment2 = create(:budget_investment)
investment3 = create(:budget_investment, valuation_finished: true)
@@ -332,7 +332,7 @@ describe Budget::Investment do
end
describe "feasible" do
- it "should return all feasible investments" do
+ it "returns all feasible investments" do
feasible_investment = create(:budget_investment, :feasible)
create(:budget_investment)
@@ -341,7 +341,7 @@ describe Budget::Investment do
end
describe "unfeasible" do
- it "should return all unfeasible investments" do
+ it "returns all unfeasible investments" do
unfeasible_investment = create(:budget_investment, :unfeasible)
create(:budget_investment, :feasible)
@@ -350,7 +350,7 @@ describe Budget::Investment do
end
describe "not_unfeasible" do
- it "should return all feasible and undecided investments" do
+ it "returns all feasible and undecided investments" do
unfeasible_investment = create(:budget_investment, :unfeasible)
undecided_investment = create(:budget_investment, :undecided)
feasible_investment = create(:budget_investment, :feasible)
@@ -360,7 +360,7 @@ describe Budget::Investment do
end
describe "undecided" do
- it "should return all undecided investments" do
+ it "returns all undecided investments" do
unfeasible_investment = create(:budget_investment, :unfeasible)
undecided_investment = create(:budget_investment, :undecided)
feasible_investment = create(:budget_investment, :feasible)
@@ -370,7 +370,7 @@ describe Budget::Investment do
end
describe "selected" do
- it "should return all selected investments" do
+ it "returns all selected investments" do
selected_investment = create(:budget_investment, :selected)
unselected_investment = create(:budget_investment, :unselected)
@@ -379,7 +379,7 @@ describe Budget::Investment do
end
describe "unselected" do
- it "should return all unselected not_unfeasible investments" do
+ it "returns all unselected not_unfeasible investments" do
selected_investment = create(:budget_investment, :selected)
unselected_unfeasible_investment = create(:budget_investment, :unselected, :unfeasible)
unselected_undecided_investment = create(:budget_investment, :unselected, :undecided)
@@ -580,7 +580,7 @@ describe Budget::Investment do
describe "Order" do
describe "#sort_by_confidence_score" do
- it "should order by confidence_score" do
+ it "orders by confidence_score" do
least_voted = create(:budget_investment, cached_votes_up: 1)
most_voted = create(:budget_investment, cached_votes_up: 10)
some_votes = create(:budget_investment, cached_votes_up: 5)
@@ -590,7 +590,7 @@ describe Budget::Investment do
expect(described_class.sort_by_confidence_score.third).to eq least_voted
end
- it "should order by confidence_score and then by id" do
+ it "orders by confidence_score and then by id" do
least_voted = create(:budget_investment, cached_votes_up: 1)
most_voted = create(:budget_investment, cached_votes_up: 10)
most_voted2 = create(:budget_investment, cached_votes_up: 10)
@@ -637,7 +637,7 @@ describe Budget::Investment do
end
describe "#with_supports" do
- it "should return proposals with supports" do
+ it "returns proposals with supports" do
inv1 = create(:budget_investment)
inv2 = create(:budget_investment)
create(:vote, votable: inv1)
diff --git a/spec/models/budget/reclassified_vote_spec.rb b/spec/models/budget/reclassified_vote_spec.rb
index c4da8d7fb..0eca91f2e 100644
--- a/spec/models/budget/reclassified_vote_spec.rb
+++ b/spec/models/budget/reclassified_vote_spec.rb
@@ -5,21 +5,21 @@ describe Budget::ReclassifiedVote do
describe "Validations" do
let(:reclassified_vote) { build(:budget_reclassified_vote) }
- it "should be valid" do
+ it "is valid" do
expect(reclassified_vote).to be_valid
end
- it "should not be valid without a user" do
+ it "is not valid without a user" do
reclassified_vote.user_id = nil
expect(reclassified_vote).to_not be_valid
end
- it "should not be valid without an investment" do
+ it "is not valid without an investment" do
reclassified_vote.investment_id = nil
expect(reclassified_vote).to_not be_valid
end
- it "should not be valid without a valid reason" do
+ it "is not valid without a valid reason" do
reclassified_vote.reason = nil
expect(reclassified_vote).to_not be_valid
diff --git a/spec/models/community_spec.rb b/spec/models/community_spec.rb
index 005d0824d..dfc0bf403 100644
--- a/spec/models/community_spec.rb
+++ b/spec/models/community_spec.rb
@@ -2,7 +2,7 @@ require 'rails_helper'
RSpec.describe Community, type: :model do
- it "should be valid when create proposal" do
+ it "is valid when create proposal" do
proposal = create(:proposal)
expect(proposal.community).to be_valid
@@ -10,7 +10,7 @@ RSpec.describe Community, type: :model do
describe "#participants" do
- it "should return participants without duplicates" do
+ it "returns participants without duplicates" do
proposal = create(:proposal)
community = proposal.community
user1 = create(:user)
diff --git a/spec/models/custom/residence_spec.rb b/spec/models/custom/residence_spec.rb
index 81c0b2e9b..4b40e8ff6 100644
--- a/spec/models/custom/residence_spec.rb
+++ b/spec/models/custom/residence_spec.rb
@@ -7,7 +7,7 @@ describe Verification::Residence do
describe "verification" do
describe "postal code" do
- it "should be valid with postal codes starting with 280" do
+ it "is valid with postal codes starting with 280" do
residence.postal_code = "28012"
residence.valid?
expect(residence.errors[:postal_code].size).to eq(0)
@@ -17,7 +17,7 @@ describe Verification::Residence do
expect(residence.errors[:postal_code].size).to eq(0)
end
- it "should not be valid with postal codes not starting with 280" do
+ it "is not valid with postal codes not starting with 280" do
residence.postal_code = "12345"
residence.valid?
expect(residence.errors[:postal_code].size).to eq(1)
diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb
index 6b2a043e3..c47e23a37 100644
--- a/spec/models/debate_spec.rb
+++ b/spec/models/debate_spec.rb
@@ -9,79 +9,79 @@ describe Debate do
it_behaves_like "notifiable"
end
- it "should be valid" do
+ it "is valid" do
expect(debate).to be_valid
end
- it "should not be valid without an author" do
+ it "is not valid without an author" do
debate.author = nil
expect(debate).to_not be_valid
end
describe "#title" do
- it "should not be valid without a title" do
+ it "is not valid without a title" do
debate.title = nil
expect(debate).to_not be_valid
end
- it "should not be valid when very short" do
+ it "is not valid when very short" do
debate.title = "abc"
expect(debate).to_not be_valid
end
- it "should not be valid when very long" do
+ it "is not valid when very long" do
debate.title = "a" * 81
expect(debate).to_not be_valid
end
end
describe "#description" do
- it "should not be valid without a description" do
+ it "is not valid without a description" do
debate.description = nil
expect(debate).to_not be_valid
end
- it "should be sanitized" do
+ it "is sanitized" do
debate.description = ""
debate.valid?
expect(debate.description).to eq("alert('danger');")
end
- it "should be html_safe" do
+ it "is html_safe" do
debate.description = ""
expect(debate.description).to be_html_safe
end
- it "should not be valid when very short" do
+ it "is not valid when very short" do
debate.description = "abc"
expect(debate).to_not be_valid
end
- it "should not be valid when very long" do
+ it "is not valid when very long" do
debate.description = "a" * 6001
expect(debate).to_not be_valid
end
end
describe "#tag_list" do
- it "should sanitize the tag list" do
+ it "sanitizes the tag list" do
debate.tag_list = "user_id=1"
debate.valid?
expect(debate.tag_list).to eq(['user_id1'])
end
- it "should not be valid with a tag list of more than 6 elements" do
+ it "is not valid with a tag list of more than 6 elements" do
debate.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"]
expect(debate).to_not be_valid
end
- it "should be valid with a tag list of 6 elements" do
+ it "is valid with a tag list of 6 elements" do
debate.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
expect(debate).to be_valid
end
end
- it "should not be valid without accepting terms of service" do
+ it "is not valid without accepting terms of service" do
debate.terms_of_service = nil
expect(debate).to_not be_valid
end
@@ -92,18 +92,18 @@ describe Debate do
before(:each) { Setting["max_votes_for_debate_edit"] = 3 }
after(:each) { Setting["max_votes_for_debate_edit"] = 1000 }
- it "should be true if debate has no votes yet" do
+ it "is true if debate has no votes yet" do
expect(debate.total_votes).to eq(0)
expect(debate.editable?).to be true
end
- it "should be true if debate has less than limit votes" do
+ it "is true if debate has less than limit votes" do
create_list(:vote, 2, votable: debate)
expect(debate.total_votes).to eq(2)
expect(debate.editable?).to be true
end
- it "should be false if debate has more than limit votes" do
+ it "is false if debate has more than limit votes" do
create_list(:vote, 4, votable: debate)
expect(debate.total_votes).to eq(4)
expect(debate.editable?).to be false
@@ -116,16 +116,16 @@ describe Debate do
before(:each) { Setting["max_votes_for_debate_edit"] = 1 }
after(:each) { Setting["max_votes_for_debate_edit"] = 1000 }
- it "should be true if user is the author and debate is editable" do
+ it "is true if user is the author and debate is editable" do
expect(debate.editable_by?(debate.author)).to be true
end
- it "should be false if debate is not editable" do
+ it "is false if debate is not editable" do
create_list(:vote, 2, votable: debate)
expect(debate.editable_by?(debate.author)).to be false
end
- it "should be false if user is not the author" do
+ it "is false if user is not the author" do
expect(debate.editable_by?(create(:user))).to be false
end
end
@@ -137,29 +137,29 @@ describe Debate do
Setting["max_ratio_anon_votes_on_debates"] = 50
end
- it "should be true for level two verified users" do
+ it "is true for level two verified users" do
user = create(:user, residence_verified_at: Time.current, confirmed_phone: "666333111")
expect(debate.votable_by?(user)).to be true
end
- it "should be true for level three verified users" do
+ it "is true for level three verified users" do
user = create(:user, verified_at: Time.current)
expect(debate.votable_by?(user)).to be true
end
- it "should be true for anonymous users if allowed anonymous votes" do
+ it "is true for anonymous users if allowed anonymous votes" do
debate.update(cached_anonymous_votes_total: 420, cached_votes_total: 1000)
user = create(:user)
expect(debate.votable_by?(user)).to be true
end
- it "should be true for anonymous users if less than 100 votes" do
+ it "is true for anonymous users if less than 100 votes" do
debate.update(cached_anonymous_votes_total: 90, cached_votes_total: 92)
user = create(:user)
expect(debate.votable_by?(user)).to be true
end
- it "should be false for anonymous users if too many anonymous votes" do
+ it "is false for anonymous users if too many anonymous votes" do
debate.update(cached_anonymous_votes_total: 520, cached_votes_total: 1000)
user = create(:user)
expect(debate.votable_by?(user)).to be false
@@ -174,24 +174,24 @@ describe Debate do
end
describe "from level two verified users" do
- it "should register vote" do
+ it "registers vote" do
user = create(:user, residence_verified_at: Time.current, confirmed_phone: "666333111")
expect {debate.register_vote(user, 'yes')}.to change{debate.reload.votes_for.size}.by(1)
end
- it "should not increase anonymous votes counter " do
+ it "does not increase anonymous votes counter " do
user = create(:user, residence_verified_at: Time.current, confirmed_phone: "666333111")
expect {debate.register_vote(user, 'yes')}.to_not change{debate.reload.cached_anonymous_votes_total}
end
end
describe "from level three verified users" do
- it "should register vote" do
+ it "registers vote" do
user = create(:user, verified_at: Time.current)
expect {debate.register_vote(user, 'yes')}.to change{debate.reload.votes_for.size}.by(1)
end
- it "should not increase anonymous votes counter " do
+ it "does not increase anonymous votes counter " do
user = create(:user, verified_at: Time.current)
expect {debate.register_vote(user, 'yes')}.to_not change{debate.reload.cached_anonymous_votes_total}
end
@@ -200,12 +200,12 @@ describe Debate do
describe "from anonymous users when anonymous votes are allowed" do
before(:each) {debate.update(cached_anonymous_votes_total: 42, cached_votes_total: 100)}
- it "should register vote " do
+ it "registers vote" do
user = create(:user)
expect {debate.register_vote(user, 'yes')}.to change {debate.reload.votes_for.size}.by(1)
end
- it "should increase anonymous votes counter " do
+ it "increases anonymous votes counter" do
user = create(:user)
expect {debate.register_vote(user, 'yes')}.to change {debate.reload.cached_anonymous_votes_total}.by(1)
end
@@ -214,12 +214,12 @@ describe Debate do
describe "from anonymous users when there are too many anonymous votes" do
before(:each) {debate.update(cached_anonymous_votes_total: 520, cached_votes_total: 1000)}
- it "should not register vote " do
+ it "does not register vote " do
user = create(:user)
expect {debate.register_vote(user, 'yes')}.to_not change {debate.reload.votes_for.size}
end
- it "should not increase anonymous votes counter " do
+ it "does not increase anonymous votes counter " do
user = create(:user)
expect {debate.register_vote(user, 'yes')}.to_not change {debate.reload.cached_anonymous_votes_total}
end
@@ -334,47 +334,47 @@ describe Debate do
describe "cache" do
let(:debate) { create(:debate) }
- it "should expire cache when it has a new comment" do
+ it "expires cache when it has a new comment" do
expect { create(:comment, commentable: debate) }
.to change { debate.updated_at }
end
- it "should expire cache when it has a new vote" do
+ it "expires cache when it has a new vote" do
expect { create(:vote, votable: debate) }
.to change { debate.updated_at }
end
- it "should expire cache when it has a new flag" do
+ it "expires cache when it has a new flag" do
expect { create(:flag, flaggable: debate) }
.to change { debate.reload.updated_at }
end
- it "should expire cache when it has a new tag" do
+ it "expires cache when it has a new tag" do
expect { debate.update(tag_list: "new tag") }
.to change { debate.updated_at }
end
- it "should expire cache when hidden" do
+ it "expires cache when hidden" do
expect { debate.hide }
.to change { debate.updated_at }
end
- it "should expire cache when the author is hidden" do
+ it "expires cache when the author is hidden" do
expect { debate.author.hide }
.to change { [debate.reload.updated_at, debate.author.updated_at] }
end
- it "should expire cache when the author is erased" do
+ it "expires cache when the author is erased" do
expect { debate.author.erase }
.to change { [debate.reload.updated_at, debate.author.updated_at] }
end
- it "should expire cache when its author changes" do
+ it "expires cache when its author changes" do
expect { debate.author.update(username: "Eva") }
.to change { [debate.reload.updated_at, debate.author.updated_at] }
end
- it "should expire cache when the author's organization get verified" do
+ it "expires cache when the author's organization get verified" do
create(:organization, user: debate.author)
expect { debate.author.organization.verify }
.to change { [debate.reload.updated_at, debate.author.updated_at] }
@@ -397,7 +397,7 @@ describe Debate do
describe "conflictive debates" do
- it "should return true when it has more than 1 flag for 5 positive votes" do
+ it "returns true when it has more than 1 flag for 5 positive votes" do
debate.update(cached_votes_up: 4)
debate.update(flags_count: 1)
expect(debate).to be_conflictive
@@ -415,7 +415,7 @@ describe Debate do
expect(debate).to be_conflictive
end
- it "should return false when it has less than or equal to 1 flag for 5 positive votes" do
+ it "returns false when it has less than or equal to 1 flag for 5 positive votes" do
debate.update(cached_votes_up: 5)
debate.update(flags_count: 1)
expect(debate).to_not be_conflictive
@@ -429,12 +429,12 @@ describe Debate do
expect(debate).to_not be_conflictive
end
- it "should return false when it has no flags" do
+ it "returns false when it has no flags" do
debate.update(flags_count: 0)
expect(debate).to_not be_conflictive
end
- it "should return false when it has not votes up" do
+ it "returns false when it has not votes up" do
debate.update(cached_votes_up: 0)
expect(debate).to_not be_conflictive
end
@@ -574,7 +574,7 @@ describe Debate do
context "reorder" do
- it "should be able to reorder by hot_score after searching" do
+ it "is able to reorder by hot_score after searching" do
lowest_score = create(:debate, title: 'stop corruption', cached_votes_up: 1)
highest_score = create(:debate, title: 'stop corruption', cached_votes_up: 2)
average_score = create(:debate, title: 'stop corruption', cached_votes_up: 3)
@@ -596,7 +596,7 @@ describe Debate do
expect(results.third).to eq(lowest_score)
end
- it "should be able to reorder by confidence_score after searching" do
+ it "is able to reorder by confidence_score after searching" do
lowest_score = create(:debate, title: 'stop corruption', cached_votes_up: 1)
highest_score = create(:debate, title: 'stop corruption', cached_votes_up: 2)
average_score = create(:debate, title: 'stop corruption', cached_votes_up: 3)
@@ -618,7 +618,7 @@ describe Debate do
expect(results.third).to eq(lowest_score)
end
- it "should be able to reorder by created_at after searching" do
+ it "is able to reorder by created_at after searching" do
recent = create(:debate, title: 'stop corruption', cached_votes_up: 1, created_at: 1.week.ago)
newest = create(:debate, title: 'stop corruption', cached_votes_up: 2, created_at: Time.current)
oldest = create(:debate, title: 'stop corruption', cached_votes_up: 3, created_at: 1.month.ago)
@@ -636,7 +636,7 @@ describe Debate do
expect(results.third).to eq(oldest)
end
- it "should be able to reorder by most commented after searching" do
+ it "is able to reorder by most commented after searching" do
least_commented = create(:debate, title: 'stop corruption', cached_votes_up: 1, comments_count: 1)
most_commented = create(:debate, title: 'stop corruption', cached_votes_up: 2, comments_count: 100)
some_comments = create(:debate, title: 'stop corruption', cached_votes_up: 3, comments_count: 10)
@@ -690,19 +690,19 @@ describe Debate do
end
describe "#last_week" do
- it "should return debates created this week" do
+ it "returns debates created this week" do
debate = create(:debate)
expect(described_class.last_week.all).to include debate
end
- it "should not show debates created more than a week ago" do
+ it "does not show debates created more than a week ago" do
debate = create(:debate, created_at: 8.days.ago)
expect(described_class.last_week.all).to_not include debate
end
end
describe "#to_param" do
- it "should return a friendly url" do
+ it "returns a friendly url" do
expect(debate.to_param).to eq "#{debate.id} #{debate.title}".parameterize
end
end
@@ -723,13 +723,13 @@ describe Debate do
let(:user) { create(:user) }
- it "Should not return any debates when user has not interests" do
+ it "does not return any debates when user has not interests" do
create(:debate)
expect(described_class.recommendations(user).size).to eq 0
end
- it "Should return debates ordered by cached_votes_total" do
+ it "returns debates ordered by cached_votes_total" do
debate1 = create(:debate, cached_votes_total: 1, tag_list: "Sport")
debate2 = create(:debate, cached_votes_total: 5, tag_list: "Sport")
debate3 = create(:debate, cached_votes_total: 10, tag_list: "Sport")
@@ -743,7 +743,7 @@ describe Debate do
expect(result.third).to eq debate1
end
- it "Should return debates related with user interests" do
+ it "returns debates related with user interests" do
debate1 = create(:debate, tag_list: "Sport")
debate2 = create(:debate, tag_list: "Politics")
proposal1 = create(:proposal, tag_list: "Sport")
@@ -755,7 +755,7 @@ describe Debate do
expect(result).to eq [debate1]
end
- it "Should not return debates when user is the author" do
+ it "does not return debates when user is the author" do
debate1 = create(:debate, author: user, tag_list: "Sport")
debate2 = create(:debate, tag_list: "Sport")
proposal = create(:proposal, tag_list: "Sport")
diff --git a/spec/models/direct_message_spec.rb b/spec/models/direct_message_spec.rb
index 85388c007..a9c68bd34 100644
--- a/spec/models/direct_message_spec.rb
+++ b/spec/models/direct_message_spec.rb
@@ -4,26 +4,26 @@ describe DirectMessage do
let(:direct_message) { build(:direct_message) }
- it "should be valid" do
+ it "is valid" do
expect(direct_message).to be_valid
end
- it "should not be valid without a title" do
+ it "is not valid without a title" do
direct_message.title = nil
expect(direct_message).to_not be_valid
end
- it "should not be valid without a body" do
+ it "is not valid without a body" do
direct_message.body = nil
expect(direct_message).to_not be_valid
end
- it "should not be valid without an associated sender" do
+ it "is not valid without an associated sender" do
direct_message.sender = nil
expect(direct_message).to_not be_valid
end
- it "should not be valid without an associated receiver" do
+ it "is not valid without an associated receiver" do
direct_message.receiver = nil
expect(direct_message).to_not be_valid
end
@@ -34,7 +34,7 @@ describe DirectMessage do
Setting[:direct_message_max_per_day] = 3
end
- it "should not be valid if above maximum" do
+ it "is not valid if above maximum" do
sender = create(:user)
direct_message1 = create(:direct_message, sender: sender)
direct_message2 = create(:direct_message, sender: sender)
@@ -44,7 +44,7 @@ describe DirectMessage do
expect(direct_message4).to_not be_valid
end
- it "should be valid if below maximum" do
+ it "is valid if below maximum" do
sender = create(:user)
direct_message1 = create(:direct_message, sender: sender)
direct_message2 = create(:direct_message, sender: sender)
@@ -53,7 +53,7 @@ describe DirectMessage do
expect(direct_message).to be_valid
end
- it "should be valid if no direct_messages sent" do
+ it "is valid if no direct_messages sent" do
direct_message = build(:direct_message)
expect(direct_message).to be_valid
@@ -65,7 +65,7 @@ describe DirectMessage do
Setting[:direct_message_max_per_day] = nil
end
- it "should be valid" do
+ it "is valid" do
direct_message = build(:direct_message)
expect(direct_message).to be_valid
@@ -76,7 +76,7 @@ describe DirectMessage do
describe "scopes" do
describe "today" do
- it "should return direct messages created today" do
+ it "returns direct messages created today" do
direct_message1 = create(:direct_message, created_at: Time.now.utc.beginning_of_day + 3.hours)
direct_message2 = create(:direct_message, created_at: Time.now.utc)
direct_message3 = create(:direct_message, created_at: Time.now.utc.end_of_day)
@@ -84,7 +84,7 @@ describe DirectMessage do
expect(described_class.today.count).to eq 3
end
- it "should not return direct messages created another day" do
+ it "does not return direct messages created another day" do
direct_message1 = create(:direct_message, created_at: 1.day.ago)
direct_message2 = create(:direct_message, created_at: 1.day.from_now)
diff --git a/spec/models/direct_upload_spec.rb b/spec/models/direct_upload_spec.rb
index 8cfebf076..05bb73537 100644
--- a/spec/models/direct_upload_spec.rb
+++ b/spec/models/direct_upload_spec.rb
@@ -4,40 +4,40 @@ describe DirectUpload do
context "configurations" do
- it "should be valid for different kind of combinations when attachment is valid" do
+ it "is valid for different kind of combinations when attachment is valid" do
expect(build(:direct_upload, :proposal, :documents)).to be_valid
expect(build(:direct_upload, :proposal, :image)).to be_valid
expect(build(:direct_upload, :budget_investment, :documents)).to be_valid
expect(build(:direct_upload, :budget_investment, :image)).to be_valid
end
- it "should not be valid for different kind of combinations with invalid atttachment content types" do
+ it "is not valid for different kind of combinations with invalid atttachment content types" do
expect(build(:direct_upload, :proposal, :documents, attachment: File.new("spec/fixtures/files/clippy.png"))).not_to be_valid
expect(build(:direct_upload, :proposal, :image, attachment: File.new("spec/fixtures/files/empty.pdf"))).not_to be_valid
expect(build(:direct_upload, :budget_investment, :documents, attachment: File.new("spec/fixtures/files/clippy.png"))).not_to be_valid
expect(build(:direct_upload, :budget_investment, :image, attachment: File.new("spec/fixtures/files/empty.pdf"))).not_to be_valid
end
- it "should not be valid without resource_type" do
+ it "is not valid without resource_type" do
expect(build(:direct_upload, :proposal, :documents, resource_type: nil)).not_to be_valid
end
- it "should not be valid without resource_relation" do
+ it "is not valid without resource_relation" do
expect(build(:direct_upload, :proposal, :documents, resource_relation: nil)).not_to be_valid
end
- it "should not be valid without attachment" do
+ it "is not valid without attachment" do
expect(build(:direct_upload, :proposal, :documents, attachment: nil)).not_to be_valid
end
- it "should not be valid without user" do
+ it "is not valid without user" do
expect(build(:direct_upload, :proposal, :documents, user: nil)).not_to be_valid
end
end
context "save_attachment" do
- it "should save uploaded file" do
+ it "saves uploaded file" do
proposal_document_direct_upload = build(:direct_upload, :proposal, :documents)
proposal_document_direct_upload.save_attachment
@@ -50,7 +50,7 @@ describe DirectUpload do
context "destroy_attachment" do
- it "should remove uploaded file" do
+ it "removes uploaded file" do
proposal_document_direct_upload = build(:direct_upload, :proposal, :documents)
proposal_document_direct_upload.save_attachment
diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb
index fc17924f5..5f7874267 100644
--- a/spec/models/follow_spec.rb
+++ b/spec/models/follow_spec.rb
@@ -4,21 +4,21 @@ describe Follow do
let(:follow) { build(:follow, :followed_proposal) }
- it "should be valid" do
+ it "is valid" do
expect(follow).to be_valid
end
- it "should not be valid without a user_id" do
+ it "is not valid without a user_id" do
follow.user_id = nil
expect(follow).to_not be_valid
end
- it "should not be valid without a followable_id" do
+ it "is not valid without a followable_id" do
follow.followable_id = nil
expect(follow).to_not be_valid
end
- it "should not be valid without a followable_type" do
+ it "is not valid without a followable_type" do
follow.followable_type = nil
expect(follow).to_not be_valid
end
diff --git a/spec/models/geozone_spec.rb b/spec/models/geozone_spec.rb
index 0eeb331b7..674cb2181 100644
--- a/spec/models/geozone_spec.rb
+++ b/spec/models/geozone_spec.rb
@@ -3,11 +3,11 @@ require 'rails_helper'
describe Geozone do
let(:geozone) { build(:geozone) }
- it "should be valid" do
+ it "is valid" do
expect(geozone).to be_valid
end
- it "should not be valid without a name" do
+ it "is not valid without a name" do
geozone.name = nil
expect(geozone).to_not be_valid
end
diff --git a/spec/models/identity_spec.rb b/spec/models/identity_spec.rb
index 82d5c4be3..7622c4333 100644
--- a/spec/models/identity_spec.rb
+++ b/spec/models/identity_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
RSpec.describe Identity, type: :model do
let(:identity) { build(:identity) }
- it "should be valid" do
+ it "is valid" do
expect(identity).to be_valid
end
end
diff --git a/spec/models/legislation/annotation_spec.rb b/spec/models/legislation/annotation_spec.rb
index ffcffd6e3..49beb80d5 100644
--- a/spec/models/legislation/annotation_spec.rb
+++ b/spec/models/legislation/annotation_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe Legislation::Annotation, type: :model do
let(:draft_version) { create(:legislation_draft_version) }
let(:annotation) { create(:legislation_annotation, draft_version: draft_version) }
- it "should be valid" do
+ it "is valid" do
expect(draft_version).to be_valid
expect(annotation).to be_valid
end
diff --git a/spec/models/legislation/answer_spec.rb b/spec/models/legislation/answer_spec.rb
index 9f5037081..5c28a82fb 100644
--- a/spec/models/legislation/answer_spec.rb
+++ b/spec/models/legislation/answer_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
RSpec.describe Legislation::Answer, type: :model do
let(:legislation_answer) { build(:legislation_answer) }
- it "should be valid" do
+ it "is valid" do
expect(legislation_answer).to be_valid
end
diff --git a/spec/models/legislation/draft_version_spec.rb b/spec/models/legislation/draft_version_spec.rb
index 384fc4513..1b0427a6c 100644
--- a/spec/models/legislation/draft_version_spec.rb
+++ b/spec/models/legislation/draft_version_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
RSpec.describe Legislation::DraftVersion, type: :model do
let(:legislation_draft_version) { build(:legislation_draft_version) }
- it "should be valid" do
+ it "is valid" do
expect(legislation_draft_version).to be_valid
end
diff --git a/spec/models/legislation/process_spec.rb b/spec/models/legislation/process_spec.rb
index 5783df2fe..04bda604c 100644
--- a/spec/models/legislation/process_spec.rb
+++ b/spec/models/legislation/process_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe Legislation::Process do
let(:process) { create(:legislation_process) }
- it "should be valid" do
+ it "is valid" do
expect(process).to be_valid
end
@@ -101,17 +101,17 @@ describe Legislation::Process do
end
describe "#status" do
- it "should detect planned phase" do
+ it "detects planned phase" do
process.update_attributes(start_date: Date.current + 2.days)
expect(process.status).to eq(:planned)
end
- it "should detect closed phase" do
+ it "detects closed phase" do
process.update_attributes(end_date: Date.current - 2.days)
expect(process.status).to eq(:closed)
end
- it "should detect open phase" do
+ it "detects open phase" do
expect(process.status).to eq(:open)
end
end
diff --git a/spec/models/legislation/proposal_spec.rb b/spec/models/legislation/proposal_spec.rb
index f67cf0f8f..892164e17 100644
--- a/spec/models/legislation/proposal_spec.rb
+++ b/spec/models/legislation/proposal_spec.rb
@@ -3,26 +3,26 @@ require 'rails_helper'
describe Legislation::Proposal do
let(:proposal) { build(:legislation_proposal) }
- it "should be valid" do
+ it "is valid" do
expect(proposal).to be_valid
end
- it "should not be valid without a process" do
+ it "is not valid without a process" do
proposal.process = nil
expect(proposal).to_not be_valid
end
- it "should not be valid without an author" do
+ it "is not valid without an author" do
proposal.author = nil
expect(proposal).to_not be_valid
end
- it "should not be valid without a title" do
+ it "is not valid without a title" do
proposal.title = nil
expect(proposal).to_not be_valid
end
- it "should not be valid without a summary" do
+ it "is not valid without a summary" do
proposal.summary = nil
expect(proposal).to_not be_valid
end
diff --git a/spec/models/legislation/question_option_spec.rb b/spec/models/legislation/question_option_spec.rb
index 37b64c07e..0b635cfe9 100644
--- a/spec/models/legislation/question_option_spec.rb
+++ b/spec/models/legislation/question_option_spec.rb
@@ -3,11 +3,11 @@ require 'rails_helper'
RSpec.describe Legislation::QuestionOption, type: :model do
let(:legislation_question_option) { build(:legislation_question_option) }
- it "should be valid" do
+ it "is valid" do
expect(legislation_question_option).to be_valid
end
- it "should be unique per question" do
+ it "is unique per question" do
question = create(:legislation_question)
valid_question_option = create(:legislation_question_option, question: question, value: "uno")
diff --git a/spec/models/legislation/question_spec.rb b/spec/models/legislation/question_spec.rb
index ff5ed289e..679a39d1b 100644
--- a/spec/models/legislation/question_spec.rb
+++ b/spec/models/legislation/question_spec.rb
@@ -7,7 +7,7 @@ describe Legislation::Question do
it_behaves_like "notifiable"
end
- it "should be valid" do
+ it "is valid" do
expect(question).to be_valid
end
@@ -45,11 +45,11 @@ describe Legislation::Question do
let!(:question1) { create(:legislation_question) }
let!(:question2) { create(:legislation_question, legislation_process_id: question1.legislation_process_id) }
- it "should return the next question" do
+ it "returns the next question" do
expect(question1.next_question_id).to eq(question2.id)
end
- it "should return nil" do
+ it "returns nil" do
expect(question2.next_question_id).to be_nil
end
end
@@ -58,7 +58,7 @@ describe Legislation::Question do
let!(:question1) { create(:legislation_question) }
let!(:question2) { create(:legislation_question, legislation_process_id: question1.legislation_process_id) }
- it "should return the first question" do
+ it "returns the first question" do
expect(question1.first_question_id).to eq(question1.id)
expect(question2.first_question_id).to eq(question1.id)
end
diff --git a/spec/models/letter_spec.rb b/spec/models/letter_spec.rb
index 3b9d37238..d4fe25035 100644
--- a/spec/models/letter_spec.rb
+++ b/spec/models/letter_spec.rb
@@ -8,11 +8,11 @@ describe Verification::Letter do
let(:letter) { build(:verification_letter) }
- it "should be valid" do
+ it "is valid" do
expect(letter).to be_valid
end
- it "should not be valid without a user" do
+ it "is not valid without a user" do
letter.user = nil
expect(letter).to_not be_valid
end
@@ -21,7 +21,7 @@ describe Verification::Letter do
describe "save" do
- it "should update letter_requested" do
+ it "updates letter_requested" do
letter = build(:verification_letter)
letter.save
expect(letter.user.letter_requested_at).to be
diff --git a/spec/models/map_location_spec.rb b/spec/models/map_location_spec.rb
index 62070529e..8c5367768 100644
--- a/spec/models/map_location_spec.rb
+++ b/spec/models/map_location_spec.rb
@@ -4,29 +4,29 @@ describe MapLocation do
let(:map_location) { build(:map_location, :proposal_map_location) }
- it "should be valid" do
+ it "is valid" do
expect(map_location).to be_valid
end
context "#available?" do
- it "should return true when latitude, longitude and zoom defined" do
+ it "returns true when latitude, longitude and zoom defined" do
expect(map_location.available?).to be(true)
end
- it "should return false when longitude is nil" do
+ it "returns false when longitude is nil" do
map_location.longitude = nil
expect(map_location.available?).to be(false)
end
- it "should return false when latitude is nil" do
+ it "returns false when latitude is nil" do
map_location.latitude = nil
expect(map_location.available?).to be(false)
end
- it "should return false when zoom is nil" do
+ it "returns false when zoom is nil" do
map_location.zoom = nil
expect(map_location.available?).to be(false)
diff --git a/spec/models/officing/residence_spec.rb b/spec/models/officing/residence_spec.rb
index d730d3262..daff43ce1 100644
--- a/spec/models/officing/residence_spec.rb
+++ b/spec/models/officing/residence_spec.rb
@@ -7,33 +7,33 @@ describe Officing::Residence do
describe "validations" do
- it "should be valid" do
+ it "is valid" do
expect(residence).to be_valid
end
- it "should not be valid without a document number" do
+ it "is not valid without a document number" do
residence.document_number = nil
expect(residence).to_not be_valid
end
- it "should not be valid without a document type" do
+ it "is not valid without a document type" do
residence.document_type = nil
expect(residence).to_not be_valid
end
- it "should not be valid without a year of birth" do
+ it "is not valid without a year of birth" do
residence.year_of_birth = nil
expect(residence).to_not be_valid
end
describe "allowed age" do
- it "should not be valid if user is under allowed age" do
+ it "is not valid if user is under allowed age" do
allow_any_instance_of(described_class).to receive(:date_of_birth).and_return(15.years.ago)
expect(residence).to_not be_valid
expect(residence.errors[:year_of_birth]).to include("You don't have the required age to participate")
end
- it "should be valid if user is above allowed age" do
+ it "is valid if user is above allowed age" do
allow_any_instance_of(described_class).to receive(:date_of_birth).and_return(16.years.ago)
expect(residence).to be_valid
expect(residence.errors[:year_of_birth]).to be_empty
@@ -43,12 +43,12 @@ describe Officing::Residence do
end
describe "new" do
- it "should upcase document number" do
+ it "upcases document number" do
residence = described_class.new(document_number: "x1234567z")
expect(residence.document_number).to eq("X1234567Z")
end
- it "should remove all characters except numbers and letters" do
+ it "removes all characters except numbers and letters" do
residence = described_class.new(document_number: " 12.345.678 - B")
expect(residence.document_number).to eq("12345678B")
end
@@ -56,7 +56,7 @@ describe Officing::Residence do
describe "save" do
- it "should store document number, document type, geozone, date of birth and gender" do
+ it "stores document number, document type, geozone, date of birth and gender" do
residence.save
user = residence.user
@@ -69,7 +69,7 @@ describe Officing::Residence do
expect(user.geozone).to eq(geozone)
end
- it "should find existing user and use demographic information" do
+ it "finds existing user and use demographic information" do
geozone = create(:geozone)
create(:user, document_number: "12345678Z",
document_type: "1",
diff --git a/spec/models/poll/answer_spec.rb b/spec/models/poll/answer_spec.rb
index 33cf833b6..0582efd86 100644
--- a/spec/models/poll/answer_spec.rb
+++ b/spec/models/poll/answer_spec.rb
@@ -6,26 +6,26 @@ describe Poll::Answer do
let(:answer) { build(:poll_answer) }
- it "should be valid" do
+ it "is valid" do
expect(answer).to be_valid
end
- it "should not be valid wihout a question" do
+ it "is not valid wihout a question" do
answer.question = nil
expect(answer).to_not be_valid
end
- it "should not be valid without an author" do
+ it "is not valid without an author" do
answer.author = nil
expect(answer).to_not be_valid
end
- it "should not be valid without an answer" do
+ it "is not valid without an answer" do
answer.answer = nil
expect(answer).to_not be_valid
end
- it "should be valid for answers included in the Poll::Question's question_answers list" do
+ it "is valid for answers included in the Poll::Question's question_answers list" do
question = create(:poll_question)
create(:poll_question_answer, title: 'One', question: question)
create(:poll_question_answer, title: 'Two', question: question)
diff --git a/spec/models/poll/booth_assignment_spec.rb b/spec/models/poll/booth_assignment_spec.rb
index 1d2920abb..ffea2065f 100644
--- a/spec/models/poll/booth_assignment_spec.rb
+++ b/spec/models/poll/booth_assignment_spec.rb
@@ -5,7 +5,7 @@ describe Poll::BoothAssignment do
let(:booth){create(:poll_booth)}
let(:booth1){create(:poll_booth)}
- it "should check if there are shifts" do
+ it "checks if there are shifts" do
assignment_with_shifts = create(:poll_booth_assignment, poll: poll, booth: booth)
assignment_without_shifts = create(:poll_booth_assignment, poll: poll, booth: booth1)
officer = create(:poll_officer)
@@ -16,7 +16,7 @@ describe Poll::BoothAssignment do
expect(assignment_without_shifts.shifts?).to eq(false)
end
- it "should delete shifts associated to booth assignments" do
+ it "deletes shifts associated to booth assignments" do
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
officer = create(:poll_officer)
create(:poll_officer_assignment, officer: officer, booth_assignment: assignment)
diff --git a/spec/models/poll/booth_spec.rb b/spec/models/poll/booth_spec.rb
index 1f0f22ffe..652e1060c 100644
--- a/spec/models/poll/booth_spec.rb
+++ b/spec/models/poll/booth_spec.rb
@@ -4,17 +4,17 @@ describe Poll::Booth do
let(:booth) { build(:poll_booth) }
- it "should be valid" do
+ it "is valid" do
expect(booth).to be_valid
end
- it "should not be valid without a name" do
+ it "is not valid without a name" do
booth.name = nil
expect(booth).to_not be_valid
end
describe "#search" do
- it "should find booths searching by name or location" do
+ it "finds booths searching by name or location" do
booth1 = create(:poll_booth, name: "Booth number 1", location: "City center")
booth2 = create(:poll_booth, name: "Central", location: "Town hall")
diff --git a/spec/models/poll/officer_assignment_spec.rb b/spec/models/poll/officer_assignment_spec.rb
index e06b7f177..0234242ed 100644
--- a/spec/models/poll/officer_assignment_spec.rb
+++ b/spec/models/poll/officer_assignment_spec.rb
@@ -1,7 +1,7 @@
require 'rails_helper'
describe Poll::OfficerAssignment do
- it "should log user data on creation" do
+ it "logs user data on creation" do
user = create(:user, username: "Larry Bird", email: "larry@lege.nd")
officer = create(:poll_officer, user: user)
diff --git a/spec/models/poll/officer_spec.rb b/spec/models/poll/officer_spec.rb
index 258427d1e..146efa50e 100644
--- a/spec/models/poll/officer_spec.rb
+++ b/spec/models/poll/officer_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe Poll::Officer do
describe "#voting_days_assigned_polls" do
- it "should return all polls with this officer assigned during voting days" do
+ it "returns all polls with this officer assigned during voting days" do
officer = create(:poll_officer)
poll_1 = create(:poll)
@@ -25,7 +25,7 @@ describe Poll::Officer do
expect(assigned_polls.include?(poll_3)).to eq(false)
end
- it "should not return polls with this officer assigned for final recount/results" do
+ it "does not return polls with this officer assigned for final recount/results" do
officer = create(:poll_officer)
poll_1 = create(:poll)
@@ -43,7 +43,7 @@ describe Poll::Officer do
expect(assigned_polls.include?(poll_2)).to eq(false)
end
- it "should return polls ordered by end date (desc)" do
+ it "returns polls ordered by end date (desc)" do
officer = create(:poll_officer)
poll_1 = create(:poll, ends_at: 1.day.ago)
@@ -63,7 +63,7 @@ describe Poll::Officer do
end
describe "#final_days_assigned_polls" do
- it "should return all polls with this officer assigned for final recount/results" do
+ it "returns all polls with this officer assigned for final recount/results" do
officer = create(:poll_officer)
poll_1 = create(:poll)
@@ -85,7 +85,7 @@ describe Poll::Officer do
expect(assigned_polls.include?(poll_3)).to eq(false)
end
- it "should not return polls with this officer assigned for voting days" do
+ it "does not return polls with this officer assigned for voting days" do
officer = create(:poll_officer)
poll_1 = create(:poll)
@@ -103,7 +103,7 @@ describe Poll::Officer do
expect(assigned_polls.include?(poll_2)).to eq(true)
end
- it "should return polls ordered by end date (desc)" do
+ it "returns polls ordered by end date (desc)" do
officer = create(:poll_officer)
poll_1 = create(:poll, ends_at: 1.day.ago)
diff --git a/spec/models/poll/partial_result_spec.rb b/spec/models/poll/partial_result_spec.rb
index 316b17524..7fa1e5e4a 100644
--- a/spec/models/poll/partial_result_spec.rb
+++ b/spec/models/poll/partial_result_spec.rb
@@ -18,7 +18,7 @@ describe Poll::PartialResult do
end
describe "logging changes" do
- it "should update amount_log if amount changes" do
+ it "updates amount_log if amount changes" do
partial_result = create(:poll_partial_result, amount: 33)
expect(partial_result.amount_log).to eq("")
@@ -33,7 +33,7 @@ describe Poll::PartialResult do
expect(partial_result.amount_log).to eq(":33:32")
end
- it "should update officer_assignment_id_log if amount changes" do
+ it "updates officer_assignment_id_log if amount changes" do
partial_result = create(:poll_partial_result, amount: 33)
expect(partial_result.amount_log).to eq("")
@@ -55,7 +55,7 @@ describe Poll::PartialResult do
expect(partial_result.officer_assignment_id_log).to eq(":10:20")
end
- it "should update author_id if amount changes" do
+ it "updates author_id if amount changes" do
partial_result = create(:poll_partial_result, amount: 33)
expect(partial_result.amount_log).to eq("")
diff --git a/spec/models/poll/poll_spec.rb b/spec/models/poll/poll_spec.rb
index 8875088f8..ae8be79b8 100644
--- a/spec/models/poll/poll_spec.rb
+++ b/spec/models/poll/poll_spec.rb
@@ -9,26 +9,26 @@ describe Poll do
end
describe "validations" do
- it "should be valid" do
+ it "is valid" do
expect(poll).to be_valid
end
- it "should not be valid without a name" do
+ it "is not valid without a name" do
poll.name = nil
expect(poll).to_not be_valid
end
- it "should not be valid without a start date" do
+ it "is not valid without a start date" do
poll.starts_at = nil
expect(poll).to_not be_valid
end
- it "should not be valid without an end date" do
+ it "is not valid without an end date" do
poll.ends_at = nil
expect(poll).to_not be_valid
end
- it "should not be valid without a proper start/end date range" do
+ it "is not valid without a proper start/end date range" do
poll.starts_at = 1.week.ago
poll.ends_at = 2.months.ago
expect(poll).to_not be_valid
diff --git a/spec/models/poll/question_spec.rb b/spec/models/poll/question_spec.rb
index 8c8a94d35..43f2de7a9 100644
--- a/spec/models/poll/question_spec.rb
+++ b/spec/models/poll/question_spec.rb
@@ -4,12 +4,12 @@ RSpec.describe Poll::Question, type: :model do
let(:poll_question) { build(:poll_question) }
describe "#poll_question_id" do
- it "should be invalid if a poll is not selected" do
+ it "is invalid if a poll is not selected" do
poll_question.poll_id = nil
expect(poll_question).to_not be_valid
end
- it "should be valid if a poll is selected" do
+ it "is valid if a poll is selected" do
poll_question.poll_id = 1
expect(poll_question).to be_valid
end
diff --git a/spec/models/poll/recount_spec.rb b/spec/models/poll/recount_spec.rb
index 2a5ed16a7..e7b149f69 100644
--- a/spec/models/poll/recount_spec.rb
+++ b/spec/models/poll/recount_spec.rb
@@ -7,7 +7,7 @@ describe Poll::Recount do
let(:officer_assignment) { create(:poll_officer_assignment) }
let(:poll_recount) { create(:poll_recount, author: author, officer_assignment: officer_assignment) }
- it "should update white_amount_log if white_amount changes" do
+ it "updates white_amount_log if white_amount changes" do
poll_recount.white_amount = 33
expect(poll_recount.white_amount_log).to eq("")
@@ -22,7 +22,7 @@ describe Poll::Recount do
expect(poll_recount.white_amount_log).to eq(":0:33:32")
end
- it "should update null_amount_log if null_amount changes" do
+ it "updates null_amount_log if null_amount changes" do
poll_recount.null_amount = 33
expect(poll_recount.null_amount_log).to eq("")
@@ -37,7 +37,7 @@ describe Poll::Recount do
expect(poll_recount.null_amount_log).to eq(":0:33:32")
end
- it "should update total_amount_log if total_amount changes" do
+ it "updates total_amount_log if total_amount changes" do
poll_recount.total_amount = 33
expect(poll_recount.total_amount_log).to eq("")
@@ -52,7 +52,7 @@ describe Poll::Recount do
expect(poll_recount.total_amount_log).to eq(":0:33:32")
end
- it "should update officer_assignment_id_log if amount changes" do
+ it "updates officer_assignment_id_log if amount changes" do
poll_recount.white_amount = 33
expect(poll_recount.white_amount_log).to eq("")
@@ -74,7 +74,7 @@ describe Poll::Recount do
expect(poll_recount.officer_assignment_id_log).to eq(":#{officer_assignment.id}:101:102")
end
- it "should update author_id if amount changes" do
+ it "updates author_id if amount changes" do
poll_recount.white_amount = 33
expect(poll_recount.white_amount_log).to eq("")
diff --git a/spec/models/poll/shift_spec.rb b/spec/models/poll/shift_spec.rb
index ffe60cb1b..bb1146baa 100644
--- a/spec/models/poll/shift_spec.rb
+++ b/spec/models/poll/shift_spec.rb
@@ -10,43 +10,43 @@ describe Poll::Shift do
describe "validations" do
let(:shift) { build(:poll_shift) }
- it "should be valid" do
+ it "is valid" do
expect(shift).to be_valid
end
- it "should not be valid without a booth" do
+ it "is not valid without a booth" do
shift.booth = nil
expect(shift).to_not be_valid
end
- it "should not be valid without an officer" do
+ it "is not valid without an officer" do
shift.officer = nil
expect(shift).to_not be_valid
end
- it "should not be valid without a date" do
+ it "is not valid without a date" do
shift.date = nil
expect(shift).to_not be_valid
end
- it "should not be valid without a task" do
+ it "is not valid without a task" do
shift.task = nil
expect(shift).to_not be_valid
end
- it "should not be valid with same booth, officer, date and task" do
+ it "is not valid with same booth, officer, date and task" do
recount_shift.save
expect(build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :recount_scrutiny)).to_not be_valid
end
- it "should be valid with same booth, officer and date but different task" do
+ it "is valid with same booth, officer and date but different task" do
recount_shift.save
expect(build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :vote_collection)).to be_valid
end
- it "should be valid with same booth, officer and task but different date" do
+ it "is valid with same booth, officer and task but different date" do
recount_shift.save
expect(build(:poll_shift, booth: booth, officer: officer, date: Date.tomorrow, task: :recount_scrutiny)).to be_valid
@@ -56,7 +56,7 @@ describe Poll::Shift do
describe "officer_assignments" do
- it "should create and destroy corresponding officer_assignments" do
+ it "creates and destroy corresponding officer_assignments" do
poll2 = create(:poll)
poll3 = create(:poll)
@@ -84,7 +84,7 @@ describe Poll::Shift do
expect { described_class.last.destroy }.to change {Poll::OfficerAssignment.all.count}.by(-2)
end
- it "should create final officer_assignments" do
+ it "creates final officer_assignments" do
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
recount_shift.save
@@ -104,14 +104,14 @@ describe Poll::Shift do
describe "#persist_data" do
let(:shift) { create(:poll_shift, officer: officer, booth: booth) }
- it "should maintain officer data after destroying associated user" do
+ it "maintains officer data after destroying associated user" do
shift.officer.user.destroy
expect(shift.officer_name).to eq "Ana"
expect(shift.officer_email).to eq "ana@example.com"
end
- it "should maintain officer data after destroying officer role" do
+ it "maintains officer data after destroying officer role" do
shift.officer.destroy
expect(shift.officer_name).to eq "Ana"
diff --git a/spec/models/poll/voter_spec.rb b/spec/models/poll/voter_spec.rb
index b12d0bba1..df28383bb 100644
--- a/spec/models/poll/voter_spec.rb
+++ b/spec/models/poll/voter_spec.rb
@@ -9,27 +9,27 @@ describe Poll::Voter do
describe "validations" do
- it "should be valid" do
+ it "is valid" do
expect(voter).to be_valid
end
- it "should not be valid without a user" do
+ it "is not valid without a user" do
voter.user = nil
expect(voter).to_not be_valid
end
- it "should not be valid without a poll" do
+ it "is not valid without a poll" do
voter.poll = nil
expect(voter).to_not be_valid
end
- it "should be valid if has not voted" do
+ it "is valid if has not voted" do
voter = build(:poll_voter, :valid_document)
expect(voter).to be_valid
end
- it "should not be valid if the user has already voted in the same poll or booth_assignment" do
+ it "is not valid if the user has already voted in the same poll or booth_assignment" do
user = create(:user, :level_two)
voter1 = create(:poll_voter, user: user, poll: poll)
@@ -39,7 +39,7 @@ describe Poll::Voter do
expect(voter2.errors.messages[:document_number]).to eq(["User has already voted"])
end
- it "should not be valid if the user has already voted in the same poll/booth" do
+ it "is not valid if the user has already voted in the same poll/booth" do
user = create(:user, :level_two)
voter1 = create(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment)
@@ -49,7 +49,7 @@ describe Poll::Voter do
expect(voter2.errors.messages[:document_number]).to eq(["User has already voted"])
end
- it "should not be valid if the user has already voted in different booth in the same poll" do
+ it "is not valid if the user has already voted in different booth in the same poll" do
booth_assignment1 = create(:poll_booth_assignment, poll: poll)
booth_assignment2 = create(:poll_booth_assignment, poll: poll)
@@ -62,7 +62,7 @@ describe Poll::Voter do
expect(voter2.errors.messages[:document_number]).to eq(["User has already voted"])
end
- it "should be valid if the user has already voted in the same booth in different poll" do
+ it "is valid if the user has already voted in the same booth in different poll" do
booth_assignment1 = create(:poll_booth_assignment, booth: booth)
booth_assignment2 = create(:poll_booth_assignment, booth: booth, poll: poll)
@@ -74,7 +74,7 @@ describe Poll::Voter do
expect(voter2).to be_valid
end
- it "should not be valid if the user has voted via web" do
+ it "is not valid if the user has voted via web" do
answer = create(:poll_answer)
answer.record_voter_participation('token')
@@ -85,22 +85,22 @@ describe Poll::Voter do
context "origin" do
- it "should not be valid without an origin" do
+ it "is not valid without an origin" do
voter.origin = nil
expect(voter).to_not be_valid
end
- it "should not be valid without a valid origin" do
+ it "is not valid without a valid origin" do
voter.origin = "invalid_origin"
expect(voter).to_not be_valid
end
- it "should be valid with a booth origin" do
+ it "is valid with a booth origin" do
voter.origin = "booth"
expect(voter).to be_valid
end
- it "should be valid with a web origin" do
+ it "is valid with a web origin" do
voter.origin = "web"
expect(voter).to be_valid
end
diff --git a/spec/models/proposal_notification_spec.rb b/spec/models/proposal_notification_spec.rb
index 6a557b897..b2d79f917 100644
--- a/spec/models/proposal_notification_spec.rb
+++ b/spec/models/proposal_notification_spec.rb
@@ -3,21 +3,21 @@ require 'rails_helper'
describe ProposalNotification do
let(:notification) { build(:proposal_notification) }
- it "should be valid" do
+ it "is valid" do
expect(notification).to be_valid
end
- it "should not be valid without a title" do
+ it "is not valid without a title" do
notification.title = nil
expect(notification).to_not be_valid
end
- it "should not be valid without a body" do
+ it "is not valid without a body" do
notification.body = nil
expect(notification).to_not be_valid
end
- it "should not be valid without an associated proposal" do
+ it "is not valid without an associated proposal" do
notification.proposal = nil
expect(notification).to_not be_valid
end
@@ -50,7 +50,7 @@ describe ProposalNotification do
Setting[:proposal_notification_minimum_interval_in_days] = 3
end
- it "should not be valid if below minium interval" do
+ it "is not valid if below minium interval" do
proposal = create(:proposal)
notification1 = create(:proposal_notification, proposal: proposal)
@@ -60,7 +60,7 @@ describe ProposalNotification do
expect(notification2).to_not be_valid
end
- it "should be valid if notifications above minium interval" do
+ it "is valid if notifications above minium interval" do
proposal = create(:proposal)
notification1 = create(:proposal_notification, proposal: proposal, created_at: 4.days.ago)
@@ -70,7 +70,7 @@ describe ProposalNotification do
expect(notification2).to be_valid
end
- it "should be valid if no notifications sent" do
+ it "is valid if no notifications sent" do
notification1 = build(:proposal_notification)
expect(notification1).to be_valid
diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb
index 454e46389..dafa69ee0 100644
--- a/spec/models/proposal_spec.rb
+++ b/spec/models/proposal_spec.rb
@@ -10,96 +10,96 @@ describe Proposal do
it_behaves_like "map validations"
end
- it "should be valid" do
+ it "is valid" do
expect(proposal).to be_valid
end
- it "should not be valid without an author" do
+ it "is not valid without an author" do
proposal.author = nil
expect(proposal).to_not be_valid
end
- it "should not be valid without a summary" do
+ it "is not valid without a summary" do
proposal.summary = nil
expect(proposal).to_not be_valid
end
describe "#title" do
- it "should not be valid without a title" do
+ it "is not valid without a title" do
proposal.title = nil
expect(proposal).to_not be_valid
end
- it "should not be valid when very short" do
+ it "is not valid when very short" do
proposal.title = "abc"
expect(proposal).to_not be_valid
end
- it "should not be valid when very long" do
+ it "is not valid when very long" do
proposal.title = "a" * 81
expect(proposal).to_not be_valid
end
end
describe "#description" do
- it "should be sanitized" do
+ it "is sanitized" do
proposal.description = ""
proposal.valid?
expect(proposal.description).to eq("alert('danger');")
end
- it "should not be valid when very long" do
+ it "is not valid when very long" do
proposal.description = "a" * 6001
expect(proposal).to_not be_valid
end
end
describe "#question" do
- it "should not be valid without a question" do
+ it "is not valid without a question" do
proposal.question = nil
expect(proposal).to_not be_valid
end
- it "should not be valid when very short" do
+ it "is not valid when very short" do
proposal.question = "abc"
expect(proposal).to_not be_valid
end
- it "should not be valid when very long" do
+ it "is not valid when very long" do
proposal.question = "a" * 141
expect(proposal).to_not be_valid
end
end
describe "#video_url" do
- it "should not be valid when URL is not from Youtube or Vimeo" do
+ it "is not valid when URL is not from Youtube or Vimeo" do
proposal.video_url = "https://twitter.com"
expect(proposal).to_not be_valid
end
- it "should be valid when URL is from Youtube or Vimeo" do
+ it "is valid when URL is from Youtube or Vimeo" do
proposal.video_url = "https://vimeo.com/112681885"
expect(proposal).to be_valid
end
end
describe "#responsible_name" do
- it "should be mandatory" do
+ it "is mandatory" do
proposal.responsible_name = nil
expect(proposal).to_not be_valid
end
- it "should not be valid when very short" do
+ it "is not valid when very short" do
proposal.responsible_name = "abc"
expect(proposal).to_not be_valid
end
- it "should not be valid when very long" do
+ it "is not valid when very long" do
proposal.responsible_name = "a" * 61
expect(proposal).to_not be_valid
end
- it "should be the document_number if level two user" do
+ it "is the document_number if level two user" do
author = create(:user, :level_two, document_number: "12345678Z")
proposal.author = author
proposal.responsible_name = nil
@@ -108,7 +108,7 @@ describe Proposal do
proposal.responsible_name = "12345678Z"
end
- it "should be the document_number if level two user" do
+ it "is the document_number if level two user" do
author = create(:user, :level_three, document_number: "12345678Z")
proposal.author = author
proposal.responsible_name = nil
@@ -117,7 +117,7 @@ describe Proposal do
proposal.responsible_name = "12345678Z"
end
- it "should not be updated when the author is deleted" do
+ it "is not updated when the author is deleted" do
author = create(:user, :level_three, document_number: "12345678Z")
proposal.author = author
proposal.save
@@ -130,29 +130,29 @@ describe Proposal do
end
describe "tag_list" do
- it "should sanitize the tag list" do
+ it "sanitizes the tag list" do
proposal.tag_list = "user_id=1"
proposal.valid?
expect(proposal.tag_list).to eq(['user_id1'])
end
- it "should not be valid with a tag list of more than 6 elements" do
+ it "is not valid with a tag list of more than 6 elements" do
proposal.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa", "Huelgas"]
expect(proposal).to_not be_valid
end
- it "should be valid with a tag list of up to 6 elements" do
+ it "is valid with a tag list of up to 6 elements" do
proposal.tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
expect(proposal).to be_valid
end
end
- it "should not be valid without accepting terms of service" do
+ it "is not valid without accepting terms of service" do
proposal.terms_of_service = nil
expect(proposal).to_not be_valid
end
- it "should have a code" do
+ it "has a code" do
Setting["proposal_code_prefix"] = "TEST"
proposal = create(:proposal)
expect(proposal.code).to eq "TEST-#{proposal.created_at.strftime('%Y-%m')}-#{proposal.id}"
@@ -166,18 +166,18 @@ describe Proposal do
before(:each) {Setting["max_votes_for_proposal_edit"] = 5}
after(:each) {Setting["max_votes_for_proposal_edit"] = 1000}
- it "should be true if proposal has no votes yet" do
+ it "is true if proposal has no votes yet" do
expect(proposal.total_votes).to eq(0)
expect(proposal.editable?).to be true
end
- it "should be true if proposal has less than limit votes" do
+ it "is true if proposal has less than limit votes" do
create_list(:vote, 4, votable: proposal)
expect(proposal.total_votes).to eq(4)
expect(proposal.editable?).to be true
end
- it "should be false if proposal has more than limit votes" do
+ it "is false if proposal has more than limit votes" do
create_list(:vote, 6, votable: proposal)
expect(proposal.total_votes).to eq(6)
expect(proposal.editable?).to be false
@@ -187,17 +187,17 @@ describe Proposal do
describe "#votable_by?" do
let(:proposal) { create(:proposal) }
- it "should be true for level two verified users" do
+ it "is true for level two verified users" do
user = create(:user, residence_verified_at: Time.current, confirmed_phone: "666333111")
expect(proposal.votable_by?(user)).to be true
end
- it "should be true for level three verified users" do
+ it "is true for level three verified users" do
user = create(:user, verified_at: Time.current)
expect(proposal.votable_by?(user)).to be true
end
- it "should be false for anonymous users" do
+ it "is false for anonymous users" do
user = create(:user)
expect(proposal.votable_by?(user)).to be false
end
@@ -207,27 +207,27 @@ describe Proposal do
let(:proposal) { create(:proposal) }
describe "from level two verified users" do
- it "should register vote" do
+ it "registers vote" do
user = create(:user, residence_verified_at: Time.current, confirmed_phone: "666333111")
expect {proposal.register_vote(user, 'yes')}.to change{proposal.reload.votes_for.size}.by(1)
end
end
describe "from level three verified users" do
- it "should register vote" do
+ it "registers vote" do
user = create(:user, verified_at: Time.current)
expect {proposal.register_vote(user, 'yes')}.to change{proposal.reload.votes_for.size}.by(1)
end
end
describe "from anonymous users" do
- it "should not register vote" do
+ it "does not register vote" do
user = create(:user)
expect {proposal.register_vote(user, 'yes')}.to change{proposal.reload.votes_for.size}.by(0)
end
end
- it "should not register vote for archived proposals" do
+ it "does not register vote for archived proposals" do
user = create(:user, verified_at: Time.current)
archived_proposal = create(:proposal, :archived)
@@ -239,7 +239,7 @@ describe Proposal do
describe "with deprecated long tag list" do
- it "should increase number of cached_total_votes" do
+ it "increases number of cached_total_votes" do
proposal = create(:proposal)
tag_list = ["tag1", "tag2", "tag3", "tag4", "tag5", "tag6", "tag7"]
@@ -349,47 +349,47 @@ describe Proposal do
describe "cache" do
let(:proposal) { create(:proposal) }
- it "should expire cache when it has a new comment" do
+ it "expires cache when it has a new comment" do
expect { create(:comment, commentable: proposal) }
.to change { proposal.updated_at }
end
- it "should expire cache when it has a new vote" do
+ it "expires cache when it has a new vote" do
expect { create(:vote, votable: proposal) }
.to change { proposal.updated_at }
end
- it "should expire cache when it has a new flag" do
+ it "expires cache when it has a new flag" do
expect { create(:flag, flaggable: proposal) }
.to change { proposal.reload.updated_at }
end
- it "should expire cache when it has a new tag" do
+ it "expires cache when it has a new tag" do
expect { proposal.update(tag_list: "new tag") }
.to change { proposal.updated_at }
end
- it "should expire cache when hidden" do
+ it "expires cache when hidden" do
expect { proposal.hide }
.to change { proposal.updated_at }
end
- it "should expire cache when the author is hidden" do
+ it "expires cache when the author is hidden" do
expect { proposal.author.hide }
.to change { [proposal.reload.updated_at, proposal.author.updated_at] }
end
- it "should expire cache when the author is erased" do
+ it "expires cache when the author is erased" do
expect { proposal.author.erase }
.to change { [proposal.reload.updated_at, proposal.author.updated_at] }
end
- it "should expire cache when its author changes" do
+ it "expires cache when its author changes" do
expect { proposal.author.update(username: "Eva") }
.to change { [proposal.reload.updated_at, proposal.author.updated_at] }
end
- it "should expire cache when the author's organization get verified" do
+ it "expires cache when the author's organization get verified" do
create(:organization, user: proposal.author)
expect { proposal.author.organization.verify }
.to change { [proposal.reload.updated_at, proposal.author.updated_at] }
@@ -588,7 +588,7 @@ describe Proposal do
context "reorder" do
- it "should be able to reorder by hot_score after searching" do
+ it "is able to reorder by hot_score after searching" do
lowest_score = create(:proposal, title: 'stop corruption', cached_votes_up: 1)
highest_score = create(:proposal, title: 'stop corruption', cached_votes_up: 2)
average_score = create(:proposal, title: 'stop corruption', cached_votes_up: 3)
@@ -610,7 +610,7 @@ describe Proposal do
expect(results.third).to eq(lowest_score)
end
- it "should be able to reorder by confidence_score after searching" do
+ it "is able to reorder by confidence_score after searching" do
lowest_score = create(:proposal, title: 'stop corruption', cached_votes_up: 1)
highest_score = create(:proposal, title: 'stop corruption', cached_votes_up: 2)
average_score = create(:proposal, title: 'stop corruption', cached_votes_up: 3)
@@ -632,7 +632,7 @@ describe Proposal do
expect(results.third).to eq(lowest_score)
end
- it "should be able to reorder by created_at after searching" do
+ it "is able to reorder by created_at after searching" do
recent = create(:proposal, title: 'stop corruption', cached_votes_up: 1, created_at: 1.week.ago)
newest = create(:proposal, title: 'stop corruption', cached_votes_up: 2, created_at: Time.current)
oldest = create(:proposal, title: 'stop corruption', cached_votes_up: 3, created_at: 1.month.ago)
@@ -650,7 +650,7 @@ describe Proposal do
expect(results.third).to eq(oldest)
end
- it "should be able to reorder by most commented after searching" do
+ it "is able to reorder by most commented after searching" do
least_commented = create(:proposal, title: 'stop corruption', cached_votes_up: 1, comments_count: 1)
most_commented = create(:proposal, title: 'stop corruption', cached_votes_up: 2, comments_count: 100)
some_comments = create(:proposal, title: 'stop corruption', cached_votes_up: 3, comments_count: 10)
@@ -704,12 +704,12 @@ describe Proposal do
end
describe "#last_week" do
- it "should return proposals created this week" do
+ it "returns proposals created this week" do
proposal = create(:proposal)
expect(described_class.last_week).to include(proposal)
end
- it "should not return proposals created more than a week ago" do
+ it "does not return proposals created more than a week ago" do
proposal = create(:proposal, created_at: 8.days.ago)
expect(described_class.last_week).to_not include(proposal)
end
@@ -719,14 +719,14 @@ describe Proposal do
context "categories" do
- it "should return proposals tagged with a category" do
+ it "returns proposals tagged with a category" do
create(:tag, :category, name: 'culture')
proposal = create(:proposal, tag_list: 'culture')
expect(described_class.for_summary.values.flatten).to include(proposal)
end
- it "should not return proposals tagged without a category" do
+ it "does not return proposals tagged without a category" do
create(:tag, :category, name: 'culture')
proposal = create(:proposal, tag_list: 'parks')
@@ -736,14 +736,14 @@ describe Proposal do
context "districts" do
- it "should return proposals with a geozone" do
+ it "returns proposals with a geozone" do
california = create(:geozone, name: 'california')
proposal = create(:proposal, geozone: california)
expect(described_class.for_summary.values.flatten).to include(proposal)
end
- it "should not return proposals without a geozone" do
+ it "does not return proposals without a geozone" do
create(:geozone, name: 'california')
proposal = create(:proposal)
@@ -751,19 +751,19 @@ describe Proposal do
end
end
- it "should return proposals created this week" do
+ it "returns proposals created this week" do
create(:tag, :category, name: 'culture')
proposal = create(:proposal, tag_list: 'culture')
expect(described_class.for_summary.values.flatten).to include(proposal)
end
- it "should not return proposals created more than a week ago" do
+ it "does not return proposals created more than a week ago" do
create(:tag, :category, name: 'culture')
proposal = create(:proposal, tag_list: 'culture', created_at: 8.days.ago)
expect(described_class.for_summary.values.flatten).to_not include(proposal)
end
- it "should order proposals by votes" do
+ it "orders proposals by votes" do
create(:tag, :category, name: 'culture')
create(:proposal, tag_list: 'culture').update_column(:confidence_score, 2)
create(:proposal, tag_list: 'culture').update_column(:confidence_score, 10)
@@ -776,7 +776,7 @@ describe Proposal do
expect(results.third.confidence_score).to be(2)
end
- it "should order groups alphabetically" do
+ it "orders groups alphabetically" do
create(:tag, :category, name: 'health')
create(:tag, :category, name: 'culture')
create(:tag, :category, name: 'social services')
@@ -792,7 +792,7 @@ describe Proposal do
expect(results.third).to eq(social_proposal)
end
- it "should return proposals grouped by tag" do
+ it "returns proposals grouped by tag" do
create(:tag, :category, name: 'culture')
create(:tag, :category, name: 'health')
@@ -809,7 +809,7 @@ describe Proposal do
end
describe "#to_param" do
- it "should return a friendly url" do
+ it "returns a friendly url" do
expect(proposal.to_param).to eq "#{proposal.id} #{proposal.title}".parameterize
end
end
@@ -876,7 +876,7 @@ describe Proposal do
describe "#user_to_notify" do
- it "should return voters and followers" do
+ it "returns voters and followers" do
proposal = create(:proposal)
voter = create(:user, :level_two)
follower = create(:user, :level_two)
@@ -886,7 +886,7 @@ describe Proposal do
expect(proposal.users_to_notify).to eq([voter, follower])
end
- it "should return voters and followers discarding duplicates" do
+ it "returns voters and followers discarding duplicates" do
proposal = create(:proposal)
voter_and_follower = create(:user, :level_two)
follow = create(:follow, user: voter_and_follower, followable: proposal)
@@ -901,13 +901,13 @@ describe Proposal do
let(:user) { create(:user) }
- it "Should not return any proposals when user has not interests" do
+ it "does not return any proposals when user has not interests" do
create(:proposal)
expect(described_class.recommendations(user).size).to eq 0
end
- it "Should return proposals ordered by cached_votes_up" do
+ it "returns proposals ordered by cached_votes_up" do
proposal1 = create(:proposal, cached_votes_up: 1, tag_list: "Sport")
proposal2 = create(:proposal, cached_votes_up: 5, tag_list: "Sport")
proposal3 = create(:proposal, cached_votes_up: 10, tag_list: "Sport")
@@ -921,7 +921,7 @@ describe Proposal do
expect(result.third).to eq proposal1
end
- it "Should return proposals related with user interests" do
+ it "returns proposals related with user interests" do
proposal1 = create(:proposal, tag_list: "Sport")
proposal2 = create(:proposal, tag_list: "Sport")
proposal3 = create(:proposal, tag_list: "Politics")
@@ -933,7 +933,7 @@ describe Proposal do
expect(result).to eq [proposal2]
end
- it "Should not return proposals when user is follower" do
+ it "does not return proposals when user is follower" do
proposal1 = create(:proposal, tag_list: "Sport")
create(:follow, followable: proposal1, user: user)
@@ -942,7 +942,7 @@ describe Proposal do
expect(result.size).to eq 0
end
- it "Should not return proposals when user is the author" do
+ it "does not return proposals when user is the author" do
proposal1 = create(:proposal, author: user, tag_list: "Sport")
proposal2 = create(:proposal, tag_list: "Sport")
proposal3 = create(:proposal, tag_list: "Sport")
@@ -954,7 +954,7 @@ describe Proposal do
expect(result).to eq [proposal2]
end
- it "should not return archived proposals" do
+ it "does not return archived proposals" do
proposal1 = create(:proposal, cached_votes_up: 5, tag_list: "Sport")
proposal2 = create(:proposal, cached_votes_up: 5, tag_list: "Sport")
archived_proposal = create(:proposal, :archived)
@@ -965,7 +965,7 @@ describe Proposal do
expect(result).to eq([proposal2])
end
- it "should not return already supported proposals" do
+ it "does not return already supported proposals" do
proposal1 = create(:proposal, cached_votes_up: 5, tag_list: "Health")
proposal2 = create(:proposal, cached_votes_up: 5, tag_list: "Health")
proposal3 = create(:proposal, cached_votes_up: 5, tag_list: "Health")
diff --git a/spec/models/relation_spec.rb b/spec/models/relation_spec.rb
index 5817638ba..0c00ae251 100644
--- a/spec/models/relation_spec.rb
+++ b/spec/models/relation_spec.rb
@@ -5,19 +5,19 @@ describe RelatedContent do
let(:parent_relationable) { create([:proposal, :debate].sample) }
let(:child_relationable) { create([:proposal, :debate].sample) }
- it "should allow relationables from various classes" do
+ it "allows relationables from various classes" do
expect(build(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable)).to be_valid
expect(build(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable)).to be_valid
expect(build(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable)).to be_valid
end
- it "should not allow empty relationables" do
+ it "does not allow empty relationables" do
expect(build(:related_content)).not_to be_valid
expect(build(:related_content, parent_relationable: parent_relationable)).not_to be_valid
expect(build(:related_content, child_relationable: child_relationable)).not_to be_valid
end
- it "should not allow repeated related contents" do
+ it "does not allow repeated related contents" do
related_content = create(:related_content, parent_relationable: parent_relationable, child_relationable: child_relationable, author: build(:user))
new_related_content = build(:related_content, parent_relationable: related_content.parent_relationable, child_relationable: related_content.child_relationable)
expect(new_related_content).not_to be_valid
diff --git a/spec/models/residence_spec.rb b/spec/models/residence_spec.rb
index 9634713f6..13b57b463 100644
--- a/spec/models/residence_spec.rb
+++ b/spec/models/residence_spec.rb
@@ -7,24 +7,24 @@ describe Verification::Residence do
describe "validations" do
- it "should be valid" do
+ it "is valid" do
expect(residence).to be_valid
end
describe "dates" do
- it "should be valid with a valid date of birth" do
+ it "is valid with a valid date of birth" do
residence = described_class.new("date_of_birth(3i)" => "1", "date_of_birth(2i)" => "1", "date_of_birth(1i)" => "1980")
expect(residence.errors[:date_of_birth].size).to eq(0)
end
- it "should not be valid without a date of birth" do
+ it "is not valid without a date of birth" do
residence = described_class.new("date_of_birth(3i)" => "", "date_of_birth(2i)" => "", "date_of_birth(1i)" => "")
expect(residence).to_not be_valid
expect(residence.errors[:date_of_birth]).to include("can't be blank")
end
end
- it "should validate user has allowed age" do
+ it "validates user has allowed age" do
residence = described_class.new("date_of_birth(3i)" => "1",
"date_of_birth(2i)" => "1",
"date_of_birth(1i)" => 5.years.ago.year.to_s)
@@ -32,7 +32,7 @@ describe Verification::Residence do
expect(residence.errors[:date_of_birth]).to include("You don't have the required age to participate")
end
- it "should validate uniquness of document_number" do
+ it "validates uniquness of document_number" do
user = create(:user)
residence.user = user
residence.save
@@ -43,7 +43,7 @@ describe Verification::Residence do
expect(residence.errors[:document_number]).to include("has already been taken")
end
- it "should validate census terms" do
+ it "validates census terms" do
residence.terms_of_service = nil
expect(residence).to_not be_valid
end
@@ -51,12 +51,12 @@ describe Verification::Residence do
end
describe "new" do
- it "should upcase document number" do
+ it "upcases document number" do
residence = described_class.new(document_number: "x1234567z")
expect(residence.document_number).to eq("X1234567Z")
end
- it "should remove all characters except numbers and letters" do
+ it "removes all characters except numbers and letters" do
residence = described_class.new(document_number: " 12.345.678 - B")
expect(residence.document_number).to eq("12345678B")
end
@@ -64,7 +64,7 @@ describe Verification::Residence do
describe "save" do
- it "should store document number, document type, geozone, date of birth and gender" do
+ it "stores document number, document type, geozone, date of birth and gender" do
user = create(:user)
residence.user = user
residence.save
@@ -82,13 +82,13 @@ describe Verification::Residence do
end
describe "tries" do
- it "should increase tries after a call to the Census" do
+ it "increases tries after a call to the Census" do
residence.postal_code = "28011"
residence.valid?
expect(residence.user.lock.tries).to eq(1)
end
- it "should not increase tries after a validation error" do
+ it "does not increase tries after a validation error" do
residence.postal_code = ""
residence.valid?
expect(residence.user.lock).to be nil
diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb
index d45331aad..d65ab038a 100644
--- a/spec/models/setting_spec.rb
+++ b/spec/models/setting_spec.rb
@@ -5,32 +5,32 @@ describe Setting do
described_class["official_level_1_name"] = 'Stormtrooper'
end
- it "should return the overriden setting" do
+ it "returns the overriden setting" do
expect(described_class['official_level_1_name']).to eq('Stormtrooper')
end
- it "should should return nil" do
+ it "shoulds return nil" do
expect(described_class['undefined_key']).to eq(nil)
end
- it "should persist a setting on the db" do
+ it "persists a setting on the db" do
expect(described_class.where(key: 'official_level_1_name', value: 'Stormtrooper')).to exist
end
describe "#feature_flag?" do
- it "should be true if key starts with 'feature.'" do
+ it "is true if key starts with 'feature.'" do
setting = described_class.create(key: 'feature.whatever')
expect(setting.feature_flag?).to eq true
end
- it "should be false if key does not start with 'feature.'" do
+ it "is false if key does not start with 'feature.'" do
setting = described_class.create(key: 'whatever')
expect(setting.feature_flag?).to eq false
end
end
describe "#enabled?" do
- it "should be true if feature_flag and value present" do
+ it "is true if feature_flag and value present" do
setting = described_class.create(key: 'feature.whatever', value: 1)
expect(setting.enabled?).to eq true
@@ -41,7 +41,7 @@ describe Setting do
expect(setting.enabled?).to eq true
end
- it "should be false if feature_flag and value blank" do
+ it "is false if feature_flag and value blank" do
setting = described_class.create(key: 'feature.whatever')
expect(setting.enabled?).to eq false
@@ -49,31 +49,31 @@ describe Setting do
expect(setting.enabled?).to eq false
end
- it "should be false if not feature_flag" do
+ it "is false if not feature_flag" do
setting = described_class.create(key: 'whatever', value: "whatever")
expect(setting.enabled?).to eq false
end
end
describe "#banner_style?" do
- it "should be true if key starts with 'banner-style.'" do
+ it "is true if key starts with 'banner-style.'" do
setting = described_class.create(key: 'banner-style.whatever')
expect(setting.banner_style?).to eq true
end
- it "should be false if key does not start with 'banner-style.'" do
+ it "is false if key does not start with 'banner-style.'" do
setting = described_class.create(key: 'whatever')
expect(setting.banner_style?).to eq false
end
end
describe "#banner_img?" do
- it "should be true if key starts with 'banner-img.'" do
+ it "is true if key starts with 'banner-img.'" do
setting = described_class.create(key: 'banner-img.whatever')
expect(setting.banner_img?).to eq true
end
- it "should be false if key does not start with 'banner-img.'" do
+ it "is false if key does not start with 'banner-img.'" do
setting = described_class.create(key: 'whatever')
expect(setting.banner_img?).to eq false
end
diff --git a/spec/models/signature_sheet_spec.rb b/spec/models/signature_sheet_spec.rb
index aeed78996..29eb790c6 100644
--- a/spec/models/signature_sheet_spec.rb
+++ b/spec/models/signature_sheet_spec.rb
@@ -6,11 +6,11 @@ describe SignatureSheet do
describe "validations" do
- it "should be valid" do
+ it "is valid" do
expect(signature_sheet).to be_valid
end
- it "should be valid with a valid signable" do
+ it "is valid with a valid signable" do
signature_sheet.signable = create(:proposal)
expect(signature_sheet).to be_valid
@@ -18,22 +18,22 @@ describe SignatureSheet do
expect(signature_sheet).to be_valid
end
- it "should not be valid without signable" do
+ it "is not valid without signable" do
signature_sheet.signable = nil
expect(signature_sheet).to_not be_valid
end
- it "should not be valid without a valid signable" do
+ it "is not valid without a valid signable" do
signature_sheet.signable = create(:comment)
expect(signature_sheet).to_not be_valid
end
- it "should not be valid without document numbers" do
+ it "is not valid without document numbers" do
signature_sheet.document_numbers = nil
expect(signature_sheet).to_not be_valid
end
- it "should not be valid without an author" do
+ it "is not valid without an author" do
signature_sheet.author = nil
expect(signature_sheet).to_not be_valid
end
diff --git a/spec/models/signature_spec.rb b/spec/models/signature_spec.rb
index 207208bbf..dfb7dd5bf 100644
--- a/spec/models/signature_spec.rb
+++ b/spec/models/signature_spec.rb
@@ -6,11 +6,11 @@ describe Signature do
describe "validations" do
- it "should be valid" do
+ it "is valid" do
expect(signature).to be_valid
end
- it "should not be valid without a document number" do
+ it "is not valid without a document number" do
signature.document_number = nil
expect(signature).to_not be_valid
@@ -21,7 +21,7 @@ describe Signature do
expect(signature).to_not be_valid
end
- it "should not be valid without an associated signature sheet" do
+ it "is not valid without an associated signature sheet" do
signature.signature_sheet = nil
expect(signature).to_not be_valid
end
diff --git a/spec/models/site_customization/content_block_spec.rb b/spec/models/site_customization/content_block_spec.rb
index 2eb6279f6..dd536425d 100644
--- a/spec/models/site_customization/content_block_spec.rb
+++ b/spec/models/site_customization/content_block_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
RSpec.describe SiteCustomization::ContentBlock, type: :model do
let(:block) { build(:site_customization_content_block) }
- it "should be valid" do
+ it "is valid" do
expect(block).to be_valid
end
diff --git a/spec/models/site_customization/page_spec.rb b/spec/models/site_customization/page_spec.rb
index 2868f62d1..f9ac9b360 100644
--- a/spec/models/site_customization/page_spec.rb
+++ b/spec/models/site_customization/page_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
RSpec.describe SiteCustomization::Page, type: :model do
let(:custom_page) { build(:site_customization_page) }
- it "should be valid" do
+ it "is valid" do
expect(custom_page).to be_valid
end
diff --git a/spec/models/sms_spec.rb b/spec/models/sms_spec.rb
index 0174dfead..9c851a2e8 100644
--- a/spec/models/sms_spec.rb
+++ b/spec/models/sms_spec.rb
@@ -1,12 +1,12 @@
require 'rails_helper'
describe Verification::Sms do
- it "should be valid" do
+ it "is valid" do
sms = build(:verification_sms)
expect(sms).to be_valid
end
- it "should validate uniqness of phone" do
+ it "validates uniqness of phone" do
create(:user, confirmed_phone: "699999999")
sms = described_class.new(phone: "699999999")
expect(sms).to_not be_valid
diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb
index bbe21d920..8e2291e5a 100644
--- a/spec/models/topic_spec.rb
+++ b/spec/models/topic_spec.rb
@@ -7,21 +7,21 @@ describe Topic do
it_behaves_like "notifiable"
end
- it "should be valid" do
+ it "is valid" do
expect(topic).to be_valid
end
- it "should not be valid without an author" do
+ it "is not valid without an author" do
topic.author = nil
expect(topic).to_not be_valid
end
- it "should not be valid without a title" do
+ it "is not valid without a title" do
topic.title = nil
expect(topic).to_not be_valid
end
- it "should not be valid without a description" do
+ it "is not valid without a description" do
topic.description = nil
expect(topic).to_not be_valid
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 828509c44..9b4962572 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -74,37 +74,37 @@ describe User do
describe 'preferences' do
describe 'email_on_comment' do
- it 'should be false by default' do
+ it 'is false by default' do
expect(subject.email_on_comment).to eq(false)
end
end
describe 'email_on_comment_reply' do
- it 'should be false by default' do
+ it 'is false by default' do
expect(subject.email_on_comment_reply).to eq(false)
end
end
describe 'subscription_to_website_newsletter' do
- it 'should be true by default' do
+ it 'is true by default' do
expect(subject.newsletter).to eq(true)
end
end
describe 'email_digest' do
- it 'should be true by default' do
+ it 'is true by default' do
expect(subject.email_digest).to eq(true)
end
end
describe 'email_on_direct_message' do
- it 'should be true by default' do
+ it 'is true by default' do
expect(subject.email_on_direct_message).to eq(true)
end
end
describe 'official_position_badge' do
- it 'should be false by default' do
+ it 'is false by default' do
expect(subject.official_position_badge).to eq(false)
end
end
@@ -415,17 +415,17 @@ describe User do
describe "cache" do
let(:user) { create(:user) }
- it "should expire cache with becoming a moderator" do
+ it "expires cache with becoming a moderator" do
expect { create(:moderator, user: user) }
.to change { user.updated_at}
end
- it "should expire cache with becoming an admin" do
+ it "expires cache with becoming an admin" do
expect { create(:administrator, user: user) }
.to change { user.updated_at}
end
- it "should expire cache with becoming a veridied organization" do
+ it "expires cache with becoming a veridied organization" do
create(:organization, user: user)
expect { user.organization.verify }
.to change { user.reload.updated_at}
@@ -433,13 +433,13 @@ describe User do
end
describe "document_number" do
- it "should upcase document number" do
+ it "upcases document number" do
user = described_class.new(document_number: "x1234567z")
user.valid?
expect(user.document_number).to eq("X1234567Z")
end
- it "should remove all characters except numbers and letters" do
+ it "removes all characters except numbers and letters" do
user = described_class.new(document_number: " 12.345.678 - B")
user.valid?
expect(user.document_number).to eq("12345678B")
@@ -660,14 +660,14 @@ describe User do
describe "#interests" do
let(:user) { create(:user) }
- it "should return followed object tags" do
+ it "returns followed object tags" do
proposal = create(:proposal, tag_list: "Sport")
create(:follow, followable: proposal, user: user)
expect(user.interests).to eq ["Sport"]
end
- it "should discard followed objects duplicated tags" do
+ it "discards followed objects duplicated tags" do
proposal1 = create(:proposal, tag_list: "Sport")
proposal2 = create(:proposal, tag_list: "Sport")
budget_investment = create(:budget_investment, tag_list: "Sport")
diff --git a/spec/models/valuator_spec.rb b/spec/models/valuator_spec.rb
index 326eda7dc..c905bd376 100644
--- a/spec/models/valuator_spec.rb
+++ b/spec/models/valuator_spec.rb
@@ -3,13 +3,13 @@ require 'rails_helper'
describe Valuator do
describe "#description_or_email" do
- it "should return description if present" do
+ it "returns description if present" do
valuator = create(:valuator, description: "Urbanism manager")
expect(valuator.description_or_email).to eq("Urbanism manager")
end
- it "should return email if not description present" do
+ it "returns email if not description present" do
valuator = create(:valuator)
expect(valuator.description_or_email).to eq(valuator.email)
diff --git a/spec/shared/models/acts_as_imageable.rb b/spec/shared/models/acts_as_imageable.rb
index e4f5f221d..710ea5b4a 100644
--- a/spec/shared/models/acts_as_imageable.rb
+++ b/spec/shared/models/acts_as_imageable.rb
@@ -3,27 +3,27 @@ shared_examples "acts as imageable" do |imageable_factory|
let!(:image) { build(:image, imageable_factory.to_sym) }
let!(:imageable) { image.imageable }
- it "should be valid" do
+ it "is valid" do
expect(image).to be_valid
end
describe "file extension" do
- it "should not be valid with '.png' extension" do
+ it "is not valid with '.png' extension" do
image.attachment = File.new("spec/fixtures/files/clippy.png")
expect(image).to_not be_valid
expect(image.errors[:attachment].size).to eq(1)
end
- it "should not be valid with '.gif' extension" do
+ it "is not valid with '.gif' extension" do
image.attachment = File.new("spec/fixtures/files/clippy.gif")
expect(image).to_not be_valid
expect(image.errors[:attachment].size).to eq(1)
end
- it "should be valid with '.jpg' extension" do
+ it "is valid with '.jpg' extension" do
image.attachment = File.new("spec/fixtures/files/clippy.jpg")
expect(image).to be_valid
@@ -33,11 +33,11 @@ shared_examples "acts as imageable" do |imageable_factory|
describe "image dimmessions" do
- it "should be valid when image dimmessions are 475X475 at least" do
+ it "is valid when image dimmessions are 475X475 at least" do
expect(image).to be_valid
end
- it "should not be valid when image dimmensions are smaller than 475X475" do
+ it "is not valid when image dimmensions are smaller than 475X475" do
image.attachment = File.new("spec/fixtures/files/logo_header.jpg")
expect(image).not_to be_valid
@@ -46,19 +46,19 @@ shared_examples "acts as imageable" do |imageable_factory|
describe "title" do
- it "should not be valid when correct image attached but no image title provided" do
+ it "is not valid when correct image attached but no image title provided" do
image.title = ''
expect(image).to_not be_valid
end
- it "should not be valid when image title is too short" do
+ it "is not valid when image title is too short" do
image.title = 'a' * 3
expect(image).to_not be_valid
end
- it "should not be valid when image title is too long" do
+ it "is not valid when image title is too long" do
image.title = 'a' * 81
expect(image).to_not be_valid
diff --git a/spec/shared/models/document_validations.rb b/spec/shared/models/document_validations.rb
index 5d04c77ab..43b65f97a 100644
--- a/spec/shared/models/document_validations.rb
+++ b/spec/shared/models/document_validations.rb
@@ -7,23 +7,23 @@ shared_examples "document validations" do |documentable_factory|
let!(:maxfilesize) { max_file_size(document.documentable.class) }
let!(:acceptedcontenttypes) { accepted_content_types(document.documentable.class) }
- it "should be valid" do
+ it "is valid" do
expect(document).to be_valid
end
- it "should not be valid without a title" do
+ it "is not valid without a title" do
document.title = nil
expect(document).to_not be_valid
end
- it "should not be valid without an attachment" do
+ it "is not valid without an attachment" do
document.attachment = nil
expect(document).to_not be_valid
end
- it "should be valid for all accepted content types" do
+ it "is valid for all accepted content types" do
acceptedcontenttypes.each do |content_type|
extension = content_type.split("/").last
document.attachment = File.new("spec/fixtures/files/empty.#{extension}")
@@ -32,27 +32,27 @@ shared_examples "document validations" do |documentable_factory|
end
end
- it "should not be valid for attachments larger than documentable max_file_size definition" do
+ it "is not valid for attachments larger than documentable max_file_size definition" do
document.stub(:attachment_file_size).and_return(maxfilesize.megabytes + 1.byte)
expect(document).to_not be_valid
expect(document.errors[:attachment]).to include "must be in between 0 Bytes and #{maxfilesize} MB"
end
- it "should not be valid without a user_id" do
+ it "is not valid without a user_id" do
document.user_id = nil
expect(document).to_not be_valid
end
- it "should not be valid without a documentable_id" do
+ it "is not valid without a documentable_id" do
document.save
document.documentable_id = nil
expect(document).to_not be_valid
end
- it "should not be valid without a documentable_type" do
+ it "is not valid without a documentable_type" do
document.save
document.documentable_type = nil
diff --git a/spec/shared/models/image_validations.rb b/spec/shared/models/image_validations.rb
index f3ad0091e..0d974d45f 100644
--- a/spec/shared/models/image_validations.rb
+++ b/spec/shared/models/image_validations.rb
@@ -6,23 +6,23 @@ shared_examples "image validations" do |imageable_factory|
let!(:imageable) { image.imageable }
let!(:acceptedcontenttypes) { imageable_accepted_content_types }
- it "should be valid" do
+ it "is valid" do
expect(image).to be_valid
end
- it "should not be valid without a title" do
+ it "is not valid without a title" do
image.title = nil
expect(image).to_not be_valid
end
- it "should not be valid without an attachment" do
+ it "is not valid without an attachment" do
image.attachment = nil
expect(image).to_not be_valid
end
- it "should be valid for all accepted content types" do
+ it "is valid for all accepted content types" do
acceptedcontenttypes.each do |content_type|
extension = content_type.split("/").last
image.attachment = File.new("spec/fixtures/files/clippy.#{extension}")
@@ -31,7 +31,7 @@ shared_examples "image validations" do |imageable_factory|
end
end
- it "should not be valid for png and gif image content types" do
+ it "is not valid for png and gif image content types" do
["gif", "png"].each do |content_type|
extension = content_type.split("/").last
image.attachment = File.new("spec/fixtures/files/clippy.#{extension}")
@@ -40,27 +40,27 @@ shared_examples "image validations" do |imageable_factory|
end
end
- it "should not be valid for attachments larger than imageable max_file_size definition" do
+ it "is not valid for attachments larger than imageable max_file_size definition" do
allow(image).to receive(:attachment_file_size).and_return(Image::MAX_IMAGE_SIZE + 1.byte)
expect(image).to_not be_valid
expect(image.errors[:attachment]).to include "must be in between 0 Bytes and 1 MB"
end
- it "should not be valid without a user_id" do
+ it "is not valid without a user_id" do
image.user_id = nil
expect(image).to_not be_valid
end
- it "should not be valid without a imageable_id" do
+ it "is not valid without a imageable_id" do
image.save
image.imageable_id = nil
expect(image).to_not be_valid
end
- it "should not be valid without a imageable_type" do
+ it "is not valid without a imageable_type" do
image.save
image.imageable_type = nil
diff --git a/spec/shared/models/map_validations.rb b/spec/shared/models/map_validations.rb
index d53eafc7b..f99cd0c52 100644
--- a/spec/shared/models/map_validations.rb
+++ b/spec/shared/models/map_validations.rb
@@ -12,21 +12,21 @@ shared_examples "map validations" do
Setting["feature.map"] = nil
end
- it "should be valid with a map location" do
+ it "is valid with a map location" do
mappable.map_location = build(:map_location)
mappable.skip_map = nil
expect(mappable).to be_valid
end
- it "should be valid accepting that the mappable has no map" do
+ it "is valid accepting that the mappable has no map" do
mappable.skip_map = "1"
mappable.map_location = nil
expect(mappable).to be_valid
end
- it "should be valid when the feature map is deactivated" do
+ it "is valid when the feature map is deactivated" do
Setting["feature.map"] = nil
mappable.map_location = nil
@@ -35,14 +35,14 @@ shared_examples "map validations" do
expect(mappable).to be_valid
end
- it "should not be valid without a map location" do
+ it "is not valid without a map location" do
mappable.map_location = nil
mappable.skip_map = nil
expect(mappable).to_not be_valid
end
- it "should not be valid without accepting that the mappable has no map" do
+ it "is not valid without accepting that the mappable has no map" do
mappable.skip_map = nil
expect(mappable).to_not be_valid
@@ -52,7 +52,7 @@ shared_examples "map validations" do
describe "cache" do
- it "should expire cache when the map is updated" do
+ it "expires cache when the map is updated" do
map_location = create(:map_location)
mappable.map_location = map_location
mappable.save