Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix specs. #454

Merged
merged 1 commit into from Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .rubocop.yml
@@ -1,2 +1,5 @@
inherit_gem:
rubocop-discourse: default.yml

RSpec/MessageSpies:
Enabled: false
1 change: 0 additions & 1 deletion lib/mini_profiler/profiler.rb
Expand Up @@ -373,7 +373,6 @@ def call(env)
return client_settings.handle_cookie(self.flamegraph(flamegraph))
end


begin
@storage.save(page_struct)
# no matter what it is, it should be unviewed, otherwise we will miss POST
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/mini_profiler_spec.rb
Expand Up @@ -338,8 +338,8 @@ def load_prof(response)
describe 'error handling when storage_instance fails to save' do
it "should recover gracefully" do
Rack::MiniProfiler.config.pre_authorize_cb = lambda { |env| true }
allow_any_instance_of(Rack::MiniProfiler::MemoryStore).to have_received(:save) { raise "This error" }
expect(Rack::MiniProfiler.config.storage_failure).to have_received(:call)
allow_any_instance_of(Rack::MiniProfiler::MemoryStore).to receive(:save) { raise "This error" }
expect(Rack::MiniProfiler.config.storage_failure).to receive(:call)
get '/html'
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/integration/railtie_methods_spec.rb
Expand Up @@ -11,7 +11,7 @@ def to_seconds(array)
describe Rack::MiniProfilerRailsMethods do
describe '#render_notification_handler' do
before do
allow(Process).to have_received(:clock_gettime).and_return(0)
allow(Process).to receive(:clock_gettime).and_return(0)
Rack::MiniProfiler.create_current
@current_timer = Rack::MiniProfiler.current.current_timer

Expand All @@ -22,7 +22,7 @@ def to_seconds(array)
['SELECT E', 73, 77], # in node E
['SELECT F', 93, 96] # in node F
]).each do |query, start, finish|
allow(Process).to have_received(:clock_gettime).and_return(finish)
allow(Process).to receive(:clock_gettime).and_return(finish)
@current_timer.add_sql(
query,
finish - start,
Expand All @@ -39,7 +39,7 @@ def to_seconds(array)
['custom1 B', 11, 16],
['custom1 B', 17, 19]
]).each do |type, start, finish|
allow(Process).to have_received(:clock_gettime).and_return(finish)
allow(Process).to receive(:clock_gettime).and_return(finish)
timing = @current_timer.add_custom(
type,
finish - start,
Expand Down Expand Up @@ -68,7 +68,7 @@ def to_seconds(array)
['A', 0, 80],
['F', 90, 100]
]).each do |name, start, finish|
allow(Process).to have_received(:clock_gettime).and_return(finish)
allow(Process).to receive(:clock_gettime).and_return(finish)
described_class.render_notification_handler(name, finish, start, name_as_description: true)
end
@nodes = {
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/sql_patches_spec.rb
Expand Up @@ -33,7 +33,7 @@
it "uses detection of env variable is not defined" do
with_patch_env(nil) do
expect(SqlPatches.all_patch_files).to eq([])
expect(Rack::MiniProfiler).to have_received(:patch_rails?).and_return(true)
expect(Rack::MiniProfiler).to receive(:patch_rails?).and_return(true)
expect(SqlPatches.all_patch_files).to eq(["activerecord"])
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/storage/memcache_store_spec.rb
Expand Up @@ -80,8 +80,8 @@
client = instance_double("memcache-client")
store = Rack::MiniProfiler::MemcacheStore.new(client: client)

expect(client).to have_received(:get)
expect(Dalli::Client).not_to have_received(:new)
expect(client).to receive(:get)
expect(Dalli::Client).not_to receive(:new)
store.load("XYZ")
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/storage/redis_store_spec.rb
Expand Up @@ -33,8 +33,8 @@
connection = instance_double("redis-connection")
store = Rack::MiniProfiler::RedisStore.new(connection: connection)

expect(connection).to have_received(:get)
expect(Redis).not_to have_received(:new)
expect(connection).to receive(:get)
expect(Redis).not_to receive(:new)
store.load("XYZ")
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/timer_struct/timer_struct_spec.rb
Expand Up @@ -27,7 +27,7 @@
end

it 'should not add a second (nil) argument if no arguments were passed' do
expect(::JSON).to have_received(:generate).once.with(@timer.attributes, max_nesting: 100).and_return(nil)
expect(::JSON).to receive(:generate).once.with(@timer.attributes, max_nesting: 100).and_return(nil)
@timer.to_json
end

Expand Down