Skip to content

Commit

Permalink
Rename "condition" to "modifier" in error messages and specs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalejandroaguilar committed Aug 16, 2024
1 parent ec30193 commit 3e59ab4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/phlexy_ui/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def html_classes_for_modifiers(modifiers, modifiers_map, responsive_prefix: nil)
)
end
rescue KeyError => e
raise ArgumentError, "Condition `#{e.key}` is not defined for #{self.class}"
raise ArgumentError, "Modifier `#{e.key}` is not defined for #{self.class}"
end

def with_config_prefix(string)
Expand Down
10 changes: 5 additions & 5 deletions spec/lib/phlexy_ui/button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
success: "btn-success",
warning: "btn-warning",
error: "btn-error"
}.each do |condition, css|
context "when given :#{condition} condition" do
subject(:output) { render described_class.new(condition) }
}.each do |modifier, css|
context "when given :#{modifier} modifier" do
subject(:output) { render described_class.new(modifier) }

it "renders it apart from the main class" do
expected_html = html <<~HTML
Expand All @@ -52,12 +52,12 @@
end
end

context "when condition doesn't exist" do
context "when modifier doesn't exist" do
it "raises an error" do
expect { render described_class.new(:foo) }
.to raise_error(
ArgumentError,
"Condition `foo` is not defined for PhlexyUI::Button"
"Modifier `foo` is not defined for PhlexyUI::Button"
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/phlexy_ui/card_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
expect { render described_class.new(:foo) }
.to raise_error(
ArgumentError,
"Condition `foo` is not defined for PhlexyUI::Card"
"Modifier `foo` is not defined for PhlexyUI::Card"
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/phlexy_ui/drawer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
expect { render described_class.new(:foo, id: :my_drawer) }
.to raise_error(
ArgumentError,
"Condition `foo` is not defined for PhlexyUI::Drawer"
"Modifier `foo` is not defined for PhlexyUI::Drawer"
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/phlexy_ui/menu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
expect { render described_class.new(:foo) }
.to raise_error(
ArgumentError,
"Condition `foo` is not defined for PhlexyUI::Menu"
"Modifier `foo` is not defined for PhlexyUI::Menu"
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/phlexy_ui/tabs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
expect { render described_class.new(:foo) }
.to raise_error(
ArgumentError,
"Condition `foo` is not defined for PhlexyUI::Tabs"
"Modifier `foo` is not defined for PhlexyUI::Tabs"
)
end
end
Expand Down

0 comments on commit 3e59ab4

Please sign in to comment.