Skip to content

Commit

Permalink
Updates README
Browse files Browse the repository at this point in the history
  • Loading branch information
seanhenry committed Apr 13, 2020
1 parent 37af720 commit 40f9812
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MockGeneratorTests/IOSpy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ class IOSpy: IO {
invokedCreateFileParametersList.append((path, data, attr))
return stubbedCreateFileResult
}
}
}
2 changes: 1 addition & 1 deletion MockGeneratorTests/ResolverSpy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ class ResolverSpy: Resolver {
invokedResolveParametersList.append((element, ()))
return stubbedResolveResult
}
}
}
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Swift Mock Generator Xcode Source Editor Extension
![Mock Generator Icon](readme/AppIcon_256.png)

An Xcode extension (plugin) to generate [spy](#what-is-a-spy), [stub](#what-is-a-stub), [dummy](#what-is-a-dummy), and [partial spy](#what-is-a-partial-spy) classes automatically.
An Xcode extension (plugin) and command line tool to generate [spy](#what-is-a-spy), [stub](#what-is-a-stub), [dummy](#what-is-a-dummy), and [partial spy](#what-is-a-partial-spy) classes automatically.

![Xcode mock generator](readme/XcodeMockGenerator.gif)

Expand All @@ -18,6 +18,26 @@ An Xcode extension (plugin) to generate [spy](#what-is-a-spy), [stub](#what-is-a
- Go to `System Preferences -> Security & Privacy -> Privacy -> Automation` and make sure `Swift Mock Generator` is enabled.
- Open Xcode

## Sandboxing

This extension is fully sandboxed which means you need to give permission to read your project files before using it.

### Give permission when automatically detecting the project path

- Open the companion app.
- Press "Give permission to read directory".
- Select the directory and press "Grant permission".
- In Xcode, generate your test double.

### Give permission when manually choosing the project path

- Open the companion app.
- Press the select directory button.
- Select the directory and press "Open".
- In Xcode, generate your test double.

**Please note if using manual project paths before v0.25 you will have to select your project path again.**

## How to create a new Swift test double

- Create an empty class inheriting from a class or protocols that you wish to mock.
Expand Down Expand Up @@ -47,6 +67,18 @@ The mock generator will replace anything that is currently in your class with th

Undo is supported for Xcode plugins but you're safer to use a version control system such as `git` in the event of unexpectedly generating a test double.

## Using the command line tool

For convenience, create a symbolic link to the CLI.

```
$ ln -s "/Applications/Swift Mock Generator for Xcode.app/Contents/MacOS/genmock" /usr/local/bin/genmock
```

Use `$ genmock --help` for a list of options.

See how this project generates its mocks [here](https://github.com/seanhenry/SwiftMockGeneratorForXcode/blob/master/genmocks.sh).

## Features

| Feature | Supported |
Expand Down

0 comments on commit 40f9812

Please sign in to comment.