scenario_helper_spec.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. require 'rails_helper'
  2. describe ScenarioHelper do
  3. let(:scenario) { users(:bob).scenarios.build(name: 'Scene', tag_fg_color: '#AAAAAA', tag_bg_color: '#000000') }
  4. describe '#style_colors' do
  5. it 'returns a css style-formated version of the scenario foreground and background colors' do
  6. expect(style_colors(scenario)).to eq("color:#AAAAAA;background-color:#000000")
  7. end
  8. it 'defauls foreground and background colors' do
  9. scenario.tag_fg_color = nil
  10. scenario.tag_bg_color = nil
  11. expect(style_colors(scenario)).to eq("color:#FFFFFF;background-color:#5BC0DE")
  12. end
  13. end
  14. describe '#scenario_label' do
  15. it 'creates a scenario label with the scenario name' do
  16. expect(scenario_label(scenario)).to eq(
  17. '<span class="label scenario" style="color:#AAAAAA;background-color:#000000">Scene</span>'
  18. )
  19. end
  20. it 'creates a scenario label with the given text' do
  21. expect(scenario_label(scenario, 'Other')).to eq(
  22. '<span class="label scenario" style="color:#AAAAAA;background-color:#000000">Other</span>'
  23. )
  24. end
  25. end
  26. end