discourse/spec/controllers/badges_controller_spec.rb

25 lines
559 B
Ruby
Raw Normal View History

require 'spec_helper'
describe BadgesController do
let!(:badge) { Fabricate(:badge) }
context 'index' do
it 'should return a list of all badges' do
get :index, format: :json
response.status.should == 200
parsed = JSON.parse(response.body)
parsed["badges"].length.should == 1
end
end
2014-04-16 22:56:11 +08:00
context 'show' do
it "should return a badge" do
get :show, id: badge.id, format: :json
2014-04-16 22:56:11 +08:00
response.status.should == 200
parsed = JSON.parse(response.body)
parsed["badge"].should be_present
end
end
end