mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 01:43:45 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
28 lines
772 B
Ruby
28 lines
772 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "constants match ruby" do
|
|
|
|
let(:ctx) { MiniRacer::Context.new }
|
|
|
|
def parse(file)
|
|
# mini racer doesn't handle JS modules so we'll do this hack
|
|
source = File.read("#{Rails.root}/app/assets/javascripts/#{file}")
|
|
source.gsub!(/^export */, '')
|
|
ctx.eval(source)
|
|
end
|
|
|
|
it "has the correct values" do
|
|
parse("discourse/app/lib/constants.js")
|
|
parse("pretty-text/addon/emoji/version.js")
|
|
|
|
priorities = ctx.eval("SEARCH_PRIORITIES")
|
|
Searchable::PRIORITIES.each do |key, value|
|
|
expect(priorities[key.to_s]).to eq(value)
|
|
end
|
|
|
|
expect(ctx.eval("SEARCH_PHRASE_REGEXP")).to eq(Search::PHRASE_MATCH_REGEXP_PATTERN)
|
|
expect(ctx.eval("IMAGE_VERSION")).to eq(Emoji::EMOJI_VERSION)
|
|
end
|
|
|
|
end
|