-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify origins do not collide with
ServiceActor::Result
object meth…
…ods (#138)
- Loading branch information
1 parent
099053e
commit a7a64a3
Showing
10 changed files
with
176 additions
and
32 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 was deleted.
Oops, something went wrong.
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,43 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe ServiceActor::ArgumentsValidator do | ||
describe ".validate_origin_name" do | ||
it "raises if collision present" do # rubocop:disable RSpec/ExampleLength | ||
expect do | ||
described_class.validate_origin_name(:fail!, origin: :input) | ||
end.to raise_error( | ||
ArgumentError, | ||
"input `fail!` overrides `ServiceActor::Result` instance method", | ||
) | ||
end | ||
|
||
it do | ||
expect do | ||
described_class.validate_origin_name(:some_method, origin: :output) | ||
end.not_to raise_error | ||
end | ||
end | ||
|
||
describe ".validate_error_class" do | ||
it "with an exception class" do | ||
expect { described_class.validate_error_class(ArgumentError) } | ||
.not_to raise_error | ||
end | ||
|
||
it "with a non-class object" do | ||
expect { described_class.validate_error_class("123") } | ||
.to raise_error( | ||
ArgumentError, | ||
"Expected 123 to be a subclass of Exception", | ||
) | ||
end | ||
|
||
it "with a non-exception class" do | ||
expect { described_class.validate_error_class(Class.new) } | ||
.to raise_error( | ||
ArgumentError, | ||
/Expected .+ to be a subclass of Exception/, | ||
) | ||
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe ServiceActor::VERSION do | ||
# rubocop:disable RSpec/DescribedClass | ||
it { expect(ServiceActor::VERSION).not_to be_nil } | ||
# rubocop:enable RSpec/DescribedClass | ||
it { is_expected.not_to be_nil } | ||
end |