-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from paulfioravanti/fixes
Extract out some case type modules
- Loading branch information
Showing
9 changed files
with
155 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Resume | ||
module CLI | ||
module AlignKey | ||
module_function | ||
|
||
def ===(other) | ||
other.first == :align | ||
end | ||
end | ||
end | ||
end |
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,11 @@ | ||
module Resume | ||
module CLI | ||
module FontHash | ||
module_function | ||
|
||
def ===(other) | ||
other.first == :font && other.last.is_a?(Hash) | ||
end | ||
end | ||
end | ||
end |
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,11 @@ | ||
module Resume | ||
module CLI | ||
module StylesArray | ||
module_function | ||
|
||
def ===(other) | ||
other.first == :styles && other.last.is_a?(Array) | ||
end | ||
end | ||
end | ||
end |
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,25 @@ | ||
require "resume/cli/align_key" | ||
|
||
module Resume | ||
module CLI | ||
RSpec.describe AlignKey do | ||
describe ".===" do | ||
context "when other has an align key" do | ||
let(:align_key) { [:align, 1] } | ||
|
||
it "returns true" do | ||
expect(described_class === align_key).to be true | ||
end | ||
end | ||
|
||
context "when other does not have an align key" do | ||
let(:non_align_key) { [:something_else, 1] } | ||
|
||
it "returns false" do | ||
expect(described_class === non_align_key).to be false | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
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,33 @@ | ||
require "resume/cli/font_hash" | ||
|
||
module Resume | ||
module CLI | ||
RSpec.describe FontHash do | ||
describe ".===" do | ||
context "when other has a font key with a Hash of values" do | ||
let(:font_hash) { [:font, { foo: "bar" }] } | ||
|
||
it "returns true" do | ||
expect(described_class === font_hash).to be true | ||
end | ||
end | ||
|
||
context "when other has a non-font key with a Hash of values" do | ||
let(:non_font_hash) { [:something_else, { foo: "bar" }] } | ||
|
||
it "returns false" do | ||
expect(described_class === non_font_hash).to be false | ||
end | ||
end | ||
|
||
context "when other has a font key but not a Hash of values" do | ||
let(:non_font_hash) { [:font, [1, 2, 3]] } | ||
|
||
it "returns false" do | ||
expect(described_class === non_font_hash).to be false | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
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,33 @@ | ||
require "resume/cli/styles_array" | ||
|
||
module Resume | ||
module CLI | ||
RSpec.describe StylesArray do | ||
describe ".===" do | ||
context "when other has a styles key with an Array of values" do | ||
let(:styles_array) { [:styles, [1, 2, 3]] } | ||
|
||
it "returns true" do | ||
expect(described_class === styles_array).to be true | ||
end | ||
end | ||
|
||
context "when other has a non-styles key with an Array of values" do | ||
let(:non_styles_array) { [:something_else, [1, 2, 3]] } | ||
|
||
it "returns false" do | ||
expect(described_class === non_styles_array).to be false | ||
end | ||
end | ||
|
||
context "when other has a styles key but not an Array of values" do | ||
let(:non_styles_array) { [:styles, { foo: "bar" }] } | ||
|
||
it "returns false" do | ||
expect(described_class === non_styles_array).to be false | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |