-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
333 additions
and
252 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
73 changes: 73 additions & 0 deletions
73
test/automated/handle/configure/session/configure_method_receives_session.rb
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,73 @@ | ||
require_relative '../../../automated_init' | ||
|
||
context "Handle" do | ||
context "Configure" do | ||
context "Session" do | ||
context "Configure Method Receives Session" do | ||
context "Session Is an Optional Keyword Argument" do | ||
handler_class = Class.new do | ||
include Messaging::Handle | ||
|
||
attr_accessor :session | ||
|
||
def configure(session: nil) | ||
self.session = session | ||
end | ||
end | ||
|
||
context "Given" do | ||
session = Object.new | ||
|
||
context "Session is passed to configure method" do | ||
handler = handler_class.build(session: session) | ||
|
||
test do | ||
assert(handler.session.equal?(session)) | ||
end | ||
end | ||
end | ||
|
||
context "Not Given" do | ||
test "Argument error not raised" do | ||
refute_raises(ArgumentError) do | ||
handler_class.build | ||
end | ||
end | ||
end | ||
end | ||
|
||
context "Session is a required keyword argument" do | ||
handler_class = Class.new do | ||
include Messaging::Handle | ||
|
||
attr_accessor :session | ||
|
||
def configure(session:) | ||
self.session = session | ||
end | ||
end | ||
|
||
context "Given" do | ||
session = Object.new | ||
|
||
context "Session is passed to configure method" do | ||
handler = handler_class.build(session: session) | ||
|
||
test do | ||
assert(handler.session.equal?(session)) | ||
end | ||
end | ||
end | ||
|
||
context "Not Given" do | ||
test "Argument error is raised" do | ||
assert_raises(ArgumentError) do | ||
handler_class.build | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
39 changes: 39 additions & 0 deletions
39
test/automated/handle/configure/session/invalid_session_parameter_definition.rb
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,39 @@ | ||
require_relative '../../../automated_init' | ||
|
||
context "Handle" do | ||
context "Configure" do | ||
context "Session" do | ||
context "Invalid Session Parameter Definition" do | ||
context "Session is a Positional Argument" do | ||
handler_class = Class.new do | ||
include Messaging::Handle | ||
|
||
def configure(session) | ||
end | ||
end | ||
|
||
test "Is an error" do | ||
assert_raises(Messaging::Handle::Build::Error) do | ||
handler_class.build | ||
end | ||
end | ||
end | ||
|
||
context "Session Is an Optional Positional Argument" do | ||
handler_class = Class.new do | ||
include Messaging::Handle | ||
|
||
def configure(session=nil) | ||
end | ||
end | ||
|
||
test "Is an error" do | ||
assert_raises(Messaging::Handle::Build::Error) do | ||
handler_class.build | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
29 changes: 29 additions & 0 deletions
29
test/automated/handle/configure/session/parameterless_configure_method.rb
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,29 @@ | ||
require_relative '../../../automated_init' | ||
|
||
context "Handle" do | ||
context "Configure" do | ||
context "Session" do | ||
context "Parameterless Configure Method" do | ||
handler_class = Controls::Handler::Example | ||
|
||
context "Given" do | ||
session = Object.new | ||
|
||
test "Argument error not raised" do | ||
refute_raises(ArgumentError) do | ||
handler_class.build(session: session) | ||
end | ||
end | ||
end | ||
|
||
context "Not Given" do | ||
test "Argument error not raised" do | ||
refute_raises(ArgumentError) do | ||
handler_class.build | ||
end | ||
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,34 @@ | ||
require_relative '../../automated_init' | ||
|
||
context "Handle" do | ||
context "Configure" do | ||
context "Session and Settings" do | ||
handler_class = Class.new do | ||
include Messaging::Handle | ||
|
||
attr_accessor :session | ||
attr_accessor :settings | ||
|
||
def configure(session: nil, settings: nil) | ||
self.session = session | ||
self.settings = settings | ||
end | ||
end | ||
|
||
session = Object.new | ||
settings = Object.new | ||
|
||
context "Passed to configure method" do | ||
handler = handler_class.build(session: session, settings: settings) | ||
|
||
test "Session" do | ||
assert(handler.session.equal?(session)) | ||
end | ||
|
||
test "Settings" do | ||
assert(handler.settings.equal?(settings)) | ||
end | ||
end | ||
end | ||
end | ||
end |
73 changes: 73 additions & 0 deletions
73
test/automated/handle/configure/settings/configure_method_receives_settings.rb
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,73 @@ | ||
require_relative '../../../automated_init' | ||
|
||
context "Handle" do | ||
context "Configure" do | ||
context "Settings" do | ||
context "Configure Method Receives Settings" do | ||
context "Settings Is an Optional Keyword Argument" do | ||
handler_class = Class.new do | ||
include Messaging::Handle | ||
|
||
attr_accessor :settings | ||
|
||
def configure(settings: nil) | ||
self.settings = settings | ||
end | ||
end | ||
|
||
context "Given" do | ||
settings = Object.new | ||
|
||
context "Settings is passed to configure method" do | ||
handler = handler_class.build(settings: settings) | ||
|
||
test do | ||
assert(handler.settings.equal?(settings)) | ||
end | ||
end | ||
end | ||
|
||
context "Not Given" do | ||
test "Argument error not raised" do | ||
refute_raises(ArgumentError) do | ||
handler_class.build | ||
end | ||
end | ||
end | ||
end | ||
|
||
context "Settings is a required keyword argument" do | ||
handler_class = Class.new do | ||
include Messaging::Handle | ||
|
||
attr_accessor :settings | ||
|
||
def configure(settings:) | ||
self.settings = settings | ||
end | ||
end | ||
|
||
context "Given" do | ||
settings = Object.new | ||
|
||
context "Settings is passed to configure method" do | ||
handler = handler_class.build(settings: settings) | ||
|
||
test do | ||
assert(handler.settings.equal?(settings)) | ||
end | ||
end | ||
end | ||
|
||
context "Not Given" do | ||
test "Argument error is raised" do | ||
assert_raises(ArgumentError) do | ||
handler_class.build | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
39 changes: 39 additions & 0 deletions
39
test/automated/handle/configure/settings/invalid_settings_parameter_definition.rb
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,39 @@ | ||
require_relative '../../../automated_init' | ||
|
||
context "Handle" do | ||
context "Configure" do | ||
context "Settings" do | ||
context "Invalid Settings Parameter Definition" do | ||
context "Settings is a Positional Argument" do | ||
handler_class = Class.new do | ||
include Messaging::Handle | ||
|
||
def configure(settings) | ||
end | ||
end | ||
|
||
test "Is an error" do | ||
assert_raises(Messaging::Handle::Build::Error) do | ||
handler_class.build | ||
end | ||
end | ||
end | ||
|
||
context "Settings Is an Optional Positional Argument" do | ||
handler_class = Class.new do | ||
include Messaging::Handle | ||
|
||
def configure(settings=nil) | ||
end | ||
end | ||
|
||
test "Is an error" do | ||
assert_raises(Messaging::Handle::Build::Error) do | ||
handler_class.build | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.