alf 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +89 -0
- data/Gemfile.lock +6 -1
- data/README.md +35 -21
- data/TODO.md +0 -5
- data/alf.gemspec +2 -0
- data/alf.noespec +6 -4
- data/bin/alf +9 -13
- data/examples/{autonum.alf → operators/autonum.alf} +0 -0
- data/examples/{cities.rash → operators/cities.rash} +0 -0
- data/examples/{clip.alf → operators/clip.alf} +0 -0
- data/examples/{compact.alf → operators/compact.alf} +0 -0
- data/examples/{database.alf → operators/database.alf} +1 -1
- data/examples/{defaults.alf → operators/defaults.alf} +0 -0
- data/examples/{extend.alf → operators/extend.alf} +0 -0
- data/examples/{group.alf → operators/group.alf} +0 -0
- data/examples/{intersect.alf → operators/intersect.alf} +0 -0
- data/examples/{join.alf → operators/join.alf} +0 -0
- data/examples/operators/matching.alf +2 -0
- data/examples/{minus.alf → operators/minus.alf} +0 -0
- data/examples/operators/not_matching.alf +2 -0
- data/examples/{nulls.rash → operators/nulls.rash} +0 -0
- data/examples/{parts.rash → operators/parts.rash} +0 -0
- data/examples/{project.alf → operators/project.alf} +0 -0
- data/examples/{pseudo-with.alf → operators/pseudo-with.alf} +0 -0
- data/examples/{quota.alf → operators/quota.alf} +0 -0
- data/examples/operators/rank.alf +4 -0
- data/examples/{rename.alf → operators/rename.alf} +0 -0
- data/examples/{restrict.alf → operators/restrict.alf} +0 -0
- data/examples/{schema.yaml → operators/schema.yaml} +0 -0
- data/examples/{sort.alf → operators/sort.alf} +0 -0
- data/examples/{summarize.alf → operators/summarize.alf} +0 -0
- data/examples/{suppliers.rash → operators/suppliers.rash} +0 -0
- data/examples/{supplies.rash → operators/supplies.rash} +0 -0
- data/examples/{ungroup.alf → operators/ungroup.alf} +0 -0
- data/examples/{union.alf → operators/union.alf} +0 -0
- data/examples/{unwrap.alf → operators/unwrap.alf} +0 -0
- data/examples/{wrap.alf → operators/wrap.alf} +0 -0
- data/lib/alf.rb +837 -62
- data/lib/alf/loader.rb +2 -1
- data/lib/alf/text.rb +160 -0
- data/lib/alf/version.rb +1 -1
- data/lib/alf/yaml.rb +24 -0
- data/spec/integration/__database__/group.alf +3 -0
- data/spec/integration/__database__/parts.rash +6 -0
- data/spec/integration/__database__/suppliers.rash +5 -0
- data/spec/integration/__database__/supplies.rash +12 -0
- data/spec/integration/command/alf/alf_e.cmd +1 -0
- data/spec/integration/command/alf/alf_e.stdout +4 -0
- data/spec/integration/command/alf/alf_env.cmd +1 -0
- data/spec/integration/command/alf/alf_env.stdout +5 -0
- data/spec/integration/command/alf/alf_implicit.alf +1 -0
- data/spec/integration/command/alf/alf_implicit_exec.cmd +1 -0
- data/spec/integration/command/alf/alf_implicit_exec.stdout +4 -0
- data/spec/integration/command/alf/alf_r.cmd +1 -0
- data/spec/integration/command/alf/alf_r.stdout +5 -0
- data/spec/integration/command/alf/alf_version.cmd +1 -0
- data/spec/integration/command/alf/alf_version.stdout +2 -0
- data/spec/integration/command/alf/alf_yaml.cmd +1 -0
- data/spec/integration/command/alf/alf_yaml.stdout +22 -0
- data/spec/integration/command/alf/rel.rash +1 -0
- data/spec/integration/command/autonum/autonum_0.cmd +1 -0
- data/spec/integration/command/autonum/autonum_0.stdout +9 -0
- data/spec/integration/command/autonum/autonum_1.cmd +1 -0
- data/spec/integration/command/autonum/autonum_1.stdout +9 -0
- data/spec/integration/command/clip/clip_0.cmd +1 -0
- data/spec/integration/command/clip/clip_0.stdout +9 -0
- data/spec/integration/command/clip/clip_1.cmd +1 -0
- data/spec/integration/command/clip/clip_1.stdout +9 -0
- data/spec/integration/command/compact/compact_0.cmd +1 -0
- data/spec/integration/command/compact/compact_0.stdout +9 -0
- data/spec/integration/command/defaults/defaults_0.cmd +1 -0
- data/spec/integration/command/defaults/defaults_0.stdout +9 -0
- data/spec/integration/command/defaults/defaults_1.cmd +1 -0
- data/spec/integration/command/defaults/defaults_1.stdout +9 -0
- data/spec/integration/command/extend/extend_0.cmd +1 -0
- data/spec/integration/command/extend/extend_0.stdout +16 -0
- data/spec/integration/command/group/group_0.cmd +1 -0
- data/spec/integration/command/group/group_0.stdout +32 -0
- data/spec/integration/command/group/group_1.cmd +1 -0
- data/spec/integration/command/group/group_1.stdout +32 -0
- data/spec/integration/command/intersect/intersect_0.cmd +1 -0
- data/spec/integration/command/intersect/intersect_0.stdout +9 -0
- data/spec/integration/command/join/join_0.cmd +1 -0
- data/spec/integration/command/join/join_0.stdout +16 -0
- data/spec/integration/command/matching/matching_0.cmd +1 -0
- data/spec/integration/command/matching/matching_0.stdout +8 -0
- data/spec/integration/command/minus/minus_0.cmd +1 -0
- data/spec/integration/command/minus/minus_0.stdout +4 -0
- data/spec/integration/command/not-matching/not-matching_0.cmd +1 -0
- data/spec/integration/command/not-matching/not-matching_0.stdout +5 -0
- data/spec/integration/command/project/project_0.cmd +1 -0
- data/spec/integration/command/project/project_0.stdout +9 -0
- data/spec/integration/command/project/project_1.cmd +1 -0
- data/spec/integration/command/project/project_1.stdout +9 -0
- data/spec/integration/command/quota/quota_0.cmd +1 -0
- data/spec/integration/command/quota/quota_0.stdout +16 -0
- data/spec/integration/command/rank/rank_1.cmd +1 -0
- data/spec/integration/command/rank/rank_1.stdout +10 -0
- data/spec/integration/command/rank/rank_2.cmd +1 -0
- data/spec/integration/command/rank/rank_2.stdout +10 -0
- data/spec/integration/command/rank/rank_3.cmd +1 -0
- data/spec/integration/command/rank/rank_3.stdout +10 -0
- data/spec/integration/command/rank/rank_4.cmd +1 -0
- data/spec/integration/command/rank/rank_4.stdout +6 -0
- data/spec/integration/command/rank/rank_5.cmd +1 -0
- data/spec/integration/command/rank/rank_5.stdout +6 -0
- data/spec/integration/command/rename/rename_0.cmd +1 -0
- data/spec/integration/command/rename/rename_0.stdout +9 -0
- data/spec/integration/command/restrict/restrict_0.cmd +1 -0
- data/spec/integration/command/restrict/restrict_0.stdout +6 -0
- data/spec/integration/command/restrict/restrict_1.cmd +1 -0
- data/spec/integration/command/restrict/restrict_1.stdout +6 -0
- data/spec/integration/command/show/show_base.cmd +1 -0
- data/spec/integration/command/show/show_base.stdout +9 -0
- data/spec/integration/command/show/show_conflictual.cmd +1 -0
- data/spec/integration/command/show/show_conflictual.stdout +5 -0
- data/spec/integration/command/show/show_rash.cmd +1 -0
- data/spec/integration/command/show/show_rash.stdout +5 -0
- data/spec/integration/command/show/show_rash_2.cmd +1 -0
- data/spec/integration/command/show/show_rash_2.stdout +5 -0
- data/spec/integration/command/show/show_yaml.cmd +1 -0
- data/spec/integration/command/show/show_yaml.stdout +22 -0
- data/spec/integration/command/sort/sort_0.cmd +1 -0
- data/spec/integration/command/sort/sort_0.stdout +9 -0
- data/spec/integration/command/sort/sort_1.cmd +1 -0
- data/spec/integration/command/sort/sort_1.stdout +9 -0
- data/spec/integration/command/summarize/summarize_0.cmd +1 -0
- data/spec/integration/command/summarize/summarize_0.stdout +8 -0
- data/spec/integration/command/ungroup/ungroup_0.cmd +1 -0
- data/spec/integration/command/ungroup/ungroup_0.stdout +16 -0
- data/spec/integration/command/union/union_0.cmd +1 -0
- data/spec/integration/command/union/union_0.stdout +9 -0
- data/spec/integration/command/unwrap/unwrap_0.cmd +1 -0
- data/spec/integration/command/unwrap/unwrap_0.stdout +9 -0
- data/spec/integration/command/wrap/wrap_0.cmd +1 -0
- data/spec/integration/command/wrap/wrap_0.stdout +9 -0
- data/spec/integration/semantics/test_join.alf +9 -0
- data/spec/integration/{src → semantics}/test_minus.alf +0 -0
- data/spec/integration/{src → semantics}/test_project.alf +0 -0
- data/spec/integration/semantics/test_rank.alf +34 -0
- data/spec/integration/test_command.rb +36 -0
- data/spec/integration/test_examples.rb +11 -22
- data/spec/integration/test_semantics.rb +40 -0
- data/spec/regression/alf_file/__FILE__.alf +2 -0
- data/spec/regression/alf_file/suppliers.rash +5 -0
- data/spec/regression/alf_file/test___FILE__.rb +17 -0
- data/spec/regression/heading/test_heading_with_date.rb +12 -0
- data/spec/regression/lispy/test_compile.rb +14 -0
- data/spec/regression/relation/test_relation_with_date.rb +12 -0
- data/spec/regression/restrict/test_restrict_with_keywords.rb +17 -0
- data/spec/shared/a_value.rb +12 -0
- data/spec/shared/an_operator_class.rb +35 -0
- data/spec/spec_helper.rb +12 -34
- data/spec/unit/assumptions/test_file.rb +17 -0
- data/spec/unit/{test_assumptions.rb → assumptions/test_instance_eval.rb} +1 -1
- data/spec/unit/assumptions/test_scoping.rb +29 -0
- data/spec/unit/environment/test_folder.rb +6 -1
- data/spec/unit/operator/relational/matching/test_hash_based.rb +60 -0
- data/spec/unit/operator/relational/not_matching/test_hash_based.rb +37 -0
- data/spec/unit/operator/relational/test_rank.rb +50 -0
- data/spec/unit/operator/test_relational.rb +3 -0
- data/spec/unit/reader/test_alf_file.rb +7 -4
- data/spec/unit/reader/test_initialize.rb +60 -0
- data/spec/unit/relation/test_relops.rb +4 -0
- data/spec/unit/relation/test_to_a.rb +41 -0
- data/spec/unit/renderer/test_initialize.rb +60 -0
- data/spec/unit/test_environment.rb +38 -0
- data/spec/unit/test_heading.rb +38 -0
- data/spec/unit/test_reader.rb +5 -0
- data/spec/unit/test_relation.rb +31 -1
- data/spec/unit/test_renderer.rb +1 -1
- data/spec/unit/{renderer/text → text}/test_cell.rb +1 -1
- data/spec/unit/{renderer/text → text}/test_row.rb +1 -1
- data/spec/unit/{renderer/text → text}/test_table.rb +1 -1
- data/spec/unit/tools/test_ordering_key.rb +13 -0
- data/spec/unit/tools/test_parse_commandline_args.rb +47 -0
- data/spec/unit/tools/test_tuple_handle.rb +34 -2
- data/spec/unit/tools/test_varargs.rb +16 -0
- data/tasks/{spec_test.rake → integration_test.rake} +4 -32
- data/tasks/regression_test.rake +52 -0
- data/tasks/unit_test.rake +33 -58
- metadata +326 -66
- data/examples/runall.sh +0 -26
- data/lib/alf/relation.rb +0 -118
- data/lib/alf/renderer/text.rb +0 -153
- data/lib/alf/renderer/yaml.rb +0 -22
- data/spec/integration/test_alf_specs.rb +0 -37
data/spec/unit/test_reader.rb
CHANGED
data/spec/unit/test_relation.rb
CHANGED
|
@@ -12,10 +12,15 @@ module Alf
|
|
|
12
12
|
let(:rel1){ Relation.new(tuples.to_set) }
|
|
13
13
|
let(:rel2){ Relation.new(tuples2.to_set) }
|
|
14
14
|
let(:rel3){ Relation.new(tuples[0..1].to_set) }
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
it "should have a cardinality method" do
|
|
17
17
|
rel1.cardinality.should == 3
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
it "should have an empty? method" do
|
|
21
|
+
Alf::Relation[].should be_empty
|
|
22
|
+
rel1.should_not be_empty
|
|
23
|
+
end
|
|
19
24
|
|
|
20
25
|
it "should define == correctly" do
|
|
21
26
|
rel1.should == rel2
|
|
@@ -35,6 +40,31 @@ module Alf
|
|
|
35
40
|
it "should be enumerable" do
|
|
36
41
|
rel1.to_a.sort{|t1,t2| t1[:sid] <=> t2[:sid]}.should == tuples
|
|
37
42
|
end
|
|
43
|
+
|
|
44
|
+
describe "rel1" do
|
|
45
|
+
subject{ rel1 }
|
|
46
|
+
it_should_behave_like "A value"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe "DUM" do
|
|
50
|
+
subject{ Relation::DUM }
|
|
51
|
+
it_should_behave_like "A value"
|
|
52
|
+
specify{
|
|
53
|
+
subject.cardinality.should == 0
|
|
54
|
+
subject.to_a.should == []
|
|
55
|
+
subject.should be_empty
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe "DEE" do
|
|
60
|
+
subject{ Relation::DEE }
|
|
61
|
+
it_should_behave_like "A value"
|
|
62
|
+
specify{
|
|
63
|
+
subject.cardinality.should == 1
|
|
64
|
+
subject.to_a.should == [{}]
|
|
65
|
+
subject.should_not be_empty
|
|
66
|
+
}
|
|
67
|
+
end
|
|
38
68
|
|
|
39
69
|
end
|
|
40
70
|
end
|
data/spec/unit/test_renderer.rb
CHANGED
|
@@ -19,6 +19,19 @@ module Alf
|
|
|
19
19
|
key.order_of(:b).should == :asc
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
specify "when passed a single array with asc and desc (1)" do
|
|
23
|
+
key = OrderingKey.coerce [:a, :asc]
|
|
24
|
+
key.attributes.should == [:a]
|
|
25
|
+
key.order_of(:a).should == :asc
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
specify "when passed a single array with asc and desc (1)" do
|
|
29
|
+
key = OrderingKey.coerce [:a, :asc, :b, :desc]
|
|
30
|
+
key.attributes.should == [:a, :b]
|
|
31
|
+
key.order_of(:a).should == :asc
|
|
32
|
+
key.order_of(:b).should == :desc
|
|
33
|
+
end
|
|
34
|
+
|
|
22
35
|
specify "when passed an ordering key" do
|
|
23
36
|
key = OrderingKey.coerce [:a, :b]
|
|
24
37
|
key2 = OrderingKey.coerce key
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
module Alf
|
|
3
|
+
describe "Tools#parse_commandline_args" do
|
|
4
|
+
|
|
5
|
+
subject{ Tools.parse_commandline_args(args) }
|
|
6
|
+
|
|
7
|
+
describe "on empty string" do
|
|
8
|
+
let(:args){ "" }
|
|
9
|
+
it { should eq([]) }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe "on pseudo empty string" do
|
|
13
|
+
let(:args){ " " }
|
|
14
|
+
it { should eq([]) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe "on a single arg" do
|
|
18
|
+
let(:args){ "--text" }
|
|
19
|
+
it { should eq(["--text"]) }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe "on a multiple args" do
|
|
23
|
+
let(:args){ "--text --size=10" }
|
|
24
|
+
it { should eq(["--text", "--size=10"]) }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "on single quoted arg" do
|
|
28
|
+
let(:args){ "'hello'" }
|
|
29
|
+
it { should eq(["hello"]) }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe "on single quoted arg with spacing" do
|
|
33
|
+
let(:args){ "'hello the world'" }
|
|
34
|
+
it { should eq(["hello the world"]) }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe "on double quoted arg" do
|
|
38
|
+
let(:args){ '"hello"' }
|
|
39
|
+
it { should eq(["hello"]) }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe "on double quoted arg with spacing" do
|
|
43
|
+
let(:args){ "'hello the world'" }
|
|
44
|
+
it { should eq(['hello the world']) }
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -11,7 +11,7 @@ module Alf
|
|
|
11
11
|
handle.should respond_to(:world)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
it "
|
|
14
|
+
it "should behave correctly" do
|
|
15
15
|
handle.set(:hello => "a", :world => "b")
|
|
16
16
|
handle.hello.should == "a"
|
|
17
17
|
handle.world.should == "b"
|
|
@@ -20,11 +20,16 @@ module Alf
|
|
|
20
20
|
handle.world.should == "d"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
it "should allow instance
|
|
23
|
+
it "should allow instance evaluating on exprs" do
|
|
24
24
|
handle.set(:tested => 1)
|
|
25
25
|
handle.instance_eval{ tested < 1 }.should be_false
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
it "should support an attribute called :path" do
|
|
29
|
+
handle.set(:path => 1)
|
|
30
|
+
handle.instance_eval{ path < 1 }.should be_false
|
|
31
|
+
end
|
|
32
|
+
|
|
28
33
|
describe "compile" do
|
|
29
34
|
|
|
30
35
|
it "should return a Proc when passed a string" do
|
|
@@ -35,6 +40,33 @@ module Alf
|
|
|
35
40
|
x = lambda{ true }
|
|
36
41
|
TupleHandle.compile(x).should == x
|
|
37
42
|
end
|
|
43
|
+
|
|
44
|
+
it "should support an empty Hash" do
|
|
45
|
+
pred = TupleHandle.compile({})
|
|
46
|
+
pred.call.should be_true
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should support a Hash" do
|
|
50
|
+
pred = TupleHandle.compile({:status => 10})
|
|
51
|
+
handle = TupleHandle.new
|
|
52
|
+
handle.set({:status => 20}).evaluate(pred).should be_false
|
|
53
|
+
handle.set({:status => 10}).evaluate(pred).should be_true
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "should support a Hash using keywords as attribute names" do
|
|
57
|
+
pred = TupleHandle.compile({:when => 10})
|
|
58
|
+
handle = TupleHandle.new
|
|
59
|
+
handle.set({:when => 20}).evaluate(pred).should be_false
|
|
60
|
+
handle.set({:when => 10}).evaluate(pred).should be_true
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "should support a Hash containing a Date" do
|
|
64
|
+
today = Date.today
|
|
65
|
+
pred = TupleHandle.compile({:at => today})
|
|
66
|
+
handle = TupleHandle.new
|
|
67
|
+
handle.set({:at => today}).evaluate(pred).should be_true
|
|
68
|
+
handle.set({:at => today+1}).evaluate(pred).should be_false
|
|
69
|
+
end
|
|
38
70
|
|
|
39
71
|
end
|
|
40
72
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
module Alf
|
|
3
|
+
describe "Tools#varargs" do
|
|
4
|
+
|
|
5
|
+
specify "with exact args" do
|
|
6
|
+
Tools.varargs([1, "hello"], [Integer, String]).should eq([1, "hello"])
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
specify "with missing args" do
|
|
10
|
+
Tools.varargs(["hello"], [Integer, String]).should eq([nil, "hello"])
|
|
11
|
+
Tools.varargs([], [Integer, String]).should eq([nil, nil])
|
|
12
|
+
Tools.varargs([1, 2], [Integer, String, Integer]).should eq([1, nil, 2])
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -1,36 +1,9 @@
|
|
|
1
|
-
# Installs a rake task for for running examples written using rspec.
|
|
2
|
-
#
|
|
3
|
-
# This file installs the 'rake spec_test' (aliased as 'rake spec') as well as
|
|
4
|
-
# extends 'rake test' to run spec tests, if any. It is automatically generated
|
|
5
|
-
# by Noe from your .noespec file, and should therefore be configured there,
|
|
6
|
-
# under the variables/rake_tasks/spec_test entry, as illustrated below:
|
|
7
|
-
#
|
|
8
|
-
# variables:
|
|
9
|
-
# rake_tasks:
|
|
10
|
-
# spec_test:
|
|
11
|
-
# pattern: spec/**/*_spec.rb
|
|
12
|
-
# verbose: true
|
|
13
|
-
# rspec_opts: [--color, --backtrace]
|
|
14
|
-
# ...
|
|
15
|
-
#
|
|
16
|
-
# If you have specific needs requiring manual intervention on this file,
|
|
17
|
-
# don't forget to set safe-override to false in your noe specification:
|
|
18
|
-
#
|
|
19
|
-
# template-info:
|
|
20
|
-
# manifest:
|
|
21
|
-
# tasks/spec_test.rake:
|
|
22
|
-
# safe-override: false
|
|
23
|
-
#
|
|
24
|
-
# This file has been written to conform to RSpec v2.4.0. More information about
|
|
25
|
-
# rspec and options of the rake task defined below can be found on
|
|
26
|
-
# http://relishapp.com/rspec
|
|
27
|
-
#
|
|
28
1
|
begin
|
|
29
2
|
require "rspec/core/rake_task"
|
|
30
3
|
desc "Run RSpec code examples"
|
|
31
|
-
RSpec::Core::RakeTask.new(:
|
|
4
|
+
RSpec::Core::RakeTask.new(:integration_test) do |t|
|
|
32
5
|
# Glob pattern to match files.
|
|
33
|
-
t.pattern = "spec/**/test_*.rb"
|
|
6
|
+
t.pattern = "spec/integration/**/test_*.rb"
|
|
34
7
|
|
|
35
8
|
# By default, if there is a Gemfile, the generated command will include
|
|
36
9
|
# 'bundle exec'. Set this to true to ignore the presence of a Gemfile,
|
|
@@ -70,10 +43,9 @@ begin
|
|
|
70
43
|
t.rspec_opts = ["--color", "--backtrace"]
|
|
71
44
|
end
|
|
72
45
|
rescue LoadError => ex
|
|
73
|
-
task :
|
|
46
|
+
task :integration_test do
|
|
74
47
|
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
|
75
48
|
end
|
|
76
49
|
ensure
|
|
77
|
-
task :
|
|
78
|
-
task :test => [:spec_test]
|
|
50
|
+
task :test => [:integration_test]
|
|
79
51
|
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require "rspec/core/rake_task"
|
|
3
|
+
desc "Run RSpec code examples"
|
|
4
|
+
RSpec::Core::RakeTask.new(:regression_test) do |t|
|
|
5
|
+
# Glob pattern to match files.
|
|
6
|
+
t.pattern = "spec/regression/**/test_*.rb"
|
|
7
|
+
|
|
8
|
+
# By default, if there is a Gemfile, the generated command will include
|
|
9
|
+
# 'bundle exec'. Set this to true to ignore the presence of a Gemfile,
|
|
10
|
+
# and not add 'bundle exec' to the command.
|
|
11
|
+
t.skip_bundler = false
|
|
12
|
+
|
|
13
|
+
# Name of Gemfile to use
|
|
14
|
+
t.gemfile = "Gemfile"
|
|
15
|
+
|
|
16
|
+
# Whether or not to fail Rake when an error occurs (typically when
|
|
17
|
+
# examples fail).
|
|
18
|
+
t.fail_on_error = true
|
|
19
|
+
|
|
20
|
+
# A message to print to stderr when there are failures.
|
|
21
|
+
t.failure_message = nil
|
|
22
|
+
|
|
23
|
+
# Use verbose output. If this is set to true, the task will print the
|
|
24
|
+
# executed spec command to stdout.
|
|
25
|
+
t.verbose = true
|
|
26
|
+
|
|
27
|
+
# Use rcov for code coverage?
|
|
28
|
+
t.rcov = false
|
|
29
|
+
|
|
30
|
+
# Path to rcov.
|
|
31
|
+
t.rcov_path = "rcov"
|
|
32
|
+
|
|
33
|
+
# Command line options to pass to rcov. See 'rcov --help' about this
|
|
34
|
+
t.rcov_opts = []
|
|
35
|
+
|
|
36
|
+
# Command line options to pass to ruby. See 'ruby --help' about this
|
|
37
|
+
t.ruby_opts = []
|
|
38
|
+
|
|
39
|
+
# Path to rspec
|
|
40
|
+
t.rspec_path = "rspec"
|
|
41
|
+
|
|
42
|
+
# Command line options to pass to rspec. See 'rspec --help' about this
|
|
43
|
+
t.rspec_opts = ["--color", "--backtrace"]
|
|
44
|
+
end
|
|
45
|
+
rescue LoadError => ex
|
|
46
|
+
task :regression_test do
|
|
47
|
+
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
|
48
|
+
end
|
|
49
|
+
ensure
|
|
50
|
+
task :spec => [:regression_test]
|
|
51
|
+
task :test => [:regression_test]
|
|
52
|
+
end
|
data/tasks/unit_test.rake
CHANGED
|
@@ -1,77 +1,52 @@
|
|
|
1
|
-
# Installs a rake task for for running unit tests.
|
|
2
|
-
#
|
|
3
|
-
# This file installs the 'rake unit_test' and extends 'rake test' to run unit
|
|
4
|
-
# tests, if any. It is automatically generated by Noe from your .noespec file,
|
|
5
|
-
# and should therefore be configured there, under the variables/rake_tasks/unit_test
|
|
6
|
-
# entry, as illustrated below:
|
|
7
|
-
#
|
|
8
|
-
# variables:
|
|
9
|
-
# rake_tasks:
|
|
10
|
-
# unit_test:
|
|
11
|
-
# pattern: test/test*.rb
|
|
12
|
-
# verbose: false
|
|
13
|
-
# warning: false
|
|
14
|
-
# ...
|
|
15
|
-
#
|
|
16
|
-
# If you have specific needs requiring manual intervention on this file,
|
|
17
|
-
# don't forget to set safe-override to false in your noe specification:
|
|
18
|
-
#
|
|
19
|
-
# template-info:
|
|
20
|
-
# manifest:
|
|
21
|
-
# tasks/unit_test.rake:
|
|
22
|
-
# safe-override: false
|
|
23
|
-
#
|
|
24
|
-
# More info about the TestTask and its options can be found on
|
|
25
|
-
# http://rake.rubyforge.org/classes/Rake/TestTask.html
|
|
26
|
-
#
|
|
27
1
|
begin
|
|
28
|
-
require
|
|
29
|
-
desc "Run
|
|
30
|
-
|
|
2
|
+
require "rspec/core/rake_task"
|
|
3
|
+
desc "Run RSpec code examples"
|
|
4
|
+
RSpec::Core::RakeTask.new(:unit_test) do |t|
|
|
5
|
+
# Glob pattern to match files.
|
|
6
|
+
t.pattern = "spec/unit/**/test_*.rb"
|
|
31
7
|
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
|
|
8
|
+
# By default, if there is a Gemfile, the generated command will include
|
|
9
|
+
# 'bundle exec'. Set this to true to ignore the presence of a Gemfile,
|
|
10
|
+
# and not add 'bundle exec' to the command.
|
|
11
|
+
t.skip_bundler = false
|
|
35
12
|
|
|
36
|
-
#
|
|
37
|
-
t.
|
|
13
|
+
# Name of Gemfile to use
|
|
14
|
+
t.gemfile = "Gemfile"
|
|
38
15
|
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
t.
|
|
16
|
+
# Whether or not to fail Rake when an error occurs (typically when
|
|
17
|
+
# examples fail).
|
|
18
|
+
t.fail_on_error = true
|
|
42
19
|
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
-
t.warning = false
|
|
20
|
+
# A message to print to stderr when there are failures.
|
|
21
|
+
t.failure_message = nil
|
|
46
22
|
|
|
47
|
-
#
|
|
48
|
-
|
|
23
|
+
# Use verbose output. If this is set to true, the task will print the
|
|
24
|
+
# executed spec command to stdout.
|
|
25
|
+
t.verbose = true
|
|
49
26
|
|
|
50
|
-
#
|
|
51
|
-
|
|
52
|
-
# * :rake -- Rake provided test loading script (default).
|
|
53
|
-
# * :testrb -- Ruby provided test loading script.
|
|
54
|
-
# * :direct -- Load tests using command line loader.
|
|
55
|
-
#
|
|
56
|
-
t.loader = :rake
|
|
27
|
+
# Use rcov for code coverage?
|
|
28
|
+
t.rcov = false
|
|
57
29
|
|
|
58
|
-
#
|
|
59
|
-
|
|
30
|
+
# Path to rcov.
|
|
31
|
+
t.rcov_path = "rcov"
|
|
32
|
+
|
|
33
|
+
# Command line options to pass to rcov. See 'rcov --help' about this
|
|
34
|
+
t.rcov_opts = []
|
|
35
|
+
|
|
36
|
+
# Command line options to pass to ruby. See 'ruby --help' about this
|
|
60
37
|
t.ruby_opts = []
|
|
61
38
|
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
# FileList is acceptable). If both +pattern+ and +test_files+ are
|
|
65
|
-
# used, then the list of test files is the union of the two.
|
|
66
|
-
t.test_files = nil
|
|
39
|
+
# Path to rspec
|
|
40
|
+
t.rspec_path = "rspec"
|
|
67
41
|
|
|
42
|
+
# Command line options to pass to rspec. See 'rspec --help' about this
|
|
43
|
+
t.rspec_opts = ["--color", "--backtrace"]
|
|
68
44
|
end
|
|
69
45
|
rescue LoadError => ex
|
|
70
46
|
task :unit_test do
|
|
71
47
|
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
|
72
48
|
end
|
|
73
49
|
ensure
|
|
74
|
-
|
|
50
|
+
task :spec => [:unit_test]
|
|
75
51
|
task :test => [:unit_test]
|
|
76
52
|
end
|
|
77
|
-
|