Skip to content

Commit

Permalink
rework specs
Browse files Browse the repository at this point in the history
  • Loading branch information
tycooon committed Oct 26, 2024
1 parent 907a71e commit 74b8885
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions spec/umbrellio_utils/checks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,21 @@
describe "#valid_email?" do
subject(:result) { described_class.valid_email?(input) }

let(:input) { "user@example.com" }

it { is_expected.to eq(true) }

context "invalid input" do
let(:input) { "invalid" }

it { is_expected.to eq(false) }
end

context "input with subdomains and digits" do
let(:input) { "user@one.two42.com" }

it { is_expected.to eq(true) }
end

context "non-string input" do
let(:input) { 123 }

it { is_expected.to eq(false) }
expectations = {
"user@example.com" => true,
"user@one.two42.com" => true,
"invalid" => false,
123 => false,
nil => false,
}

expectations.each do |input, expected_result|
context "with input #{input.inspect} should return #{expected_result.inspect}" do
let(:input) { input }
let(:expected_result) { expected_result }

it { is_expected.to eq(expected_result) }
end
end
end
end

0 comments on commit 74b8885

Please sign in to comment.