cucumber_fm-core 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENCE +20 -0
- data/lib/cucumber_f_m/aggregator.rb +65 -0
- data/lib/cucumber_f_m/comment_module/comment.rb +7 -0
- data/lib/cucumber_f_m/config.rb +37 -0
- data/lib/cucumber_f_m/cvs/git.rb +7 -0
- data/lib/cucumber_f_m/feature.rb +141 -0
- data/lib/cucumber_f_m/feature_element/background.rb +10 -0
- data/lib/cucumber_f_m/feature_element/comment.rb +13 -0
- data/lib/cucumber_f_m/feature_element/component/comments.rb +21 -0
- data/lib/cucumber_f_m/feature_element/component/information/component.rb +16 -0
- data/lib/cucumber_f_m/feature_element/component/tags.rb +108 -0
- data/lib/cucumber_f_m/feature_element/component/title.rb +26 -0
- data/lib/cucumber_f_m/feature_element/component/total_estimation.rb +42 -0
- data/lib/cucumber_f_m/feature_element/example.rb +7 -0
- data/lib/cucumber_f_m/feature_element/info.rb +13 -0
- data/lib/cucumber_f_m/feature_element/narrative.rb +7 -0
- data/lib/cucumber_f_m/feature_element/scenario.rb +15 -0
- data/lib/cucumber_f_m/feature_element/scenario_outline.rb +23 -0
- data/lib/cucumber_f_m/feature_element/step.rb +7 -0
- data/lib/cucumber_f_m/statistic.rb +31 -0
- data/lib/cucumber_f_m/tag_filter.rb +85 -0
- data/lib/cucumber_feature_manager.rb +164 -0
- data/lib/grit/lib/grit.rb +75 -0
- data/lib/grit/lib/grit/actor.rb +36 -0
- data/lib/grit/lib/grit/blame.rb +61 -0
- data/lib/grit/lib/grit/blob.rb +126 -0
- data/lib/grit/lib/grit/commit.rb +247 -0
- data/lib/grit/lib/grit/commit_stats.rb +128 -0
- data/lib/grit/lib/grit/config.rb +44 -0
- data/lib/grit/lib/grit/diff.rb +70 -0
- data/lib/grit/lib/grit/errors.rb +7 -0
- data/lib/grit/lib/grit/git-ruby.rb +267 -0
- data/lib/grit/lib/grit/git-ruby/commit_db.rb +52 -0
- data/lib/grit/lib/grit/git-ruby/file_index.rb +193 -0
- data/lib/grit/lib/grit/git-ruby/git_object.rb +350 -0
- data/lib/grit/lib/grit/git-ruby/internal/file_window.rb +58 -0
- data/lib/grit/lib/grit/git-ruby/internal/loose.rb +137 -0
- data/lib/grit/lib/grit/git-ruby/internal/pack.rb +384 -0
- data/lib/grit/lib/grit/git-ruby/internal/raw_object.rb +37 -0
- data/lib/grit/lib/grit/git-ruby/object.rb +325 -0
- data/lib/grit/lib/grit/git-ruby/repository.rb +767 -0
- data/lib/grit/lib/grit/git.rb +323 -0
- data/lib/grit/lib/grit/index.rb +122 -0
- data/lib/grit/lib/grit/lazy.rb +33 -0
- data/lib/grit/lib/grit/merge.rb +45 -0
- data/lib/grit/lib/grit/ref.rb +74 -0
- data/lib/grit/lib/grit/repo.rb +482 -0
- data/lib/grit/lib/grit/ruby1.9.rb +7 -0
- data/lib/grit/lib/grit/status.rb +151 -0
- data/lib/grit/lib/grit/submodule.rb +88 -0
- data/lib/grit/lib/grit/tag.rb +16 -0
- data/lib/grit/lib/grit/tree.rb +123 -0
- data/lib/grit/lib/open3_detach.rb +46 -0
- data/spec/cucumber_f_m/aggregator_spec.rb +210 -0
- data/spec/cucumber_f_m/comment_module/comment_spec.rb +4 -0
- data/spec/cucumber_f_m/config_spec.rb +27 -0
- data/spec/cucumber_f_m/cvs/git_spec.rb +40 -0
- data/spec/cucumber_f_m/feature_all_tags_to_scenario_spec.rb +7 -0
- data/spec/cucumber_f_m/feature_file_manipulation_spec.rb +29 -0
- data/spec/cucumber_f_m/feature_module/background_spec.rb +30 -0
- data/spec/cucumber_f_m/feature_module/comment_spec.rb +23 -0
- data/spec/cucumber_f_m/feature_module/example_spec.rb +5 -0
- data/spec/cucumber_f_m/feature_module/info_spec.rb +30 -0
- data/spec/cucumber_f_m/feature_module/narrative_spec.rb +7 -0
- data/spec/cucumber_f_m/feature_module/scenario_outline_spec.rb +39 -0
- data/spec/cucumber_f_m/feature_module/scenario_spec.rb +33 -0
- data/spec/cucumber_f_m/feature_module/step_spec.rb +7 -0
- data/spec/cucumber_f_m/feature_module/tag_spec.rb +96 -0
- data/spec/cucumber_f_m/feature_spec.rb +229 -0
- data/spec/cucumber_f_m/tag_filter_spec.rb +191 -0
- data/spec/cucumber_feature_manager_spec.rb +59 -0
- data/spec/data/feature_manager/some_ruby_file.rb +0 -0
- data/spec/spec_helper.rb +1 -0
- metadata +141 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CucumberFM::Config do
|
4
|
+
context "default values for" do
|
5
|
+
before(:each) do
|
6
|
+
@config = CucumberFM::Config.new
|
7
|
+
end
|
8
|
+
{:dir => '', :cvs_commit => '1', :cvs_push => '1'}.each_pair do |attribute, value|
|
9
|
+
it "#{attribute} should be '#{value}'" do
|
10
|
+
@config.send(attribute).should == value
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "saving config" do
|
16
|
+
before(:each) do
|
17
|
+
@config = CucumberFM::Config.new('cvs_push' => '0', :aggregate => ['developer'])
|
18
|
+
end
|
19
|
+
{:dir => '', :cvs_commit => '1',
|
20
|
+
:cvs_push => '0', :aggregate => ['developer']}.each_pair do |attribute, value|
|
21
|
+
it "#{attribute} should be '#{value}'" do
|
22
|
+
@config.send(attribute).should == value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# test is too expensive to run it each time
|
4
|
+
|
5
|
+
#describe CucumberFM::Cvs::Git do
|
6
|
+
# before(:all) do
|
7
|
+
# @remote_repo = 'git@github.com:cs3b/cucumber_fm_test_repo.git'
|
8
|
+
# @base_repo_path = Dir.getwd + '/tmp/repo_base'
|
9
|
+
# @repo_path = '/tmp/repo'
|
10
|
+
# `git clone #{@base_repo_path} #{@repo_path}`
|
11
|
+
# @cfm = CucumberFeatureManager.new(@repo_path+'/features', @repo_path)
|
12
|
+
# @repo = @cfm.send(:repo)
|
13
|
+
# `cd #{@repo_path} && git remote rm origin`
|
14
|
+
# @repo.remote_add('origin', @remote_repo)
|
15
|
+
## @repo.git.push({}, '--force', 'origin', 'master:master')
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# after(:all) do
|
19
|
+
# `rm -rf #{@repo_path}`
|
20
|
+
# # remove all remotes except master
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# it "should be able to add changes to stash" do
|
24
|
+
# f = @cfm.features.first
|
25
|
+
# f.raw = 'Hello'
|
26
|
+
# f.save
|
27
|
+
# commit = @cfm.commit_change_on(f)
|
28
|
+
# commit.should =~ /1 files changed/
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# it "should detect that there is no changes"
|
32
|
+
#
|
33
|
+
# it "should be able to commit changes to local branch"
|
34
|
+
#
|
35
|
+
# it "should be able to push changes to remote branch" do
|
36
|
+
# @cfm.send_to_remote
|
37
|
+
# end
|
38
|
+
# it "should handle when remote branch is not fast forward"
|
39
|
+
#
|
40
|
+
#end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
#describe CucumberFeatureManager do
|
4
|
+
# before(:all) do
|
5
|
+
# `cp -r "spec/data tmp/`
|
6
|
+
# end
|
7
|
+
#
|
8
|
+
# after(:all) do
|
9
|
+
## `rm -rf tmp/data`
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# context "moving file to other directory" do
|
13
|
+
# before(:each) do
|
14
|
+
# @path = "tmp/data/feature_manager/subdir/second.feature"
|
15
|
+
# @path_new = "tmp/data/feature_manager/subdir_2/second.feature"
|
16
|
+
# @feature = CucumberFM::Feature.new(@path)
|
17
|
+
## @feature.file_move_to("tmp/data/feature_manager/subdir_2")
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# it "should not be file in dir subdir" do
|
21
|
+
# File.exist?(@path).should be_false
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# it "should be file in dir subdir_2" do
|
25
|
+
# File.exist?(@path_new).should be_true
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
#end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CucumberFM::FeatureElement::Background do
|
4
|
+
before(:each) do
|
5
|
+
raw = <<EOF
|
6
|
+
#{@comment = "## wireframe::http://somelink"}
|
7
|
+
|
8
|
+
Background: #{@title = "I am logged in as user admin"}
|
9
|
+
Given system user "t_a@hp.mc/secret" with role "locale"
|
10
|
+
And system user "p_e@hp.mc/secret" with role "product"
|
11
|
+
And signed up with "not_system_user@hp.mc/secret"
|
12
|
+
And I sign in as "admin@hearingpages.com/SxSUYGiEPi"
|
13
|
+
And user "admin@hearingpages.com" has assigned role "sys_user"
|
14
|
+
And I am on system user administration page
|
15
|
+
EOF
|
16
|
+
@feature = CucumberFM::Feature.new('fake_path')
|
17
|
+
@background = CucumberFM::FeatureElement::Background.new(@feature, raw)
|
18
|
+
end
|
19
|
+
it "should have access to feature" do
|
20
|
+
@background.feature.should == @feature
|
21
|
+
end
|
22
|
+
it "should parse comments lines" do
|
23
|
+
CucumberFM::FeatureElement::Comment.should_receive(:new).with(@background, @comment)
|
24
|
+
@background.should have(1).comments
|
25
|
+
end
|
26
|
+
it "should parse title" do
|
27
|
+
@background.title.should == @title
|
28
|
+
end
|
29
|
+
# it "should parse steps"
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CucumberFM::FeatureElement::Comment do
|
4
|
+
|
5
|
+
{
|
6
|
+
" #:::wireframe::: http://somelink" => :wireframe,
|
7
|
+
"#:::mockup::: ftp://something" => :mockup,
|
8
|
+
" #:::doc::: redmine.selleo.com/doc/124.pdf" => :doc
|
9
|
+
|
10
|
+
}.each_pair do |raw, type|
|
11
|
+
@comment = CucumberFM::FeatureElement::Comment.new("nil", raw)
|
12
|
+
|
13
|
+
it "should be treated as link" do
|
14
|
+
pending
|
15
|
+
@comment.send(:is_it_link?).should be_true
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should recognize type: #{type}" do
|
19
|
+
pending
|
20
|
+
@comment.type.should == type
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CucumberFM::FeatureElement::Info do
|
4
|
+
before(:all) do
|
5
|
+
raw = <<EOF
|
6
|
+
#{@comment_1 = "# some comment"}
|
7
|
+
#{@comment_2 = "# wireframe:: http://cs3b.com"}
|
8
|
+
|
9
|
+
@tag @mc
|
10
|
+
Feature: #{@title = "Tag filter"}
|
11
|
+
In order to fetch only scenarios that i want
|
12
|
+
as project manager, developer
|
13
|
+
I want to be able to create filter scope
|
14
|
+
EOF
|
15
|
+
feature = CucumberFM::Feature.new('fake_path')
|
16
|
+
@info = CucumberFM::FeatureElement::Info.new(feature, raw)
|
17
|
+
end
|
18
|
+
it "should parse tags" do
|
19
|
+
@info.tags.should == %w(@tag @mc)
|
20
|
+
end
|
21
|
+
it "should parse comments lines" do
|
22
|
+
CucumberFM::FeatureElement::Comment.should_receive(:new).with(@info, @comment_1)
|
23
|
+
CucumberFM::FeatureElement::Comment.should_receive(:new).with(@info, @comment_2)
|
24
|
+
@info.should have(2).comments
|
25
|
+
end
|
26
|
+
it "should parse title" do
|
27
|
+
@info.title.should == @title
|
28
|
+
end
|
29
|
+
# it "should parse narrative"
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CucumberFM::FeatureElement::ScenarioOutline do
|
4
|
+
before(:each) do
|
5
|
+
raw = %Q{#{@comment = "## wireframe::http://somelink"}
|
6
|
+
#{@comment1 = "# some text comment"}
|
7
|
+
|
8
|
+
@_todo @2 @hash @wow
|
9
|
+
Scenario Outline: #{@title = "Creating filter scope"}
|
10
|
+
When I follow "New system user"
|
11
|
+
And I fill in "password" for "Password Confirmation"
|
12
|
+
|
13
|
+
Examples:
|
14
|
+
|id |email |roles |
|
15
|
+
|5 |some@oo.com |admin |}
|
16
|
+
@feature = CucumberFM::Feature.new('fake_path')
|
17
|
+
@scenario = CucumberFM::FeatureElement::ScenarioOutline.new(@feature, raw)
|
18
|
+
@scenario.stub!(:parent_tags).and_return([])
|
19
|
+
end
|
20
|
+
it "should have access to feature" do
|
21
|
+
@scenario.feature.should == @feature
|
22
|
+
end
|
23
|
+
it "should parse tags" do
|
24
|
+
@scenario.tags.should == %w(@_todo @2 @hash @wow)
|
25
|
+
end
|
26
|
+
it "should parse estimation" do
|
27
|
+
@scenario.estimation.should == 2.0
|
28
|
+
end
|
29
|
+
it "should parse comments lines" do
|
30
|
+
CucumberFM::FeatureElement::Comment.should_receive(:new).with(@scenario, @comment)
|
31
|
+
CucumberFM::FeatureElement::Comment.should_receive(:new).with(@scenario, @comment1)
|
32
|
+
@scenario.should have(2).comments
|
33
|
+
end
|
34
|
+
it "should parse title" do
|
35
|
+
@scenario.title.should == @title
|
36
|
+
end
|
37
|
+
# it "should parse steps"
|
38
|
+
# it "should parse example outline"
|
39
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CucumberFM::FeatureElement::Scenario do
|
4
|
+
before(:each) do
|
5
|
+
raw = %Q{#{@comment = "## wireframe::http://somelink"}
|
6
|
+
|
7
|
+
@_todo @2.5 @hash @wow
|
8
|
+
Scenario: #{@title = "Creating filter: scope"}
|
9
|
+
When I follow "New system user"
|
10
|
+
And I fill in "password" for "Password Confirmation"}
|
11
|
+
@feature = CucumberFM::Feature.new('fake_path')
|
12
|
+
@scenario = CucumberFM::FeatureElement::Scenario.new(@feature, raw)
|
13
|
+
@scenario.stub!(:parent_tags).and_return(['@mc', '@_done', '@aaa', '@4.5'])
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have access to feature" do
|
17
|
+
@scenario.feature.should == @feature
|
18
|
+
end
|
19
|
+
it "should parse tags" do
|
20
|
+
@scenario.tags.should == %w(@_todo @2.5 @hash @wow)
|
21
|
+
end
|
22
|
+
it "should parse comments lines" do
|
23
|
+
CucumberFM::FeatureElement::Comment.should_receive(:new).with(@scenario, @comment)
|
24
|
+
@scenario.should have(1).comments
|
25
|
+
end
|
26
|
+
it "should parse title" do
|
27
|
+
@scenario.title.should == @title
|
28
|
+
end
|
29
|
+
it "should parse estimation" do
|
30
|
+
@scenario.estimation.should == 2.5
|
31
|
+
end
|
32
|
+
# it "should parse steps"
|
33
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Cucumber::FeatureElement::Component::Tags" do
|
4
|
+
before(:all) do
|
5
|
+
class TagTesting
|
6
|
+
include CucumberFM::FeatureElement::Component::Tags
|
7
|
+
end
|
8
|
+
end
|
9
|
+
before(:each) do
|
10
|
+
@test = TagTesting.new
|
11
|
+
end
|
12
|
+
it "should find all tags without duplication" do
|
13
|
+
@test.stub!(:raw).and_return("@aa @bb @24343 @dd")
|
14
|
+
@test.stub!(:parent_tags).and_return(['@mc', '@_done', '@component', '@4.5'])
|
15
|
+
@test.tags.should == %w(@aa @bb @24343 @dd @_done @component )
|
16
|
+
end
|
17
|
+
|
18
|
+
context "without need to look in feature" do
|
19
|
+
before(:each) do
|
20
|
+
@test.stub!(:raw).and_return("@user @m2 @_done @__forums @5 @_3 @mc @i1 @p4 @$_admin")
|
21
|
+
@test.stub!(:parent_tags).and_return(['@tb', '@_wip', '@m2b', '@4.5',
|
22
|
+
'@__knowledge_base', '@_8', '@knowledge_base'])
|
23
|
+
end
|
24
|
+
{
|
25
|
+
:component => '@user',
|
26
|
+
:milestone => '@m2',
|
27
|
+
:status => '@_done',
|
28
|
+
:bucket => '@__forums',
|
29
|
+
:estimation => 5.0,
|
30
|
+
:value => 3,
|
31
|
+
:developer => '@mc',
|
32
|
+
:iteration => '@i1',
|
33
|
+
:priority => '@p4',
|
34
|
+
:role => '@$_admin'
|
35
|
+
}.each do |tag, value|
|
36
|
+
it "should scan #{tag} with #{value}" do
|
37
|
+
@test.send(tag).should == value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# TODO it should removes duplication - tags from the same type if they are present in scenario
|
43
|
+
context "from feature" do
|
44
|
+
before(:each) do
|
45
|
+
@test.stub!(:raw).and_return("@javascript @mongo")
|
46
|
+
@test.stub!(:parent_tags).and_return(['@tb', '@_wip', '@m2b', '@4.5',
|
47
|
+
'@__knowledge_base', '@_8', '@knowledge_base'])
|
48
|
+
end
|
49
|
+
{
|
50
|
+
:component => '@knowledge_base',
|
51
|
+
:milestone => '@m2b',
|
52
|
+
:status => '@_wip',
|
53
|
+
:bucket => '@__knowledge_base',
|
54
|
+
:estimation => 4.5,
|
55
|
+
:value => 8,
|
56
|
+
:developer => '@tb'
|
57
|
+
}.each do |tag, value|
|
58
|
+
it "should scan #{tag} with #{value}" do
|
59
|
+
@test.send(tag).should == value
|
60
|
+
end
|
61
|
+
end
|
62
|
+
it { @test.done?.should be_false }
|
63
|
+
end
|
64
|
+
|
65
|
+
context "scenario tags without duplicates" do
|
66
|
+
|
67
|
+
before(:each) do
|
68
|
+
@test.stub!(:raw).and_return("@mc @m2 @__ads @p1 @i2")
|
69
|
+
@test.stub!(:parent_tags).and_return(['@tb', '@_done', '@m2b', '@4.5',
|
70
|
+
'@__knowledge_base', '@_8', '@knowledge_base'])
|
71
|
+
end
|
72
|
+
['@tb', '@m2b', '@__knowledge_base'].each do |tag|
|
73
|
+
it "should not include tag: #{tag}" do
|
74
|
+
@test.tags.should_not include(tag)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
it "should return 9 tags" do
|
78
|
+
@test.should have(9).tags
|
79
|
+
end
|
80
|
+
it { @test.done?.should be_true }
|
81
|
+
end
|
82
|
+
|
83
|
+
context "tag detecting"
|
84
|
+
|
85
|
+
context "tags without technical" do
|
86
|
+
before(:each) do
|
87
|
+
@test.stub!(:raw).and_return("@aa @selenium @bb @24343 @dd @nontestable")
|
88
|
+
|
89
|
+
end
|
90
|
+
it "should clean up all technical tags" do
|
91
|
+
%w(@selenium @nontestable).each do |tag|
|
92
|
+
@test.tags_without_technical.should_not include(tag)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,229 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CucumberFM::Feature do
|
4
|
+
it "should store path for file" do
|
5
|
+
path = "some_path_to_my.feature"
|
6
|
+
feature = CucumberFM::Feature.new(path)
|
7
|
+
feature.path.should == path
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return filename" do
|
11
|
+
path = "/somedir/andanother/some_path_to_my.feature"
|
12
|
+
feature = CucumberFM::Feature.new(path)
|
13
|
+
feature.filename.should == 'some_path_to_my.feature'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return filename without extension" do
|
17
|
+
path = "/somedir/andanother/some_path_to_my.feature"
|
18
|
+
feature = CucumberFM::Feature.new(path)
|
19
|
+
feature.filename_without_extension.should == 'some_path_to_my'
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should load file content" do
|
23
|
+
feature = CucumberFM::Feature.new('spec/data/cucumber_f_m/feature/first.feature')
|
24
|
+
feature.raw.should == %q{Feature: Edit feature content
|
25
|
+
To update requirement for project
|
26
|
+
product owner
|
27
|
+
should be able to change feature content
|
28
|
+
|
29
|
+
Scenario: Inserting Background
|
30
|
+
|
31
|
+
Scenario: Inserting Scenario when cursor on text field
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "PARSING" do
|
36
|
+
before(:each) do
|
37
|
+
subject { CucumberFM::Feature.new('some_path') }
|
38
|
+
subject.stub(:raw).and_return(FEATURE_CONTENT)
|
39
|
+
cfm = mock(:cfm)
|
40
|
+
filter = CucumberFM::TagFilter.new('')
|
41
|
+
cfm.stub(:filter).and_return(filter)
|
42
|
+
subject.stub(:cfm).and_return(cfm)
|
43
|
+
end
|
44
|
+
it "should parse feature info" do
|
45
|
+
CucumberFM::FeatureElement::Info.should_receive(:new).with(subject, INFO_CONTENT)
|
46
|
+
subject.info
|
47
|
+
end
|
48
|
+
it "should parse background" do
|
49
|
+
CucumberFM::FeatureElement::Background.should_receive(:new).with(subject, BACKGROUND_CONTENT)
|
50
|
+
subject.background
|
51
|
+
end
|
52
|
+
|
53
|
+
# SKIP bug in rspec
|
54
|
+
# it "should parse scenarios" do
|
55
|
+
# CucumberFM::FeatureElement::Scenario.should_receive(:new).with(subject, SCENARIO_CONTENT)
|
56
|
+
# subject.scenarios
|
57
|
+
# end
|
58
|
+
# it "should parse scenario outlines" do
|
59
|
+
# CucumberFM::FeatureElement::ScenarioOutline.should_receive(:new).with(subject, SCENARIO_OUTLINE)
|
60
|
+
# subject.scenarios
|
61
|
+
# end
|
62
|
+
|
63
|
+
it "should parse two scenarios" do
|
64
|
+
subject.should have(2).scenarios
|
65
|
+
end
|
66
|
+
context "TAGS" do
|
67
|
+
specify { should have(2).tags }
|
68
|
+
specify { subject.tags.should == %w( @tag @mc ) }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "WRITING" do
|
73
|
+
# TODO
|
74
|
+
# it "should compact file content"
|
75
|
+
it "should write content to file" do
|
76
|
+
@feature = CucumberFM::Feature.new('tmp/some.feature')
|
77
|
+
@feature.stub!(:raw).and_return("Some Content")
|
78
|
+
@feature.save
|
79
|
+
File.open('tmp/some.feature', 'r') { |stream| stream.read.should == "Some Content" }
|
80
|
+
|
81
|
+
# claenup
|
82
|
+
File.delete('tmp/some.feature')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "ESTIMATION" do
|
87
|
+
before(:each) do
|
88
|
+
subject { CucumberFM::Feature.new('some_path') }
|
89
|
+
subject.stub(:raw).and_return(FEATURE_CONTENT)
|
90
|
+
cfm = mock(:cfm)
|
91
|
+
filter = CucumberFM::TagFilter.new('')
|
92
|
+
cfm.stub!(:filter).and_return(filter)
|
93
|
+
subject.stub(:cfm).and_return(cfm)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should compute correct total estimation" do
|
97
|
+
subject.estimation.should == 8.25
|
98
|
+
end
|
99
|
+
end
|
100
|
+
context "PATH & ID" do
|
101
|
+
before(:each) do
|
102
|
+
cfm = mock('cfm', :path => "/some/path/features")
|
103
|
+
@feature = CucumberFM::Feature.new("/some/path/features/one/user_login.feature", cfm)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should return relative path based on cfm path" do
|
107
|
+
@feature.relative_path.should == "one/user_login.feature"
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should return id (base64 encode relative path)" do
|
111
|
+
@feature.id.should == Base64.encode64("one/user_login.feature")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
context "CVS TRIGGER" do
|
117
|
+
context "on default config values" do
|
118
|
+
before(:each) do
|
119
|
+
cfm = mock('cfm', :send_to_remote => true, :commit_change_on => true, :config => CucumberFM::Config.new)
|
120
|
+
@feature = CucumberFM::Feature.new("", cfm)
|
121
|
+
end
|
122
|
+
it "should do commit" do
|
123
|
+
@feature.send(:do_commit?).should be_true
|
124
|
+
end
|
125
|
+
it "should do push" do
|
126
|
+
@feature.send(:do_push?).should be_true
|
127
|
+
end
|
128
|
+
end
|
129
|
+
context "when push is set to false" do
|
130
|
+
before(:each) do
|
131
|
+
cfm = mock('cfm', :send_to_remote => true, :commit_change_on => true,
|
132
|
+
:config => CucumberFM::Config.new({:cvs_push => '0'}))
|
133
|
+
@feature = CucumberFM::Feature.new("", cfm)
|
134
|
+
end
|
135
|
+
it "should do commit" do
|
136
|
+
@feature.send(:do_commit?).should be_true
|
137
|
+
end
|
138
|
+
it "should skip push" do
|
139
|
+
@feature.send(:do_push?).should be_false
|
140
|
+
end
|
141
|
+
end
|
142
|
+
context "when only commit is set to false" do
|
143
|
+
before(:each) do
|
144
|
+
cfm = mock('cfm', :send_to_remote => true, :commit_change_on => true,
|
145
|
+
:config => CucumberFM::Config.new({:cvs_commit => '0'}))
|
146
|
+
@feature = CucumberFM::Feature.new("", cfm)
|
147
|
+
end
|
148
|
+
it "should skip commit" do
|
149
|
+
@feature.send(:do_commit?).should be_false
|
150
|
+
end
|
151
|
+
it "should skip push" do
|
152
|
+
@feature.send(:do_push?).should be_false
|
153
|
+
end
|
154
|
+
end
|
155
|
+
context "when only commit and push are set to false" do
|
156
|
+
before(:each) do
|
157
|
+
cfm = mock('cfm', :send_to_remote => true, :commit_change_on => true,
|
158
|
+
:config => CucumberFM::Config.new({:cvs_commit => '0', :cvs_push => '0'}))
|
159
|
+
@feature = CucumberFM::Feature.new("", cfm)
|
160
|
+
end
|
161
|
+
it "should skip commit" do
|
162
|
+
@feature.send(:do_commit?).should be_false
|
163
|
+
end
|
164
|
+
it "should skip push" do
|
165
|
+
@feature.send(:do_push?).should be_false
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
INFO_CONTENT = <<EOF
|
174
|
+
# some comment
|
175
|
+
#:::wireframe::: http://cs3b.com
|
176
|
+
|
177
|
+
@tag @mc
|
178
|
+
Feature: Tag filter
|
179
|
+
In order to fetch only scenarios that i want
|
180
|
+
as project manager, developer
|
181
|
+
I want to be able to create filter scope
|
182
|
+
EOF
|
183
|
+
|
184
|
+
BACKGROUND_CONTENT = <<EOF
|
185
|
+
Background: I am logged in as user admin
|
186
|
+
Given system user "t_a@hp.mc/secret" with role "locale"
|
187
|
+
And system user "p_e@hp.mc/secret" with role "product"
|
188
|
+
And signed up with "not_system_user@hp.mc/secret"
|
189
|
+
And I sign in as "admin@hearingpages.com/SxSUYGiEPi"
|
190
|
+
And user "admin@hearingpages.com" has assigned role "sys_user"
|
191
|
+
And I am on system user administration page
|
192
|
+
EOF
|
193
|
+
|
194
|
+
SCENARIO_CONTENT = <<EOF
|
195
|
+
#:::wireframe::: http://somelink
|
196
|
+
|
197
|
+
@_todo @5.25
|
198
|
+
Scenario: Creating filter scope
|
199
|
+
When I follow "New system user"
|
200
|
+
And I fill in "systemuser@hp.mc" for "Email"
|
201
|
+
And I fill in "password" for "Password"
|
202
|
+
And I fill in "password" for "Password Confirmation"
|
203
|
+
And I fill in "password" for "Password Confirmation"
|
204
|
+
EOF
|
205
|
+
|
206
|
+
SCENARIO_OUTLINE = <<EOF
|
207
|
+
# some comment about below filter
|
208
|
+
|
209
|
+
@_todo @3
|
210
|
+
Scenario Outline: Selecting filter scope as active
|
211
|
+
|
212
|
+
Examples:
|
213
|
+
|id |email |roles |
|
214
|
+
|5 |some@oo.com |admin |
|
215
|
+
EOF
|
216
|
+
|
217
|
+
FEATURE_CONTENT = <<EOF
|
218
|
+
#{INFO_CONTENT}
|
219
|
+
|
220
|
+
#{BACKGROUND_CONTENT}
|
221
|
+
|
222
|
+
#{SCENARIO_OUTLINE}
|
223
|
+
|
224
|
+
#{SCENARIO_CONTENT}
|
225
|
+
|
226
|
+
EOF
|
227
|
+
|
228
|
+
|
229
|
+
|