mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Fix failing spec. Stubbing intermittently does not stub...
This commit is contained in:
parent
11348a15ea
commit
d2c34d17b7
@ -20,7 +20,7 @@ class ColorScheme < ActiveRecord::Base
|
|||||||
@mutex.synchronize do
|
@mutex.synchronize do
|
||||||
return @base_colors if @base_colors
|
return @base_colors if @base_colors
|
||||||
@base_colors = {}
|
@base_colors = {}
|
||||||
File.readlines(BASE_COLORS_FILE).each do |line|
|
read_colors_file.each do |line|
|
||||||
matches = /\$([\w]+):\s*#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})(?:[;]|\s)/.match(line.strip)
|
matches = /\$([\w]+):\s*#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})(?:[;]|\s)/.match(line.strip)
|
||||||
@base_colors[matches[1]] = matches[2] if matches
|
@base_colors[matches[1]] = matches[2] if matches
|
||||||
end
|
end
|
||||||
@ -28,6 +28,10 @@ class ColorScheme < ActiveRecord::Base
|
|||||||
@base_colors
|
@base_colors
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.read_colors_file
|
||||||
|
File.readlines(BASE_COLORS_FILE)
|
||||||
|
end
|
||||||
|
|
||||||
def self.enabled
|
def self.enabled
|
||||||
current_version.find_by(enabled: true)
|
current_version.find_by(enabled: true)
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ describe ColorScheme do
|
|||||||
|
|
||||||
describe '#base_colors' do
|
describe '#base_colors' do
|
||||||
it 'parses the colors.scss file and returns a hash' do
|
it 'parses the colors.scss file and returns a hash' do
|
||||||
File.stubs(:readlines).with(described_class::BASE_COLORS_FILE).returns([
|
described_class.stubs(:read_colors_file).returns([
|
||||||
'$primary: #333333 !default;',
|
'$primary: #333333 !default;',
|
||||||
'$secondary: #ffffff !default; ',
|
'$secondary: #ffffff !default; ',
|
||||||
'$highlight: #ffff4d;',
|
'$highlight: #ffff4d;',
|
||||||
|
Loading…
Reference in New Issue
Block a user