forked from cucumber/aruba
-
Notifications
You must be signed in to change notification settings - Fork 2
/
copy.feature
104 lines (92 loc) · 3.15 KB
/
copy.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Feature: Use fixtures in your tests
Sometimes your tests need existing files to work - e.g binary data files you
cannot create programmatically. Since `aruba` >= 0.6.3 includes some basic
support for fixtures. All you need to do is the following:
1. Create a `fixtures`-directory
2. Create fixture files in this directory
Background:
Given I use a fixture named "cli-app"
Scenario: Use a fixture for your tests
Given a file named "features/fixtures.feature" with:
"""
Feature: Fixture
Scenario: Fixture
Given a file named "fixtures_spec.rb" with:
\"\"\"
RSpec.describe 'My Feature' do
describe '#read_music_file' do
context 'when the file exists' do
before :each { copy '%/song.mp3', 'file.mp3' }
it { expect('file.mp3').to be_an_existing_file }
end
end
end
\"\"\"
"""
And a directory named "fixtures"
And an empty file named "fixtures/fixtures-app/test.txt"
When I run `rspec`
Then the specs should all pass
Scenario: Use a fixture for your tests in test/
Given a file named "features/fixtures.feature" with:
"""
Feature: Fixture
Scenario: Fixture
Given a file named "fixtures_spec.rb" with:
\"\"\"
RSpec.describe 'My Feature' do
describe '#read_music_file' do
context 'when the file exists' do
before :each { copy '%/song.mp3', 'file.mp3' }
it { expect('file.mp3').to be_an_existing_file }
end
end
end
\"\"\"
"""
And a directory named "test/fixtures"
And an empty file named "test/fixtures/fixtures-app/test.txt"
When I run `rspec`
Then the specs should all pass
Scenario: Use a fixture for your tests in spec/
Given a file named "features/fixtures.feature" with:
"""
Feature: Fixture
Scenario: Fixture
Given a file named "fixtures_spec.rb" with:
\"\"\"
RSpec.describe 'My Feature' do
describe '#read_music_file' do
context 'when the file exists' do
before :each { copy '%/song.mp3', 'file.mp3' }
it { expect('file.mp3').to be_an_existing_file }
end
end
end
\"\"\"
"""
And a directory named "spec/fixtures"
And an empty file named "spec/fixtures/fixtures-app/test.txt"
When I run `rspec`
Then the specs should all pass
Scenario: Use a fixture for your tests in features/
Given a file named "features/fixtures.feature" with:
"""
Feature: Fixture
Scenario: Fixture
Given a file named "fixtures_spec.rb" with:
\"\"\"
RSpec.describe 'My Feature' do
describe '#read_music_file' do
context 'when the file exists' do
before :each { copy '%/song.mp3', 'file.mp3' }
it { expect('file.mp3').to be_an_existing_file }
end
end
end
\"\"\"
"""
And a directory named "features/fixtures"
And an empty file named "features/fixtures/fixtures-app/test.txt"
When I run `rspec`
Then the specs should all pass