Skip to content

Commit e67780b

Browse files
[Docs] Update Ruby and docs dependencies to the latest versions (#773)
* Update ruby and deps * Fix build script, explicit type * Code blocks, no border otherwise * Add more ruby platforms * Fix code highlight * Replace tabs with 4 spaces * Fix tests from docs
1 parent fe364d7 commit e67780b

14 files changed

+125
-115
lines changed

.github/workflows/build_and_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: Setup Ruby
5555
uses: ruby/setup-ruby@v1
5656
with:
57-
ruby-version: '2.7'
57+
ruby-version: '3.2'
5858
bundler-cache: true
5959

6060
- name: Build all targets

Gemfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
source "https://rubygems.org"
2-
gem "rake", ">= 12.3.3"
3-
gem "liquid", "4.0"
4-
gem "jekyll", "3.9.0"
2+
gem 'rake', '~> 13.1'
3+
gem 'liquid', '~> 4.0'
4+
gem 'jekyll', '4.3.3'
55
gem "kramdown-parser-gfm", "1.1.0"
6-
gem "ruby_dep", "~> 1.3"
7-

Gemfile.lock

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,78 @@ GEM
44
addressable (2.8.6)
55
public_suffix (>= 2.0.2, < 6.0)
66
colorator (1.1.0)
7-
concurrent-ruby (1.2.2)
7+
concurrent-ruby (1.2.3)
88
em-websocket (0.5.3)
99
eventmachine (>= 0.12.9)
1010
http_parser.rb (~> 0)
1111
eventmachine (1.2.7)
1212
eventmachine (1.2.7-x64-mingw32)
1313
ffi (1.16.3)
14-
ffi (1.16.3-x64-mingw32)
1514
forwardable-extended (2.6.0)
15+
google-protobuf (3.25.2)
1616
http_parser.rb (0.8.0)
17-
i18n (0.9.5)
17+
i18n (1.14.1)
1818
concurrent-ruby (~> 1.0)
19-
jekyll (3.9.0)
19+
jekyll (4.3.3)
2020
addressable (~> 2.4)
2121
colorator (~> 1.0)
2222
em-websocket (~> 0.5)
23-
i18n (~> 0.7)
24-
jekyll-sass-converter (~> 1.0)
23+
i18n (~> 1.0)
24+
jekyll-sass-converter (>= 2.0, < 4.0)
2525
jekyll-watch (~> 2.0)
26-
kramdown (>= 1.17, < 3)
26+
kramdown (~> 2.3, >= 2.3.1)
27+
kramdown-parser-gfm (~> 1.0)
2728
liquid (~> 4.0)
28-
mercenary (~> 0.3.3)
29+
mercenary (>= 0.3.6, < 0.5)
2930
pathutil (~> 0.9)
30-
rouge (>= 1.7, < 4)
31+
rouge (>= 3.0, < 5.0)
3132
safe_yaml (~> 1.0)
32-
jekyll-sass-converter (1.5.2)
33-
sass (~> 3.4)
33+
terminal-table (>= 1.8, < 4.0)
34+
webrick (~> 1.7)
35+
jekyll-sass-converter (3.0.0)
36+
sass-embedded (~> 1.54)
3437
jekyll-watch (2.2.1)
3538
listen (~> 3.0)
3639
kramdown (2.4.0)
3740
rexml
3841
kramdown-parser-gfm (1.1.0)
3942
kramdown (~> 2.0)
40-
liquid (4.0.0)
43+
liquid (4.0.4)
4144
listen (3.8.0)
4245
rb-fsevent (~> 0.10, >= 0.10.3)
4346
rb-inotify (~> 0.9, >= 0.9.10)
44-
mercenary (0.3.6)
47+
mercenary (0.4.0)
4548
pathutil (0.16.2)
4649
forwardable-extended (~> 2.6)
4750
public_suffix (5.0.4)
48-
rake (13.0.1)
51+
rake (13.1.0)
4952
rb-fsevent (0.11.2)
5053
rb-inotify (0.10.1)
5154
ffi (~> 1.0)
5255
rexml (3.2.6)
53-
rouge (3.30.0)
54-
ruby_dep (1.3.1)
56+
rouge (4.2.0)
5557
safe_yaml (1.0.5)
56-
sass (3.7.4)
57-
sass-listen (~> 4.0.0)
58-
sass-listen (4.0.0)
59-
rb-fsevent (~> 0.9, >= 0.9.4)
60-
rb-inotify (~> 0.9, >= 0.9.7)
58+
sass-embedded (1.70.0-x64-mingw-ucrt)
59+
google-protobuf (~> 3.25)
60+
sass-embedded (1.70.0-x64-mingw32)
61+
google-protobuf (~> 3.25)
62+
sass-embedded (1.70.0-x86_64-linux-gnu)
63+
google-protobuf (~> 3.25)
64+
terminal-table (3.0.2)
65+
unicode-display_width (>= 1.1.1, < 3)
66+
unicode-display_width (2.5.0)
67+
webrick (1.8.1)
6168

6269
PLATFORMS
63-
ruby
70+
x64-mingw-ucrt
6471
x64-mingw32
72+
x86_64-linux
6573

6674
DEPENDENCIES
67-
jekyll (= 3.9.0)
75+
jekyll (= 4.3.3)
6876
kramdown-parser-gfm (= 1.1.0)
69-
liquid (= 4.0)
70-
rake (>= 12.3.3)
71-
ruby_dep (~> 1.3)
77+
liquid (~> 4.0)
78+
rake (~> 13.1)
7279

7380
BUNDLED WITH
74-
2.1.4
81+
2.4.1

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ _calculator.DidNotReceive().Add(5, 7);
6969

7070
If our Received() assertion fails, NSubstitute tries to give us some help as to what the problem might be:
7171

72-
73-
NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching:
74-
Add(1, 2)
75-
Actually received no matching calls.
76-
Received 2 non-matching calls (non-matching arguments indicated with '*' characters):
77-
Add(1, *5*)
78-
Add(*4*, *7*)
72+
```
73+
NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching:
74+
Add(1, 2)
75+
Actually received no matching calls.
76+
Received 2 non-matching calls (non-matching arguments indicated with '*' characters):
77+
Add(1, *5*)
78+
Add(*4*, *7*)
79+
```
7980

8081
We can also work with properties using the Returns syntax we use for methods, or just stick with plain old property setters (for read/write properties):
8182

build/ExtractDocs.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let tags s : LiquidTag seq =
1818
|> Seq.map (fun m -> LiquidTag (m.Groups.[1].Value, m.Groups.[2].Value))
1919

2020
let toCodeBlock (LiquidTag (name, c)) =
21-
let isTypeOrTestDecl s = Regex.IsMatch(s, TypeOrTestDeclRegex)
21+
let isTypeOrTestDecl (s: string) = Regex.IsMatch(s, TypeOrTestDeclRegex)
2222
match name with
2323
| "csharp" -> if isTypeOrTestDecl c then Some (Declaration c) else Some (Snippet c)
2424
| "requiredcode" -> Some (Declaration c)

docs/help/_posts/2010-01-01-getting-started.markdown

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ layout: post
77

88
First add the [NSubstitute NuGet package](https://nuget.org/List/Packages/NSubstitute) to your test project using [NuGet](https://docs.microsoft.com/en-us/nuget/quickstart/use-a-package) (either the command line executable, or via the package manager in your IDE).
99

10-
> Install-Package NSubstitute
10+
```sh
11+
> Install-Package NSubstitute
12+
```
1113

1214
It is optional but recommended to also install [NSubstitute.Analyzers.CSharp](https://www.nuget.org/packages/NSubstitute.Analyzers.CSharp/) for C# projects, or [NSubstitute.Analyzers.VisualBasic](https://www.nuget.org/packages/NSubstitute.Analyzers.VisualBasic/) for VB projects. NSubstitute will work without the analysers installed, but these packages will [help detect potential misuses of the NSubstitute API](/help/nsubstitute-analysers/).
1315

14-
> Install-Package NSubstitute.Analyzers.CSharp
15-
// or
16-
> Install-Package NSubstitute.Analyzers.VisualBasic
17-
16+
```sh
17+
> Install-Package NSubstitute.Analyzers.CSharp
18+
// or
19+
> Install-Package NSubstitute.Analyzers.VisualBasic
20+
```
1821
## Using NSubstitute in a test fixture
1922

2023
So now you are staring at a blank test fixture (created with your favourite unit testing framework; for these examples we're using [NUnit](https://nunit.org/)), and are wondering where to start.
@@ -65,13 +68,14 @@ calculator.DidNotReceive().Add(5, 7);
6568

6669
If our `Received()` assertion fails, NSubstitute tries to give us some help as to what the problem might be:
6770

68-
69-
NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching:
70-
Add(1, 2)
71-
Actually received no matching calls.
72-
Received 2 non-matching calls (non-matching arguments indicated with '*' characters):
73-
Add(*4*, *7*)
74-
Add(1, *5*)
71+
```
72+
NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching:
73+
Add(1, 2)
74+
Actually received no matching calls.
75+
Received 2 non-matching calls (non-matching arguments indicated with '*' characters):
76+
Add(*4*, *7*)
77+
Add(1, *5*)
78+
```
7579

7680
We can also work with properties using the `Returns` syntax we use for methods, or just stick with plain old property setters (for read/write properties):
7781

@@ -119,4 +123,4 @@ calculator.PoweringUp += Raise.Event();
119123
Assert.That(eventWasRaised);
120124
```
121125

122-
That's pretty much all you need to get started with NSubstitute. Read on for more detailed feature descriptions, as well as for some of the less common requirements that NSubstitute supports.
126+
That's pretty much all you need to get started with NSubstitute. Read on for more detailed feature descriptions, as well as for some of the less common requirements that NSubstitute supports.

docs/help/_posts/2010-01-02-creating-a-substitute.markdown

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ Your substitute can implement several types this way, but remember you can only
4747

4848
```csharp
4949
var substitute = Substitute.For(
50-
new[] { typeof(ICommand), typeof(ISomeInterface), typeof(SomeClassWithCtorArgs) },
51-
new object[] { 5, "hello world" }
52-
);
50+
new[] { typeof(ICommand), typeof(ISomeInterface), typeof(SomeClassWithCtorArgs) },
51+
new object[] { 5, "hello world" }
52+
);
5353
Assert.IsInstanceOf<ICommand>(substitute);
5454
Assert.IsInstanceOf<ISomeInterface>(substitute);
5555
Assert.IsInstanceOf<SomeClassWithCtorArgs>(substitute);
@@ -60,27 +60,27 @@ Assert.IsInstanceOf<SomeClassWithCtorArgs>(substitute);
6060
public interface ISomeInterface { }
6161
public abstract class SomeClassWithCtorArgs
6262
{
63-
protected SomeClassWithCtorArgs(int anInt, string aString) { }
63+
protected SomeClassWithCtorArgs(int anInt, string aString) { }
6464
}
6565
6666
public interface ICommand
6767
{
68-
void Execute();
68+
void Execute();
6969
}
7070
7171
public class CommandRunner
7272
{
73-
private readonly ICommand _command;
74-
public CommandRunner(ICommand command)
75-
{
76-
_command = command;
77-
}
78-
79-
public void RunCommand()
80-
{
81-
_command.Execute();
82-
if (_command is IDisposable) ((IDisposable)_command).Dispose();
83-
}
73+
private readonly ICommand _command;
74+
public CommandRunner(ICommand command)
75+
{
76+
_command = command;
77+
}
78+
79+
public void RunCommand()
80+
{
81+
_command.Execute();
82+
if (_command is IDisposable) ((IDisposable)_command).Dispose();
83+
}
8484
}
8585
```
8686
-->

docs/help/_posts/2010-02-01-set-return-value.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ The following examples relate to substituting for the following interface:
77

88
```csharp
99
public interface ICalculator {
10-
int Add(int a, int b);
11-
string Mode { get; set; }
10+
int Add(int a, int b);
11+
string Mode { get; set; }
1212
}
1313
```
1414

docs/help/_posts/2010-02-02-return-for-args.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ layout: post
66
<!--
77
```requiredcode
88
public interface ICalculator {
9-
int Add(int a, int b);
10-
string Mode { get; set; }
9+
int Add(int a, int b);
10+
string Mode { get; set; }
1111
}
1212
ICalculator calculator;
1313
[SetUp] public void SetUp() { calculator = Substitute.For<ICalculator>(); }

docs/help/_posts/2010-02-03-return-for-any-args.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ layout: post
66
<!--
77
```requiredcode
88
public interface ICalculator {
9-
int Add(int a, int b);
10-
string Mode { get; set; }
9+
int Add(int a, int b);
10+
string Mode { get; set; }
1111
}
1212
ICalculator calculator;
1313
[SetUp] public void SetUp() { calculator = Substitute.For<ICalculator>(); }

0 commit comments

Comments
 (0)