/
feature_file_spec.rb
117 lines (89 loc) · 3.36 KB
/
feature_file_spec.rb
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
105
106
107
108
109
110
111
112
113
114
115
116
117
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe FeatureFile do
before(:each) do
@feature_file = FeatureFile.new("#{RAILS_ROOT}/spec/blueprints.rb")
end
it "should be a child of the File object" do
@feature_file.should be_a File
end
context "an invalid feature file" do
it "should be invalid" do
@feature_file.should be_invalid
end
end
context "importing a feature file which contains scenario outlines" do
before(:each) do
@feature_file = FeatureFile.new "#{RAILS_ROOT}/features/plain/enhancements.feature"
end
it "should store scenario outlines" do
@feature_file.scenarios.first.scenario.should contain 'When a user visits the site without JS enable we want to display a header notifying them that the site works best with JS'
end
it "should store the outlines steps" do
@feature_file.scenarios.first.steps.should_not be_empty
end
it "should have a list of examples associated to it" do
@feature_file.scenarios.first.example.should_not be_blank
end
it "should have a list of associated actions" do
@feature_file.scenarios.first.example.actions.should_not be_empty
end
it "should story the actions in the expected format" do
@feature_file.scenarios.last.example.actions.first.title.should == 'page'
end
it "should store the actions items" do
@feature_file.scenarios.last.example.actions.last.items.should_not be_empty
end
end
context "a valid feature file" do
before(:each) do
@feature_file = FeatureFile.new("#{RAILS_ROOT}/spec/fixtures/test.feature")
end
it "should be a cucumber feature file" do
@feature_file.should_not be_invalid
end
it "should store the feature heading within the feature properties" do
@feature_file.feature.should be_a String
end
it "should store the features in order heading" do
@feature_file.in_order.should be_a String
end
it "should store the as a heading" do
@feature_file.as_a.should_not be_nil
end
it "should store the features i want heading" do
@feature_file.i_want.should_not be_nil
end
it "should store the scenario's for the feature" do
@feature_file.scenarios.should_not be_nil
end
it "should contain a scenario" do
@feature_file.scenarios.should_not be_nil
end
it "should contain a scenario with steps" do
@feature_file.scenarios.first.steps.should_not be_nil
end
it "should store the expected amount of steps" do
@feature_file.scenarios.first.steps.count == 3
end
it "should have access to the files path" do
@feature_file.path.should eql "#{RAILS_ROOT}/spec/fixtures/test.feature"
end
context "exporting the feature files information" do
it "return the features title" do
@feature_file.export.should be_a Feature
end
it "should return the in order property " do
@feature_file.export.in_order.should_not be_nil
end
it "should return the as a property" do
@feature_file.export.as_a.should be_a String
end
it "should return the i want property" do
@feature_file.export.i_want.should be_a String
end
it "should return a list of stories" do
@feature_file.export.stories.should_not be_empty
end
end
end
end