Upgrade rspec to 3.4.0.
This commit is contained in:
parent
e11c83341c
commit
cb5be1fe8f
2
Gemfile
2
Gemfile
|
@ -125,7 +125,7 @@ group :test do
|
|||
end
|
||||
|
||||
group :test, :development do
|
||||
gem 'rspec', '~> 3.2.0'
|
||||
gem 'rspec'
|
||||
gem 'mock_redis'
|
||||
gem 'listen', '0.7.3', require: false
|
||||
gem 'certified', require: false
|
||||
|
|
34
Gemfile.lock
34
Gemfile.lock
|
@ -294,33 +294,33 @@ GEM
|
|||
netrc (~> 0.7)
|
||||
rinku (2.0.0)
|
||||
rmmseg-cpp (0.2.9)
|
||||
rspec (3.2.0)
|
||||
rspec-core (~> 3.2.0)
|
||||
rspec-expectations (~> 3.2.0)
|
||||
rspec-mocks (~> 3.2.0)
|
||||
rspec-core (3.2.3)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-expectations (3.2.1)
|
||||
rspec (3.4.0)
|
||||
rspec-core (~> 3.4.0)
|
||||
rspec-expectations (~> 3.4.0)
|
||||
rspec-mocks (~> 3.4.0)
|
||||
rspec-core (3.4.4)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-expectations (3.4.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-given (3.7.1)
|
||||
given_core (= 3.7.1)
|
||||
rspec (>= 2.14.0)
|
||||
rspec-html-matchers (0.7.0)
|
||||
nokogiri (~> 1)
|
||||
rspec (~> 3)
|
||||
rspec-mocks (3.2.1)
|
||||
rspec-mocks (3.4.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-rails (3.2.3)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-rails (3.4.2)
|
||||
actionpack (>= 3.0, < 4.3)
|
||||
activesupport (>= 3.0, < 4.3)
|
||||
railties (>= 3.0, < 4.3)
|
||||
rspec-core (~> 3.2.0)
|
||||
rspec-expectations (~> 3.2.0)
|
||||
rspec-mocks (~> 3.2.0)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-support (3.2.2)
|
||||
rspec-core (~> 3.4.0)
|
||||
rspec-expectations (~> 3.4.0)
|
||||
rspec-mocks (~> 3.4.0)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-support (3.4.1)
|
||||
rtlit (0.0.5)
|
||||
ruby-openid (2.7.0)
|
||||
ruby-readability (0.7.0)
|
||||
|
@ -475,7 +475,7 @@ DEPENDENCIES
|
|||
rest-client
|
||||
rinku
|
||||
rmmseg-cpp
|
||||
rspec (~> 3.2.0)
|
||||
rspec
|
||||
rspec-given
|
||||
rspec-html-matchers
|
||||
rspec-rails
|
||||
|
|
|
@ -613,7 +613,10 @@ class User < ActiveRecord::Base
|
|||
# Use this helper to determine if the user has a particular trust level.
|
||||
# Takes into account admin, etc.
|
||||
def has_trust_level?(level)
|
||||
raise "Invalid trust level #{level}" unless TrustLevel.valid?(level)
|
||||
unless TrustLevel.valid?(level)
|
||||
raise InvalidTrustLevel.new("Invalid trust level #{level}")
|
||||
end
|
||||
|
||||
admin? || moderator? || staged? || TrustLevel.compare(trust_level, level)
|
||||
end
|
||||
|
||||
|
@ -907,7 +910,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def hash_password(password, salt)
|
||||
raise "password is too long" if password.size > User.max_password_length
|
||||
raise StandardError.new("password is too long") if password.size > User.max_password_length
|
||||
Pbkdf2.hash_password(password, salt, Rails.configuration.pbkdf2_iterations, Rails.configuration.pbkdf2_algorithm)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Plugin
|
|||
end
|
||||
|
||||
def register(name, &blk)
|
||||
raise ArgumentException unless blk && blk.arity == 2
|
||||
raise ArgumentError unless blk && blk.arity == 2
|
||||
filters = @map[name] ||= []
|
||||
filters << blk
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ describe Plugin::FilterManager do
|
|||
expect do
|
||||
instance.register(:test) do
|
||||
end
|
||||
end.to raise_exception
|
||||
end.to raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
it "should return the original if no filters exist" do
|
||||
|
@ -30,6 +30,6 @@ describe Plugin::FilterManager do
|
|||
it "should raise an exception if no block is passed in" do
|
||||
expect do
|
||||
instance.register(:test)
|
||||
end.to raise_exception
|
||||
end.to raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -416,7 +416,7 @@ describe TopicQuery do
|
|||
TopicList.preloaded_custom_fields.clear
|
||||
|
||||
# if we attempt to access non preloaded fields explode
|
||||
expect{new_topic.custom_fields["boom"]}.to raise_error
|
||||
expect{new_topic.custom_fields["boom"]}.to raise_error(StandardError)
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe DirectoryItemsController do
|
||||
|
||||
it "requires a `period` param" do
|
||||
expect{ xhr :get, :index }.to raise_error
|
||||
expect{ xhr :get, :index }.to raise_error(ActionController::ParameterMissing)
|
||||
end
|
||||
|
||||
it "requires a proper `period` param" do
|
||||
|
|
|
@ -7,13 +7,13 @@ describe Users::OmniauthCallbacksController do
|
|||
SiteSetting.stubs("enable_twitter_logins?").returns(false)
|
||||
expect(lambda {
|
||||
Users::OmniauthCallbacksController.find_authenticator("twitter")
|
||||
}).to raise_error
|
||||
}).to raise_error(Discourse::InvalidAccess)
|
||||
end
|
||||
|
||||
it "fails for unknown" do
|
||||
expect(lambda {
|
||||
Users::OmniauthCallbacksController.find_authenticator("twitter1")
|
||||
}).to raise_error
|
||||
}).to raise_error(Discourse::InvalidAccess)
|
||||
end
|
||||
|
||||
it "finds an authenticator when enabled" do
|
||||
|
|
|
@ -5,7 +5,7 @@ describe UserActionsController do
|
|||
context 'index' do
|
||||
|
||||
it 'fails if username is not specified' do
|
||||
expect { xhr :get, :index }.to raise_error
|
||||
expect { xhr :get, :index }.to raise_error(ActionController::ParameterMissing)
|
||||
end
|
||||
|
||||
it 'renders list correctly' do
|
||||
|
|
|
@ -24,7 +24,7 @@ describe UserBadgesController do
|
|||
let!(:user_badge) { UserBadge.create(badge: badge, user: user, granted_by: Discourse.system_user, granted_at: Time.now) }
|
||||
|
||||
it 'requires username or badge_id to be specified' do
|
||||
expect { xhr :get, :index }.to raise_error
|
||||
expect { xhr :get, :index }.to raise_error(ActionController::ParameterMissing)
|
||||
end
|
||||
|
||||
it 'returns user_badges for a user' do
|
||||
|
@ -54,7 +54,7 @@ describe UserBadgesController do
|
|||
|
||||
context 'create' do
|
||||
it 'requires username to be specified' do
|
||||
expect { xhr :post, :create, badge_id: badge.id }.to raise_error
|
||||
expect { xhr :post, :create, badge_id: badge.id }.to raise_error(ActionController::ParameterMissing)
|
||||
end
|
||||
|
||||
it 'does not allow regular users to grant badges' do
|
||||
|
|
|
@ -32,7 +32,7 @@ describe Jobs::Base do
|
|||
Discourse.expects(:handle_job_exception).times(3)
|
||||
|
||||
bad = BadJob.new
|
||||
expect{bad.perform({})}.to raise_error
|
||||
expect{bad.perform({})}.to raise_error(Jobs::HandledExceptionWrapper)
|
||||
expect(bad.fail_count).to eq(3)
|
||||
end
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ describe PostAction do
|
|||
|
||||
expect {
|
||||
PostAction.act(eviltrout, post, PostActionType.types[:like])
|
||||
}.to raise_error
|
||||
}.to raise_error(RateLimiter::LimitExceeded)
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -443,7 +443,7 @@ describe Topic do
|
|||
|
||||
expect {
|
||||
topic.invite(topic.user, "user@example.com")
|
||||
}.to raise_exception
|
||||
}.to raise_error(RateLimiter::LimitExceeded)
|
||||
end
|
||||
|
||||
context 'bumping topics' do
|
||||
|
@ -1483,7 +1483,7 @@ describe Topic do
|
|||
freeze_time(start + 10.minutes)
|
||||
expect {
|
||||
create_post(user: user)
|
||||
}.to raise_exception
|
||||
}.to raise_error(RateLimiter::LimitExceeded)
|
||||
|
||||
freeze_time(start + 20.minutes)
|
||||
create_post(user: user, topic_id: topic_id)
|
||||
|
@ -1492,7 +1492,7 @@ describe Topic do
|
|||
|
||||
expect {
|
||||
create_post(user: user, topic_id: topic_id)
|
||||
}.to raise_exception
|
||||
}.to raise_error(RateLimiter::LimitExceeded)
|
||||
end
|
||||
|
||||
describe ".count_exceeds_minimun?" do
|
||||
|
|
|
@ -204,7 +204,7 @@ describe User do
|
|||
describe 'has_trust_level?' do
|
||||
|
||||
it "raises an error with an invalid level" do
|
||||
expect { user.has_trust_level?(:wat) }.to raise_error
|
||||
expect { user.has_trust_level?(:wat) }.to raise_error(InvalidTrustLevel)
|
||||
end
|
||||
|
||||
it "is true for your basic level" do
|
||||
|
@ -1106,7 +1106,7 @@ describe User do
|
|||
end
|
||||
|
||||
it "raises an error when passwords are too long" do
|
||||
expect { hash(too_long, 'gravy') }.to raise_error
|
||||
expect { hash(too_long, 'gravy') }.to raise_error(StandardError)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -78,13 +78,6 @@ Spork.prefork do
|
|||
SiteSetting.defaults[k] = v
|
||||
end
|
||||
|
||||
# Monkey patch for NoMethodError: undefined method `cache' for nil:NilClass
|
||||
# https://github.com/rspec/rspec-rails/issues/1532#issuecomment-174679485
|
||||
# fixed in Rspec 3.4.1
|
||||
RSpec::Rails::ViewRendering::EmptyTemplatePathSetDecorator.class_eval do
|
||||
alias_method :find_all_anywhere, :find_all
|
||||
end
|
||||
|
||||
require_dependency 'site_settings/local_process_provider'
|
||||
SiteSetting.provider = SiteSettings::LocalProcessProvider.new
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue