-
-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invalid combinators to raise and visitors to tolerate combinator case…
… and symbol differences
- Loading branch information
Showing
7 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require 'spec_helper' | ||
|
||
module Ransack | ||
describe Visitor do | ||
|
||
let(:viz) { Visitor.new } | ||
|
||
shared_examples 'an or combinator' do | combinator | | ||
it 'routes to #visit_or' do | ||
expect(viz).to receive(:visit_or) | ||
expect(viz).to_not receive(:visit_and) | ||
|
||
grouping = Ransack::Nodes::Grouping.new(nil, combinator) | ||
viz.visit_Ransack_Nodes_Grouping(grouping) | ||
end | ||
end | ||
|
||
shared_examples 'not an or combinator' do | combinator | | ||
it 'routes to #visit_or' do | ||
expect(viz).to_not receive(:visit_or) | ||
expect(viz).to receive(:visit_and) | ||
|
||
grouping = Ransack::Nodes::Grouping.new(nil, combinator) | ||
viz.visit_Ransack_Nodes_Grouping(grouping) | ||
end | ||
end | ||
|
||
context 'combinator "or"' do include_examples 'an or combinator', 'or' end | ||
context 'combinator "OR"' do include_examples 'an or combinator', 'OR' end | ||
context 'combinator ":or"' do include_examples 'an or combinator', :or end | ||
|
||
context 'combinator "and"' do include_examples 'not an or combinator', 'and' end | ||
context 'combinator "AND"' do include_examples 'not an or combinator', 'AND' end | ||
context 'combinator ":and"' do include_examples 'not an or combinator', :and end | ||
context 'combinator "unknown"' do include_examples 'not an or combinator', 'unknown' end | ||
end | ||
end |