← Back to Upcase

Spec/support/features/sign_in.rb not showing result in RSpec

(Jeremiah Shafer) #1

I’m currently working through “Signing In and Todo Ownership” and I’ve followed the instructions to create the test for module Features and RSpec and it’s returning results as if there is no test being run:

rspec spec/support/features/sign_in.rb
No examples found.


Finished in 0.00031 seconds (files took 0.08094 seconds to load)
0 examples, 0 failures

This is what I have in the file:

module Features
  def sign_in
    visit root_path
    fill_in "Email", with: "person@example.com"
    click_on "Sign in"
  end
end

I feel like I’m missing something really simple but I followed the instructions in the video. Any thoughts.

(Pedro Moreira) #2

Hi!

The features module is meant to be included in one of your tests - so you’d have a feature spec that uses the method sign_in. The module itself is not meant to run like a spec - it is just a place to share code/methods between specs. An example:

feature "User signs in" do
  include Features

  scenario "with email" do
   sign_in # this method is made available by the Features module

   #the rest of your test
 end
end

You can move the inclusion of the module to your rails helper or even configure it to be included by adding this line after your module declaration:

# in spec/support/features/sign_in.rb
RSpec.configure { |config| config.include Features }

Hope this helps