doabit / semantic-ui-sass

Semantic UI, converted to Sass and ready to drop into Rails & Compass.
MIT License
1.15k stars 190 forks source link

Semantic icon helper undefined in rspec #104

Closed p12y closed 7 years ago

p12y commented 7 years ago

I'm testing a helper with rspec and I'm getting an undefined method error for the semantic_icon() helper. The helper works fine in the development environment.

 Failure/Error: semantic_icon('attention icon')
 NoMethodError:
   undefined method `semantic_icon' for #<#<Class:0x00000002f9c688>:0x000000065de3b8>
 # ./app/helpers/customers_helper.rb:21:in `no_show_count_row'
 # ./spec/helpers/customers_helper_spec.rb:36:in `block (4 levels) in <top (required)>'

Is there a way to include the helper in rspec config?

doabit commented 7 years ago

@ptylde Hi, you should test it like this

  render text: helper.no_show_count_row
p12y commented 7 years ago

Still get the same error running the test like that. I tried including the helper module in the rspec config block with no luck. However, if I add include SemanticIconHelper to my spec file, the error goes away and the tests pass.

p12y commented 7 years ago

My apologies, I figured out what the problem was. I forgot that I had set config.action_controller.include_all_helpers = false in my app's config. Thanks for the help!