1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
Commit graph

24 commits

Author SHA1 Message Date
Patrik Ragnarsson
65d0ec554c
Update broken links in docs (#1897)
- Rack changed default branch to "main"
- rubydoc.info redirects to https://

[ci skip]
2023-03-05 16:06:56 +01:00
Vasiliy
8ae87a87f3
Setup Rubocop (#1537)
* Initialize rubocop

* Style/StringLiterals: prefer single quotes

* Style/AndOr: use `&&` and `||`, instead of `and` and `or`

* Style/HashSyntax: use new hash syntax

* Layout/EmptyLineAfterGuardClause: add empty lines after guard clause

* Style/SingleLineMethods: temporary disable

It breaks layout of the code, it is better to fix it manually

* Style/Proc: prefer `proc` vs `Proc.new`

* Disable Lint/AmbiguousBlockAssociation

It affects proc definitions for sinatra DSL

* Disable Style/CaseEquality

* Lint/UnusedBlockArgument: put underscore in front of it

* Style/Alias: prefer alias vs alias_method in a class body

* Layout/EmptyLineBetweenDefs: add empty lines between defs

* Style/ParallelAssignment: don't use parallel assigment

* Style/RegexpLiteral: prefer %r for regular expressions

* Naming/UncommunicativeMethodParamName: fix abbrevs

* Style/PerlBackrefs: disable cop

* Layout/SpaceAfterComma: add missing spaces

* Style/Documentation: disable cop

* Style/FrozenStringLiteralComment: add frozen_string_literal

* Layout/AlignHash: align hash

* Layout/ExtraSpacing: allow for alignment

* Layout/SpaceAroundOperators: add missing spaces

* Style/Not: prefer `!` instead of `not`

* Style/GuardClause: add guard conditions

* Style/MutableConstant: freeze contants

* Lint/IneffectiveAccessModifier: disable cop

* Lint/RescueException: disable cop

* Style/SpecialGlobalVars: disable cop

* Layout/DotPosition: fix position of dot for multiline method chains

* Layout/SpaceInsideArrayLiteralBrackets: don't use spaces inside arrays

* Layout/SpaceInsideBlockBraces: add space for blocks

* Layout/SpaceInsideHashLiteralBraces: add spaces for hashes

* Style/FormatString: use format string syntax

* Style/StderrPuts: `warn` is preferable to `$stderr.puts`

* Bundler/DuplicatedGem: disable cop

* Layout/AlignArray: fix warning

* Lint/AssignmentInCondition: remove assignments from conditions

* Layout/IndentHeredoc: disable cop

* Layout/SpaceInsideParens: remove extra spaces

* Lint/UnusedMethodArgument: put underscore in front of unused arg

* Naming/RescuedExceptionsVariableName: use `e` for exceptions

* Style/CommentedKeyword: put comments before the method

* Style/FormatStringToken: disable cop

* Style/MultilineIfModifier: move condition before the method

* Style/SignalException: prefer `raise` to `fail`

* Style/SymbolArray: prefer %i for array of symbols

* Gemspec/OrderedDependencies: Use alphabetical order for dependencies

* Lint/UselessAccessModifier: disable cop

* Naming/HeredocDelimiterNaming: change delimiter's name

* Style/ClassCheck: prefer `is_a?` to `kind_of?`

* Style/ClassVars: disable cop

* Style/Encoding: remove coding comment

* Style/RedundantParentheses: remove extra parentheses

* Style/StringLiteralsInInterpolation: prefer singl quotes

* Layout/AlignArguments: fix alignment

* Layout/ClosingHeredocIndentation: align heredoc

* Layout/EmptyLineAfterMagicComment: add empty line

* Set RubyVersion for rubocop

* Lint/UselessAssignment: disable cop

* Style/EmptyLiteral: disable cop

Causes test failures

* Minor code-style fixes with --safe-auto-correct option

* Disable the rest of the cops that cause warnings

It would be easier to re-enable them in separate PRs

* Add rubocop check to the default Rake task

* Update to rubocop 1.32.0

* Rubocop updates for rack-protection and sinatra-contrib

* Disable Style/SlicingWithRange cop

* Make suggested updates

Co-authored-by: Jordan Owens <jkowens@gmail.com>
2022-07-31 08:56:44 -04:00
Eloy Pérez
d53ff943b8 Disable monkey patch for rack-protection 2022-02-05 13:32:44 +01:00
Eloy Pérez
c922ffe2bc Use same rake task and config for tests in sinatra-contrib and rack-protection 2022-02-05 13:10:04 +01:00
Olle Jonsson
1559a20b06 refactor: use __dir__ in File.expand_path
__dir__ is nice, and available.
2022-02-02 15:58:11 -05:00
Maurizio De Santis
5ab673ae69 Restore RSpec init default files 2014-09-03 19:25:20 +02:00
Maurizio De Santis
e6df2d8d6f Reorganize spec helpers into spec/support 2014-09-03 19:25:20 +02:00
Maurizio De Santis
48c2f55c63 Remove unnedeed require 2014-09-03 19:25:20 +02:00
Maurizio De Santis
f010092dc6 Fix broken test 2014-09-03 19:25:20 +02:00
Maurizio De Santis
41937da782 Fix some trivial Ruby warnings 2014-09-03 19:25:20 +02:00
Maurizio De Santis
af5d49b1ae Replace define_methods with Struct.new blocks 2014-09-03 19:05:50 +02:00
Maurizio De Santis
16636ae9b4 Convert specs to RSpec 2.99.2 syntax with Transpec
This conversion is done by Transpec 2.3.7 with the following command:
    transpec

* 69 conversions
    from: obj.should
      to: expect(obj).to

* 30 conversions
    from: == expected
      to: eq(expected)

* 24 conversions
    from: obj.should_not
      to: expect(obj).not_to

* 3 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 2 conversions
    from: be_false
      to: be_falsey

* 1 conversion
    from: be_true
      to: be_truthy

* 1 conversion
    from: obj.should_not_receive(:message)
      to: expect(obj).not_to receive(:message)

* 1 conversion
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2014-09-03 01:54:36 +02:00
Konstantin Haase
73bfb25eeb improve compatibility to old rack versions, fixes #36 2012-12-12 11:03:07 +01:00
Konstantin Haase
13f0d4dac3 only set protection headers for html, fixes #31 2012-12-10 16:42:48 +01:00
Alex Rodionov
0de1b72cc4 DummyApp should not return body for HEAD requests 2012-05-12 22:22:42 +07:00
Konstantin Haase
239da7f642 spects for token checks 2011-06-20 09:16:44 +02:00
Konstantin Haase
012cd7be0f implement session hijacking prevention 2011-05-29 13:01:47 +02:00
Konstantin Haase
b3dbbb80dd feed some input that might change into dummy requests 2011-05-25 12:48:19 +02:00
Konstantin Haase
647d1687ac check correct env behavior of all middleware 2011-05-25 12:46:20 +02:00
Konstantin Haase
50f25adadb specs for XSSHeader 2011-05-24 11:04:49 +02:00
Konstantin Haase
f3477483ca use Rack::Lint for testing 2011-05-24 11:00:16 +02:00
Konstantin Haase
7b70a7924e fix mock_app 2011-05-24 10:56:31 +02:00
Konstantin Haase
3384ede80d have mock_app duck typing the block passed to it 2011-05-24 10:25:20 +02:00
Konstantin Haase
5152b0eac2 set up testing infrastructure and shared tests 2011-05-23 17:36:16 +02:00