mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 17:40:43 +08:00
REFACTOR: admin versions controller specs to requests (#5973)
This commit is contained in:

committed by
Guo Xiang Tan

parent
237559c76f
commit
2c8a9d36af
@ -1,37 +0,0 @@
|
||||
require 'rails_helper'
|
||||
require_dependency 'version'
|
||||
|
||||
describe Admin::VersionsController do
|
||||
|
||||
before do
|
||||
Jobs::VersionCheck.any_instance.stubs(:execute).returns(true)
|
||||
DiscourseUpdates.stubs(:updated_at).returns(2.hours.ago)
|
||||
DiscourseUpdates.stubs(:latest_version).returns('1.2.33')
|
||||
DiscourseUpdates.stubs(:critical_updates_available?).returns(false)
|
||||
end
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
expect(Admin::VersionsController < Admin::AdminController).to eq(true)
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
before do
|
||||
@user = log_in(:admin)
|
||||
end
|
||||
|
||||
describe 'show' do
|
||||
subject { get :show, format: :json }
|
||||
it { is_expected.to be_successful }
|
||||
|
||||
it 'should return the currently available version' do
|
||||
json = JSON.parse(subject.body)
|
||||
expect(json['latest_version']).to eq('1.2.33')
|
||||
end
|
||||
|
||||
it "should return the installed version" do
|
||||
json = JSON.parse(subject.body)
|
||||
expect(json['installed_version']).to eq(Discourse::VERSION::STRING)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user