REFACTOR: admin versions controller specs to requests (#5973)

This commit is contained in:
OsamaSayegh 2018-06-11 07:35:05 +03:00 committed by Guo Xiang Tan
parent 237559c76f
commit 2c8a9d36af
1 changed files with 8 additions and 6 deletions

View File

@ -15,21 +15,23 @@ describe Admin::VersionsController do
end
context 'while logged in as an admin' do
let(:admin) { Fabricate(:admin) }
before do
@user = log_in(:admin)
sign_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)
get "/admin/version_check.json"
expect(response.status).to eq(200)
json = JSON.parse(response.body)
expect(json['latest_version']).to eq('1.2.33')
end
it "should return the installed version" do
json = JSON.parse(subject.body)
get "/admin/version_check.json"
json = JSON.parse(response.body)
expect(response.status).to eq(200)
expect(json['installed_version']).to eq(Discourse::VERSION::STRING)
end
end