mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
Add version checking that shows on the admin dashboard
This commit is contained in:
@ -4,7 +4,8 @@ require_dependency 'version'
|
||||
describe Admin::VersionsController do
|
||||
|
||||
before do
|
||||
RestClient.stubs(:get).returns( {success: 'OK', version: '1.2.33'}.to_json )
|
||||
DiscourseUpdates.stubs(:latest_version).returns('1.2.33')
|
||||
DiscourseUpdates.stubs(:critical_update_available?).returns(false)
|
||||
end
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
@ -17,38 +18,17 @@ describe Admin::VersionsController do
|
||||
end
|
||||
|
||||
describe 'show' do
|
||||
context 'when discourse_org_access_key is set' do
|
||||
before do
|
||||
SiteSetting.stubs(:discourse_org_access_key).returns('asdf')
|
||||
end
|
||||
subject { xhr :get, :show }
|
||||
it { should be_success }
|
||||
|
||||
subject { xhr :get, :show }
|
||||
it { should be_success }
|
||||
|
||||
it 'should return the currently available version' do
|
||||
json = JSON.parse(subject.body)
|
||||
json['latest_version'].should == '1.2.33'
|
||||
end
|
||||
|
||||
it "should return the installed version" do
|
||||
json = JSON.parse(subject.body)
|
||||
json['installed_version'].should == Discourse::VERSION::STRING
|
||||
end
|
||||
it 'should return the currently available version' do
|
||||
json = JSON.parse(subject.body)
|
||||
json['latest_version'].should == '1.2.33'
|
||||
end
|
||||
|
||||
context 'when discourse_org_access_key is blank' do
|
||||
subject { xhr :get, :show }
|
||||
it { should be_success }
|
||||
|
||||
it 'should return the installed version as the currently available version' do
|
||||
json = JSON.parse(subject.body)
|
||||
json['latest_version'].should == Discourse::VERSION::STRING
|
||||
end
|
||||
|
||||
it "should return the installed version" do
|
||||
json = JSON.parse(subject.body)
|
||||
json['installed_version'].should == Discourse::VERSION::STRING
|
||||
end
|
||||
it "should return the installed version" do
|
||||
json = JSON.parse(subject.body)
|
||||
json['installed_version'].should == Discourse::VERSION::STRING
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user