cucumber-persona 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/README.md +35 -38
- data/cucumber-persona.gemspec +3 -4
- data/lib/cucumber/persona/version.rb +1 -1
- metadata +12 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8223c975c32da3cc19873502f77d4ea8559f5dee398f77511a968f0572129b44
|
4
|
+
data.tar.gz: 4f7fa3140587190eda6e037f92399dea61a6cf58bd1754d762a48225d4620940
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9667eb8de6c1e3fb680199f6d20e05b4aca03b8c8f31b1117561c5025a723fb870daa5a2adc0431ce5509d8e0b37466864e3bdbfcc0be1c51e72eafa46693de
|
7
|
+
data.tar.gz: da8dfa02f71c4342730df2625b7e839ba646b012c823fc024e4b8a45bf38f28c1ebd01985cd8a0819dd0fc2996068b0b465bbacf8bfa4d881d54f47648858220
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.3
|
data/README.md
CHANGED
@@ -1,12 +1,27 @@
|
|
1
1
|
# Cucumber::Persona
|
2
2
|
|
3
3
|
[![Code Climate](https://codeclimate.com/github/starfighterheavy/cucumber-persona/badges/gpa.svg)](https://codeclimate.com/github/starfighterheavy/cucumber-persona)
|
4
|
-
[![Dependency Status](https://gemnasium.com/starfighterheavy/cucumber-persona.svg)](https://gemnasium.com/starfighterheavy/cucumber-persona)
|
5
4
|
[![Gem Version](https://badge.fury.io/rb/cucumber-persona.svg)](https://badge.fury.io/rb/cucumber-persona)
|
6
5
|
|
7
6
|
One of the hardest things to do in Cucumber is define the state of the world, from a data perspective, that a test should be run in. Gems like [cucumber_factory](https://github.com/makandra/cucumber_factory) try to make this easier, but can introduce more complexity rather than less, as even simple tests can require extensive background data to be run well. Cucumber::Persona attempts to solve this by completely removing data setup from your cucumber feature scripts and allowing total flexibility in how you create your data.
|
8
7
|
|
9
|
-
To
|
8
|
+
To create your first Persona, create add a `personas` directory to your `features` directory (or wherever you'd like to place it) and create a `.rb` new file, typically named after a Persona, e.g. `han_solo.rb`, or a category of personas, e.g. `customers.rb`, similar to how you would define a model with FactoryGirl. That file will look something like this:
|
9
|
+
|
10
|
+
```
|
11
|
+
Cucumber::Persona.define "Han Solo" do
|
12
|
+
# Create the user
|
13
|
+
user = User.create!(first_name: "Han", last_name: "Solo", email: "han@solo.com", password: "Password1")
|
14
|
+
# Create any additional data needed to flesh out the user's state of the world at the time of the test.
|
15
|
+
# Example below is for a todo list application where our user Han has 3 tasks and completed 1.
|
16
|
+
user.tasks.create!(title: "First task", completed: Time.now)
|
17
|
+
user.tasks.create!(title: "Second task")
|
18
|
+
user.tasks.create!(title: "Third task")
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
In your `features/support/env.rb` file, add `require 'cucumber/persona'`.
|
23
|
+
|
24
|
+
Then, in your feature test setup, instantiate the Cucumber::Persona you need by adding a `Given` statement in the form:
|
10
25
|
|
11
26
|
```
|
12
27
|
Given I am "Han Solo"
|
@@ -22,40 +37,6 @@ Given "Han Solo" exists
|
|
22
37
|
|
23
38
|
And wala! All the data you need is ready to go.
|
24
39
|
|
25
|
-
## Installation
|
26
|
-
|
27
|
-
Add this line to your application's Gemfile:
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
gem 'cucumber-persona'
|
31
|
-
```
|
32
|
-
|
33
|
-
And then execute:
|
34
|
-
|
35
|
-
$ bundle
|
36
|
-
|
37
|
-
Or install it yourself as:
|
38
|
-
|
39
|
-
$ gem install cucumber-persona
|
40
|
-
|
41
|
-
## Usage
|
42
|
-
|
43
|
-
In your `features/support/env.rb` file, add `require 'cucumber/persona'`.
|
44
|
-
|
45
|
-
To create your first Persona, create add a `personas` directory to your `features` directory (or wherever you'd like to place it) and create a `.rb` new file, typically named after a Persona, e.g. `han_solo.rb`, or a category of personas, e.g. `customers.rb`, similar to how you would define a model with FactoryGirl. That file will look something like this:
|
46
|
-
|
47
|
-
```
|
48
|
-
Cucumber::Persona.define "Han Solo" do
|
49
|
-
# Create the user
|
50
|
-
user = User.create!(first_name: "Han", last_name: "Solo", email: "han@solo.com", password: "Password1")
|
51
|
-
# Create any additional data needed to flesh out the user's state of the world at the time of the test.
|
52
|
-
# Example below is for a todo list application where our user Han has 3 tasks and completed 1.
|
53
|
-
user.tasks.create!(title: "First task", completed: Time.now)
|
54
|
-
user.tasks.create!(title: "Second task")
|
55
|
-
user.tasks.create!(title: "Third task")
|
56
|
-
end
|
57
|
-
```
|
58
|
-
|
59
40
|
To use your persona in your tests, you can create your own persona related step definition, or use the default ones provided by including the requiring in your `env.rb` file:
|
60
41
|
|
61
42
|
```
|
@@ -79,6 +60,22 @@ require_relative '../features/personas'
|
|
79
60
|
Cucumber::Persona.create_all
|
80
61
|
```
|
81
62
|
|
63
|
+
## Installation
|
64
|
+
|
65
|
+
Add this line to your application's Gemfile:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
gem 'cucumber-persona'
|
69
|
+
```
|
70
|
+
|
71
|
+
And then execute:
|
72
|
+
|
73
|
+
$ bundle
|
74
|
+
|
75
|
+
Or install it yourself as:
|
76
|
+
|
77
|
+
$ gem install cucumber-persona
|
78
|
+
|
82
79
|
## Examples
|
83
80
|
|
84
81
|
### Edward
|
@@ -87,9 +84,9 @@ This project was originally extracted from [Edward](https://github.com/starfight
|
|
87
84
|
|
88
85
|
See: https://github.com/starfighterheavy/edward/tree/master/features/personas
|
89
86
|
|
90
|
-
### BridgeCare
|
87
|
+
### BridgeCare
|
91
88
|
|
92
|
-
[BridgeCare
|
89
|
+
[BridgeCare](https://www.getbridgecare.com) uses Cucumber::Persona to create tests centered around common user personas that have their own quirks and history, rather than nameless data objects.
|
93
90
|
|
94
91
|
#### Are you using Cucumber::Persona?
|
95
92
|
|
data/cucumber-persona.gemspec
CHANGED
@@ -24,8 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.add_development_dependency "bundler", "~>
|
28
|
-
spec.add_development_dependency "cucumber"
|
29
|
-
spec.add_development_dependency "
|
30
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
+
spec.add_development_dependency "cucumber", "~> 3.1"
|
29
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
31
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-persona
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Kirst
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,56 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: cucumber
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: pry
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
31
|
+
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
33
|
+
version: '3.1'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - "
|
38
|
+
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
40
|
+
version: '3.1'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
47
|
+
version: '12.3'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '12.3'
|
69
55
|
description: Cucumber Persona makes BDD easier by allowing you to define Personas
|
70
56
|
that match real life user data.
|
71
57
|
email:
|
@@ -75,6 +61,7 @@ extensions: []
|
|
75
61
|
extra_rdoc_files: []
|
76
62
|
files:
|
77
63
|
- ".gitignore"
|
64
|
+
- ".ruby-version"
|
78
65
|
- CODE_OF_CONDUCT.md
|
79
66
|
- Gemfile
|
80
67
|
- LICENSE.txt
|
@@ -105,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
92
|
- !ruby/object:Gem::Version
|
106
93
|
version: '0'
|
107
94
|
requirements: []
|
108
|
-
|
109
|
-
rubygems_version: 2.7.6
|
95
|
+
rubygems_version: 3.0.3
|
110
96
|
signing_key:
|
111
97
|
specification_version: 4
|
112
98
|
summary: Easily create data models for use in testing and development.
|