Skip to content

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

Description

@roman-dubrovsky

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or requestpostponedNot valuable for nowquestionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions