set_builder 2.0.0.beta2 → 2.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/Rakefile +2 -2
- data/init.rb +1 -1
- data/lib/assets/javascripts/set_builder.js +122 -125
- data/lib/set_builder/constraint.rb +66 -50
- data/lib/set_builder/errors/trait_not_found.rb +3 -0
- data/lib/set_builder/modifier/adverb.rb +4 -4
- data/lib/set_builder/modifier/base.rb +74 -67
- data/lib/set_builder/modifier/verb.rb +1 -16
- data/lib/set_builder/modifier.rb +49 -49
- data/lib/set_builder/modifier_collection.rb +16 -16
- data/lib/set_builder/modifiers/date_preposition.rb +6 -48
- data/lib/set_builder/modifiers/number_preposition.rb +4 -25
- data/lib/set_builder/modifiers/string_preposition.rb +9 -43
- data/lib/set_builder/modifiers.rb +3 -3
- data/lib/set_builder/set.rb +48 -8
- data/lib/set_builder/trait.rb +75 -49
- data/lib/set_builder/traits.rb +13 -4
- data/lib/set_builder/value_map.rb +30 -30
- data/lib/set_builder/version.rb +1 -1
- data/lib/set_builder.rb +8 -7
- data/set_builder.gemspec +4 -2
- data/spec/commands/example_command.rb +2 -2
- data/spec/lib/jspec.css +4 -4
- data/spec/lib/jspec.growl.js +11 -11
- data/spec/lib/jspec.jquery.js +14 -14
- data/spec/lib/jspec.js +210 -210
- data/spec/lib/jspec.nodejs.js +2 -2
- data/spec/lib/jspec.shell.js +11 -11
- data/spec/lib/jspec.timers.js +23 -23
- data/spec/rhino.js +1 -1
- data/spec/server.rb +1 -1
- data/spec/unit/array.spec.js +9 -9
- data/spec/unit/set_builder.spec.js +71 -82
- data/spec/unit/spec.helper.js +1 -0
- data/test/constraint_test.rb +84 -0
- data/test/date_preposition_test.rb +17 -7
- data/test/modifier_test.rb +26 -1
- data/test/set_test.rb +51 -28
- data/test/string_preposition_test.rb +10 -9
- data/test/test_helper.rb +17 -15
- data/test/trait_test.rb +49 -30
- data/test/traits_test.rb +35 -30
- data/test/value_map_test.rb +1 -1
- metadata +37 -15
- data/lib/set_builder/query_builders/string.rb +0 -0
- data/test/inflector_test.rb +0 -27
data/test/modifier_test.rb
CHANGED
@@ -1,9 +1,34 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class ModifierTest < ActiveSupport::TestCase
|
4
4
|
include SetBuilder::Modifiers
|
5
5
|
|
6
6
|
|
7
|
+
|
8
|
+
test "should be valid if `values` is omitted for an operator that expects no arguments" do
|
9
|
+
preposition = SetBuilder::Modifiers::DatePreposition.new(operator: "ever", values: [])
|
10
|
+
assert_equal [], preposition.values
|
11
|
+
assert preposition.valid?
|
12
|
+
|
13
|
+
preposition = SetBuilder::Modifiers::DatePreposition.new(operator: "ever")
|
14
|
+
assert_equal [], preposition.values
|
15
|
+
assert preposition.valid?
|
16
|
+
end
|
17
|
+
|
18
|
+
test "should not flatten double-wrapped `values`" do
|
19
|
+
preposition = SetBuilder::Modifiers::DatePreposition.new(operator: "on", values: [["2015-01-01"]])
|
20
|
+
assert_equal [["2015-01-01"]], preposition.values
|
21
|
+
assert preposition.valid?
|
22
|
+
end
|
23
|
+
|
24
|
+
test "should be valid if `values` is not wrapped in an array" do
|
25
|
+
preposition = SetBuilder::Modifiers::DatePreposition.new(operator: "on", values: "2015-01-01")
|
26
|
+
assert_equal ["2015-01-01"], preposition.values
|
27
|
+
assert preposition.valid?
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
|
7
32
|
test "get type with string" do
|
8
33
|
assert_equal StringPreposition, SetBuilder::Modifier["StringPreposition"]
|
9
34
|
end
|
data/test/set_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class SetTest < ActiveSupport::TestCase
|
4
4
|
|
@@ -6,49 +6,79 @@ class SetTest < ActiveSupport::TestCase
|
|
6
6
|
|
7
7
|
test "set data struture" do
|
8
8
|
set = to_set [
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
{ trait: :awesome, enums: ["are"] },
|
10
|
+
{ trait: :attended, enums: ["have"], school: 2 },
|
11
|
+
{ trait: :died, enums: ["have"] },
|
12
|
+
{ trait: :name, modifiers: [{ operator: :is, values: ["Jerome"] }] }]
|
13
13
|
assert set.valid?
|
14
|
-
assert_equal "who are awesome, who have attended McKendree, who died, and whose name is Jerome", set.to_s
|
14
|
+
assert_equal "who are awesome, who have attended McKendree, who have died, and whose name is Jerome", set.to_s
|
15
|
+
end
|
16
|
+
|
17
|
+
test "parsing sets that come from HTML" do
|
18
|
+
set = to_set({
|
19
|
+
"0" => { "trait" => "awesome", "enums" => {"0" => "are"} },
|
20
|
+
"1" => { "trait" => "attended", "enums" => {"0" => "have"}, "school" => 2 },
|
21
|
+
"2" => { "trait" => "died", "enums" => {"0" => "have"} },
|
22
|
+
"3" => { "trait" => "name", "modifiers" => {"0" => { "operator" => "is", "values" => {"0" => "Jerome"} }} } })
|
23
|
+
assert set.valid?
|
24
|
+
assert_equal "who are awesome, who have attended McKendree, who have died, and whose name is Jerome", set.to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
test "normalizing sets" do
|
28
|
+
expected_constraints = [
|
29
|
+
{ trait: "awesome", enums: ["are"] },
|
30
|
+
{ trait: "attended", enums: ["have"], school: 2 },
|
31
|
+
{ trait: "died", enums: ["have"] },
|
32
|
+
{ trait: "name", modifiers: [{ operator: "is", values: ["Jerome"] }] }]
|
33
|
+
set = to_set({
|
34
|
+
"0" => { "trait" => "awesome", "enums" => {"0" => "are"} },
|
35
|
+
"1" => { "trait" => "attended", "enums" => {"0" => "have"}, "school" => 2 },
|
36
|
+
"2" => { "trait" => "died", "enums" => {"0" => "have"} },
|
37
|
+
"3" => { "trait" => "name", "modifiers" => {"0" => { "operator" => "is", "values" => {"0" => "Jerome"} }} } })
|
38
|
+
assert_equal expected_constraints, set.to_a
|
39
|
+
end
|
40
|
+
|
41
|
+
test "normalize should handle nil" do
|
42
|
+
assert_equal [], SetBuilder::Set.normalize(nil)
|
15
43
|
end
|
16
44
|
|
17
45
|
test "sets with invalid modifiers should be invalid" do
|
18
|
-
set = to_set [
|
46
|
+
set = to_set [{ trait: :born, modifiers: [{ operator: :after, values: ["wrong"] }] }]
|
19
47
|
assert_equal false, set.valid?
|
20
48
|
end
|
21
49
|
|
22
50
|
test "sets should not allow non-numbers in a number modifiers" do
|
23
|
-
set = to_set [
|
51
|
+
set = to_set [{ trait: :age, modifiers: [{ operator: :is, values: ["12a"] }] }]
|
24
52
|
refute set.valid?
|
53
|
+
assert_match /"12a" is not a valid number/, set.errors.values.join(", ")
|
25
54
|
end
|
26
55
|
|
27
56
|
test "sets should not allow empty string in a number modifiers" do
|
28
|
-
set = to_set [
|
57
|
+
set = to_set [{ trait: :age, modifiers: [{ operator: :is, values: [""] }] }]
|
29
58
|
refute set.valid?
|
59
|
+
assert_match /number is blank/, set.errors.values.join(", ")
|
30
60
|
end
|
31
61
|
|
32
62
|
test "sets lacking expected modifiers should be invalid" do
|
33
|
-
set = to_set [
|
63
|
+
set = to_set [{ trait: :born, modifiers: [{ operator: :ever, values: [] }] }]
|
34
64
|
assert_equal true, set.valid?
|
35
65
|
|
36
|
-
set = to_set [
|
66
|
+
set = to_set [{ trait: :born }]
|
37
67
|
assert_equal false, set.valid?
|
38
68
|
end
|
39
69
|
|
40
70
|
test "set structure with negations (nouns are ignored)" do
|
41
71
|
set = to_set [
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
72
|
+
{ trait: "awesome", enums: ["are not"] },
|
73
|
+
{ trait: "attended", enums: ["have not"], school: 2 },
|
74
|
+
{ trait: "died", enums: ["have not"] },
|
75
|
+
{ trait: "name", modifiers: [{ operator: :is, values: ["Jerome"] }] }]
|
46
76
|
assert set.valid?
|
47
77
|
assert_equal "who are not awesome, who have not attended McKendree, who have not died, and whose name is Jerome", set.to_s
|
48
78
|
end
|
49
79
|
|
50
80
|
test "simple perform" do
|
51
|
-
set = to_set [
|
81
|
+
set = to_set [{ trait: "awesome", enums: ["are"] }]
|
52
82
|
|
53
83
|
expected_results = [{:conditions => {:awesome => true}}]
|
54
84
|
assert_equal expected_results, set.perform
|
@@ -56,27 +86,20 @@ class SetTest < ActiveSupport::TestCase
|
|
56
86
|
|
57
87
|
test "complex perform" do
|
58
88
|
set = to_set [
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
89
|
+
{ trait: "awesome", enums: ["are"] },
|
90
|
+
{ trait: "attended", enums: ["have"], school: 1 },
|
91
|
+
{ trait: "died", enums: ["have"] },
|
92
|
+
{ trait: "name", modifiers: [{ operator: :begins_with, values: ["Jer"] }] }]
|
63
93
|
|
64
94
|
expected_results = [
|
65
95
|
{:conditions => {:awesome => true}},
|
66
96
|
{:joins => "INNER JOIN schools ON friends.school_id=schools.id", :conditions => {"schools.id" => 1}},
|
67
97
|
{:conditions => {:alive => false}},
|
68
|
-
{:conditions =>
|
98
|
+
{:conditions => "\"friends\".\"name\" LIKE 'Jer%'"}
|
69
99
|
]
|
70
100
|
assert_equal expected_results, set.perform
|
71
101
|
end
|
72
102
|
|
73
|
-
test "invalid set" do
|
74
|
-
set = to_set [[:name, {:starts_with => "Jerome"}]] # starts_with is not a valid operator
|
75
|
-
|
76
|
-
# !todo: what to do?
|
77
|
-
skip "TODO: test invalid sets"
|
78
|
-
end
|
79
|
-
|
80
103
|
|
81
104
|
private
|
82
105
|
|
@@ -1,19 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class StringPrepositionTest < ActiveSupport::TestCase
|
4
4
|
include SetBuilder::Modifiers
|
5
|
-
|
5
|
+
|
6
6
|
attr_reader :table
|
7
|
-
|
7
|
+
|
8
8
|
setup do
|
9
9
|
@table = Arel::Table.new(:fruits)
|
10
10
|
end
|
11
|
-
|
12
|
-
|
11
|
+
|
12
|
+
|
13
13
|
test "#build_arel_for should generate the correct SQL" do
|
14
|
-
modifier = StringPreposition.new(
|
15
|
-
assert_equal "\"fruits\".\"name\" NOT LIKE '%banana%'",
|
14
|
+
modifier = StringPreposition.new(operator: :does_not_contain, values: ["banana"])
|
15
|
+
assert_equal "(\"fruits\".\"name\" IS NULL OR \"fruits\".\"name\" NOT LIKE '%banana%')",
|
16
|
+
modifier.build_arel_for(table[:name]).to_sql
|
16
17
|
end
|
17
|
-
|
18
|
-
|
18
|
+
|
19
|
+
|
19
20
|
end
|
data/test/test_helper.rb
CHANGED
@@ -3,8 +3,10 @@ require "rails"
|
|
3
3
|
require "rails/test_help"
|
4
4
|
require "active_support/core_ext"
|
5
5
|
require "set_builder"
|
6
|
+
require "shoulda/context"
|
6
7
|
require "pry"
|
7
8
|
require "support/fake_connection"
|
9
|
+
require "timecop"
|
8
10
|
|
9
11
|
require "minitest/reporters"
|
10
12
|
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
@@ -13,25 +15,27 @@ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
|
13
15
|
|
14
16
|
SetBuilder::ValueMap.register(:school, [[1, "Concordia"], [2, "McKendree"]])
|
15
17
|
|
18
|
+
friends = Arel::Table.new(:friends)
|
19
|
+
|
16
20
|
$friend_traits = SetBuilder::Traits.new do
|
17
21
|
|
18
|
-
trait('who are
|
22
|
+
trait('who [are|are not] "awesome"') do |query, scope|
|
19
23
|
scope << {:conditions => {:awesome => true}}
|
20
24
|
end
|
21
25
|
|
22
|
-
trait('who [have not] "died"') do |query, scope|
|
26
|
+
trait('who [have|have not] "died"') do |query, scope|
|
23
27
|
scope << {:conditions => {:alive => false}}
|
24
28
|
end
|
25
29
|
|
26
30
|
trait('who were "born" <date>') do |query, scope|
|
27
|
-
scope << {:conditions => query.modifiers[0].
|
31
|
+
scope << {:conditions => query.modifiers[0].build_arel_for(friends[:birthday]).to_sql}
|
28
32
|
end
|
29
33
|
|
30
34
|
trait('whose "age" <number>') do |query, scope|
|
31
|
-
scope << {:conditions => query.modifiers[0].
|
35
|
+
scope << {:conditions => query.modifiers[0].build_arel_for(friends[:age]).to_sql}
|
32
36
|
end
|
33
37
|
|
34
|
-
trait('who have
|
38
|
+
trait('who [have|have not] "attended" :school') do |query, scope|
|
35
39
|
scope << {
|
36
40
|
:joins => "INNER JOIN schools ON friends.school_id=schools.id",
|
37
41
|
:conditions => {"schools.id" => query.direct_object}
|
@@ -39,7 +43,7 @@ $friend_traits = SetBuilder::Traits.new do
|
|
39
43
|
end
|
40
44
|
|
41
45
|
trait('whose "name" <string>') do |query, scope|
|
42
|
-
scope << {:conditions => query.modifiers[0].
|
46
|
+
scope << {:conditions => query.modifiers[0].build_arel_for(friends[:name]).to_sql}
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
@@ -53,17 +57,15 @@ class Friend
|
|
53
57
|
|
54
58
|
|
55
59
|
# Stubs so that Arel can SQL
|
60
|
+
class << self
|
61
|
+
attr_accessor :connection_pool
|
56
62
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
@connection_pool = Fake::ConnectionPool.new
|
61
|
-
end
|
62
|
-
|
63
|
-
def connection
|
64
|
-
connection_pool.connection
|
63
|
+
def connection
|
64
|
+
connection_pool.connection
|
65
|
+
end
|
65
66
|
end
|
67
|
+
@connection_pool = Fake::ConnectionPool.new
|
66
68
|
|
67
69
|
end
|
68
70
|
|
69
|
-
Arel::Table.engine =
|
71
|
+
Arel::Table.engine = Friend
|
data/test/trait_test.rb
CHANGED
@@ -1,42 +1,61 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class TraitTest < ActiveSupport::TestCase
|
4
|
-
include SetBuilder
|
4
|
+
include SetBuilder
|
5
5
|
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
context "When defining a trait, it" do
|
8
|
+
should "strip any leading or trailing whitespace" do
|
9
|
+
assert_equal 'who "died"', Trait.new(' who "died" ').to_s
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
12
|
+
should "take the quoted part of the string as the trait name" do
|
13
|
+
assert_equal "died", Trait.new('who "died"').name
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
assert_equal :is, modifier.operator
|
20
|
-
assert_equal ["Jerome"], modifier.values
|
21
|
-
end
|
16
|
+
should "not allow you to define more than one trait name" do
|
17
|
+
assert_raise(ArgumentError) { Trait.new('who "died" "allegedly"') }
|
18
|
+
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
:awesome => false,
|
26
|
-
:born => false,
|
27
|
-
:attended => true,
|
28
|
-
:died => false,
|
29
|
-
:name => false
|
30
|
-
}
|
31
|
-
trait_requires_direct_object.each do |trait, expected_value|
|
32
|
-
assert_equal expected_value, $friend_traits[trait].requires_direct_object?
|
20
|
+
should "not required you to define a trait name" do
|
21
|
+
assert_raise(ArgumentError) { Trait.new('who died') }
|
33
22
|
end
|
34
|
-
end
|
35
23
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
24
|
+
should "assume that it doesn't expect a direct object" do
|
25
|
+
refute Trait.new('who "attended"').requires_direct_object?
|
26
|
+
end
|
27
|
+
|
28
|
+
should "take a word prefixed with ':' as the type of the direct object" do
|
29
|
+
trait = Trait.new('who "attended" :school')
|
30
|
+
assert_equal :school, trait.direct_object_type
|
31
|
+
assert trait.requires_direct_object?
|
32
|
+
end
|
33
|
+
|
34
|
+
should "not allow you to define more than one direct object" do
|
35
|
+
assert_raise(ArgumentError) { Trait.new('who "attended" :school :university') }
|
36
|
+
end
|
37
|
+
|
38
|
+
should "have no enums unless defined" do
|
39
|
+
assert_equal 0, Trait.new('who "died"').enums.length
|
40
|
+
end
|
41
|
+
|
42
|
+
should "take bracketed text as a built-in set of alternatives" do
|
43
|
+
trait = Trait.new('who [have|have not] "died"')
|
44
|
+
assert_equal [["have", "have not"]], trait.enums
|
45
|
+
end
|
46
|
+
|
47
|
+
should "require you to define at least two alternatives" do
|
48
|
+
assert_raise(ArgumentError) { Trait.new('who [have not] "died"') }
|
49
|
+
end
|
50
|
+
|
51
|
+
should "take words wrapped in angle brackets as modifiers" do
|
52
|
+
trait = Trait.new('who were "born" <date>')
|
53
|
+
assert_equal [Modifiers::DatePreposition], trait.modifiers
|
54
|
+
end
|
55
|
+
|
56
|
+
should "raise an exception if a modifier isn't defined" do
|
57
|
+
assert_raise(ArgumentError) { Trait.new('who were "born" <nope>') }
|
58
|
+
end
|
40
59
|
end
|
41
60
|
|
42
61
|
|
data/test/traits_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class TraitsTest < ActiveSupport::TestCase
|
4
4
|
include SetBuilder::Modifiers
|
@@ -27,53 +27,58 @@ class TraitsTest < ActiveSupport::TestCase
|
|
27
27
|
assert_equal expected_modifiers, $friend_traits.modifiers.collect(&:name).sort
|
28
28
|
end
|
29
29
|
|
30
|
-
test "two collections of traits can be concatenated with `+`" do
|
31
|
-
traits1 = SetBuilder::Traits.new do
|
32
|
-
trait('who are [not] "awesome"') { |query, scope| }
|
33
|
-
end
|
34
|
-
|
35
|
-
traits2 = SetBuilder::Traits.new do
|
36
|
-
trait('who are [not] "living"') { |query, scope| }
|
37
|
-
end
|
38
30
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
31
|
+
context "two collections of traits" do
|
32
|
+
setup do
|
33
|
+
@traits1 = SetBuilder::Traits.new do
|
34
|
+
trait('who are "awesome"') { |query, scope| }
|
35
|
+
end
|
43
36
|
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
@traits2 = SetBuilder::Traits.new do
|
38
|
+
trait('who are "living"') { |query, scope| }
|
39
|
+
end
|
47
40
|
end
|
48
41
|
|
49
|
-
|
50
|
-
|
42
|
+
should "be concatenatable with `+`" do
|
43
|
+
combined_traits = @traits1 + @traits2
|
44
|
+
assert_kind_of SetBuilder::Traits, combined_traits
|
45
|
+
assert_equal %w{awesome living}, combined_traits.map(&:name)
|
51
46
|
end
|
52
47
|
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
should "be concatenatable with `concat`" do
|
49
|
+
combined_traits = @traits1.concat @traits2
|
50
|
+
assert_kind_of SetBuilder::Traits, combined_traits
|
51
|
+
assert_equal %w{awesome living}, combined_traits.map(&:name)
|
52
|
+
end
|
56
53
|
end
|
57
54
|
|
55
|
+
|
58
56
|
test "to_json" do
|
59
|
-
expected_json = [[["string","who
|
60
|
-
["
|
57
|
+
expected_json = [[["string","who "],
|
58
|
+
["enum",["are","are not"]],
|
59
|
+
["string", " "],
|
61
60
|
["name","awesome"]],
|
62
|
-
[["string","who"],
|
63
|
-
["
|
61
|
+
[["string","who "],
|
62
|
+
["enum",["have","have not"]],
|
63
|
+
["string", " "],
|
64
64
|
["name","died"]],
|
65
|
-
[["string","who were"],
|
65
|
+
[["string","who were "],
|
66
66
|
["name","born"],
|
67
|
+
["string", " "],
|
67
68
|
["modifier","date"]],
|
68
|
-
[["string","whose"],
|
69
|
+
[["string","whose "],
|
69
70
|
["name","age"],
|
71
|
+
["string", " "],
|
70
72
|
["modifier","number"]],
|
71
|
-
[["string","who
|
72
|
-
["
|
73
|
+
[["string","who "],
|
74
|
+
["enum",["have","have not"]],
|
75
|
+
["string", " "],
|
73
76
|
["name","attended"],
|
77
|
+
["string", " "],
|
74
78
|
["direct_object_type","school"]],
|
75
|
-
[["string","whose"],
|
79
|
+
[["string","whose "],
|
76
80
|
["name","name"],
|
81
|
+
["string", " "],
|
77
82
|
["modifier","string"]]].to_json
|
78
83
|
assert_equal expected_json, $friend_traits.to_json
|
79
84
|
end
|
data/test/value_map_test.rb
CHANGED
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: set_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.1'
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 4.2.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '3.1'
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 4.2.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: arel
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,6 +94,20 @@ dependencies:
|
|
100
94
|
- - ">="
|
101
95
|
- !ruby/object:Gem::Version
|
102
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: shoulda-context
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
103
111
|
- !ruby/object:Gem::Dependency
|
104
112
|
name: minitest-reporters
|
105
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +122,20 @@ dependencies:
|
|
114
122
|
- - ">="
|
115
123
|
- !ruby/object:Gem::Version
|
116
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: timecop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
117
139
|
description: A gem for describing constraints on data sets
|
118
140
|
email:
|
119
141
|
- bob.lailfamily@gmail.com
|
@@ -133,6 +155,7 @@ files:
|
|
133
155
|
- lib/set_builder.rb
|
134
156
|
- lib/set_builder/constraint.rb
|
135
157
|
- lib/set_builder/engine.rb
|
158
|
+
- lib/set_builder/errors/trait_not_found.rb
|
136
159
|
- lib/set_builder/modifier.rb
|
137
160
|
- lib/set_builder/modifier/adverb.rb
|
138
161
|
- lib/set_builder/modifier/base.rb
|
@@ -142,7 +165,6 @@ files:
|
|
142
165
|
- lib/set_builder/modifiers/date_preposition.rb
|
143
166
|
- lib/set_builder/modifiers/number_preposition.rb
|
144
167
|
- lib/set_builder/modifiers/string_preposition.rb
|
145
|
-
- lib/set_builder/query_builders/string.rb
|
146
168
|
- lib/set_builder/set.rb
|
147
169
|
- lib/set_builder/trait.rb
|
148
170
|
- lib/set_builder/trait_builder.rb
|
@@ -173,8 +195,8 @@ files:
|
|
173
195
|
- spec/unit/array.spec.js
|
174
196
|
- spec/unit/set_builder.spec.js
|
175
197
|
- spec/unit/spec.helper.js
|
198
|
+
- test/constraint_test.rb
|
176
199
|
- test/date_preposition_test.rb
|
177
|
-
- test/inflector_test.rb
|
178
200
|
- test/modifier_test.rb
|
179
201
|
- test/set_test.rb
|
180
202
|
- test/string_preposition_test.rb
|
@@ -233,8 +255,8 @@ test_files:
|
|
233
255
|
- spec/unit/array.spec.js
|
234
256
|
- spec/unit/set_builder.spec.js
|
235
257
|
- spec/unit/spec.helper.js
|
258
|
+
- test/constraint_test.rb
|
236
259
|
- test/date_preposition_test.rb
|
237
|
-
- test/inflector_test.rb
|
238
260
|
- test/modifier_test.rb
|
239
261
|
- test/set_test.rb
|
240
262
|
- test/string_preposition_test.rb
|
File without changes
|
data/test/inflector_test.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class InflectorTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
test "active" do
|
7
|
-
assert_equal "who died", SetBuilder::Trait.new('who "died"').to_s
|
8
|
-
end
|
9
|
-
|
10
|
-
test "perfect" do
|
11
|
-
assert_equal "who have attended", SetBuilder::Trait.new('who have "attended"').to_s
|
12
|
-
end
|
13
|
-
|
14
|
-
test "passive" do
|
15
|
-
assert_equal "who were born", SetBuilder::Trait.new('who were "born"').to_s
|
16
|
-
end
|
17
|
-
|
18
|
-
test "reflexive" do
|
19
|
-
assert_equal "who are awesome", SetBuilder::Trait.new('who are "awesome"').to_s
|
20
|
-
end
|
21
|
-
|
22
|
-
test "noun" do
|
23
|
-
assert_equal "whose name", SetBuilder::Trait.new('whose "name"').to_s
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
end
|