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
|
||||
return @base_colors if @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)
|
||||
@base_colors[matches[1]] = matches[2] if matches
|
||||
end
|
||||
|
@ -28,6 +28,10 @@ class ColorScheme < ActiveRecord::Base
|
|||
@base_colors
|
||||
end
|
||||
|
||||
def self.read_colors_file
|
||||
File.readlines(BASE_COLORS_FILE)
|
||||
end
|
||||
|
||||
def self.enabled
|
||||
current_version.find_by(enabled: true)
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ describe ColorScheme do
|
|||
|
||||
describe '#base_colors' 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;',
|
||||
'$secondary: #ffffff !default; ',
|
||||
'$highlight: #ffff4d;',
|
||||
|
|
Loading…
Reference in New Issue