expertiza/expertiza

View on GitHub
spec/controllers/profile_controller_spec.rb

Summary

Maintainability
A
0 mins
Test Coverage

Block has too many lines. [78/25]
Open

describe ProfileController do
  # initialize objects using factories.rb required for stubbing in test cases
  let(:super_admin) { build(:superadmin, id: 1) }
  let(:instructor1) { build(:instructor, id: 10, name: 'Instructor1') }
  let(:questionnaire) { build(:questionnaire, id: 666) }

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Block has too many lines. [50/25]
Open

  describe '#update' do
    # Test for case where the update_attributes method works as expected
    context 'when profile is saved successfully' do
      it 'shows a success flash message and redirects to profile#edit page' do
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Trailing whitespace detected.
Open

          user: { 

Align the elements of a hash literal if they span more than one line.
Open

                                      'questionnaire_weight' => '0', 'notification_limit' => '15', 'used_in_round' => '1' 

Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

- key (left align keys)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)

The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
- ignore_explicit (with curly braces)

Example:

# EnforcedHashRocketStyle: key (default)
# EnforcedColonStyle: key (default)

# good
{
  foo: bar,
  ba: baz
}
{
  :foo => bar,
  :ba => baz
}

# bad
{
  foo: bar,
   ba: baz
}
{
  :foo => bar,
   :ba => baz
}

Example:

# EnforcedHashRocketStyle: separator
# EnforcedColonStyle: separator

#good
{
  foo: bar,
   ba: baz
}
{
  :foo => bar,
   :ba => baz
}

#bad
{
  foo: bar,
  ba: baz
}
{
  :foo => bar,
  :ba => baz
}
{
  :foo => bar,
  :ba  => baz
}

Example:

# EnforcedHashRocketStyle: table
# EnforcedColonStyle: table

#good
{
  foo: bar,
  ba:  baz
}
{
  :foo => bar,
  :ba  => baz
}

#bad
{
  foo: bar,
  ba: baz
}
{
  :foo => bar,
   :ba => baz
}

Closing hash brace must be on the same line as the last hash element when opening brace is on the same line as the first hash element.
Open

                                      }

This cop checks that the closing brace in a hash literal is either on the same line as the last hash element, or a new line.

When using the symmetrical (default) style:

If a hash's opening brace is on the same line as the first element of the hash, then the closing brace should be on the same line as the last element of the hash.

If a hash's opening brace is on the line above the first element of the hash, then the closing brace should be on the line below the last element of the hash.

When using the new_line style:

The closing brace of a multi-line hash literal must be on the line after the last element of the hash.

When using the same_line style:

The closing brace of a multi-line hash literal must be on the same line as the last element of the hash.

Example: EnforcedStyle: symmetrical (default)

# bad
  { a: 1,
    b: 2
  }
  # bad
  {
    a: 1,
    b: 2 }

  # good
  { a: 1,
    b: 2 }

  # good
  {
    a: 1,
    b: 2
  }

Example: EnforcedStyle: new_line

# bad
  {
    a: 1,
    b: 2 }

  # bad
  { a: 1,
    b: 2 }

  # good
  { a: 1,
    b: 2
  }

  # good
  {
    a: 1,
    b: 2
  }

Example: EnforcedStyle: same_line

# bad
  { a: 1,
    b: 2
  }

  # bad
  {
    a: 1,
    b: 2
  }

  # good
  {
    a: 1,
    b: 2 }

  # good
  { a: 1,
    b: 2 }

Final newline missing.
Open

end

Trailing whitespace detected.
Open

                                      'questionnaire_weight' => '0', 'notification_limit' => '15', 'used_in_round' => '1' 

Extra empty line detected at block body end.
Open


  end

This cops checks if empty lines around the bodies of blocks match the configuration.

Example: EnforcedStyle: empty_lines

# good

foo do |bar|

  # ...

end

Example: EnforcedStyle: noemptylines (default)

# good

foo do |bar|
  # ...
end

There are no issues that match your filters.

Category
Status