mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 15:25:10 +08:00
89ad2b5900
This updates tests to use latest rails 5 practice and updates ALL dependencies that could be updated Performance testing shows that performance has not regressed if anything it is marginally faster now.
35 lines
794 B
Ruby
35 lines
794 B
Ruby
require "rails_helper"
|
|
|
|
describe Admin::EmojisController do
|
|
|
|
let(:custom_emoji) do
|
|
Emoji.new("/path/to/hello").tap do |e|
|
|
e.name = "hello"
|
|
e.url = "/url/to/hello.png"
|
|
end
|
|
end
|
|
|
|
let(:custom_emoji2) do
|
|
Emoji.new("/path/to/hello2").tap do |e|
|
|
e.name = "hello2"
|
|
e.url = "/url/to/hello2.png"
|
|
end
|
|
end
|
|
|
|
context "when logged in" do
|
|
let!(:user) { log_in(:admin) }
|
|
|
|
context ".index" do
|
|
it "returns a list of custom emojis" do
|
|
Emoji.expects(:custom).returns([custom_emoji])
|
|
get :index, format: :json
|
|
expect(response).to be_successful
|
|
json = ::JSON.parse(response.body)
|
|
expect(json[0]["name"]).to eq(custom_emoji.name)
|
|
expect(json[0]["url"]).to eq(custom_emoji.url)
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|