Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rspec: we should declare only let variables which we really use in the test. #109

Open
roman-dubrovsky opened this issue Oct 11, 2019 · 0 comments
Labels
feature request New feature or request postponed Not valuable for now question Further information is requested

Comments

@roman-dubrovsky
Copy link
Contributor

Is your feature request related to a problem? Please describe.

In the we file, we should declare only let variables which we really use in the test.

let(:user) { User.new }
let(:old_user) { User.new }
let(:shared_example_user) { User.new} # this variable we're using somewhere in the shared examples

it_behaves_like "shared example with shared_example_user" 

it { expect(user).is be_good_variable } 

In the example above, we should remove old_user and declare shared_example_user only for shared example

let(:user) { User.new }

it_behaves_like "shared example with shared_example_user" do
  let(:shared_example_user) { User.new} 
end

it { expect(user).is be_good_variable } 

Thoughts?

@roman-dubrovsky roman-dubrovsky added feature request New feature or request question Further information is requested labels Oct 11, 2019
@roman-dubrovsky roman-dubrovsky added the postponed Not valuable for now label Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request postponed Not valuable for now question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant