Round II of 2.7.0 deprecation fixes
parent
721fea39b2
commit
1383a5bb1a
1
Gemfile
1
Gemfile
|
@ -24,6 +24,7 @@ gem "scenic"
|
||||||
gem "secure_headers"
|
gem "secure_headers"
|
||||||
gem "tzinfo" # For validation of user selected timezone names
|
gem "tzinfo" # For validation of user selected timezone names
|
||||||
gem "valid_url"
|
gem "valid_url"
|
||||||
|
# gem "farady", "~> 1.0.0"
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem "climate_control"
|
gem "climate_control"
|
||||||
|
|
20
Gemfile.lock
20
Gemfile.lock
|
@ -109,7 +109,7 @@ GEM
|
||||||
factory_bot_rails (5.1.1)
|
factory_bot_rails (5.1.1)
|
||||||
factory_bot (~> 5.1.0)
|
factory_bot (~> 5.1.0)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
faker (2.9.0)
|
faker (2.10.0)
|
||||||
i18n (>= 1.6, < 1.8)
|
i18n (>= 1.6, < 1.8)
|
||||||
faraday (0.15.4)
|
faraday (0.15.4)
|
||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
|
@ -119,7 +119,7 @@ GEM
|
||||||
railties (>= 3.2, < 6.1)
|
railties (>= 3.2, < 6.1)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
google-api-client (0.36.1)
|
google-api-client (0.36.3)
|
||||||
addressable (~> 2.5, >= 2.5.1)
|
addressable (~> 2.5, >= 2.5.1)
|
||||||
googleauth (~> 0.9)
|
googleauth (~> 0.9)
|
||||||
httpclient (>= 2.8.1, < 3.0)
|
httpclient (>= 2.8.1, < 3.0)
|
||||||
|
@ -178,13 +178,13 @@ GEM
|
||||||
passenger (6.0.4)
|
passenger (6.0.4)
|
||||||
rack
|
rack
|
||||||
rake (>= 0.8.1)
|
rake (>= 0.8.1)
|
||||||
pg (1.1.4)
|
pg (1.2.1)
|
||||||
pry (0.12.2)
|
pry (0.12.2)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.9.0)
|
method_source (~> 0.9.0)
|
||||||
pry-rails (0.3.9)
|
pry-rails (0.3.9)
|
||||||
pry (>= 0.10.4)
|
pry (>= 0.10.4)
|
||||||
public_suffix (4.0.1)
|
public_suffix (4.0.2)
|
||||||
rabbitmq_http_api_client (1.12.0)
|
rabbitmq_http_api_client (1.12.0)
|
||||||
faraday (~> 0.15.4)
|
faraday (~> 0.15.4)
|
||||||
faraday_middleware (~> 0.13.0)
|
faraday_middleware (~> 0.13.0)
|
||||||
|
@ -193,7 +193,7 @@ GEM
|
||||||
rack (2.0.8)
|
rack (2.0.8)
|
||||||
rack-attack (6.2.2)
|
rack-attack (6.2.2)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
rack-cors (1.1.0)
|
rack-cors (1.1.1)
|
||||||
rack (>= 2.0.0)
|
rack (>= 2.0.0)
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
|
@ -245,12 +245,12 @@ GEM
|
||||||
rspec-core (~> 3.9.0)
|
rspec-core (~> 3.9.0)
|
||||||
rspec-expectations (~> 3.9.0)
|
rspec-expectations (~> 3.9.0)
|
||||||
rspec-mocks (~> 3.9.0)
|
rspec-mocks (~> 3.9.0)
|
||||||
rspec-core (3.9.0)
|
rspec-core (3.9.1)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.1)
|
||||||
rspec-expectations (3.9.0)
|
rspec-expectations (3.9.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-mocks (3.9.0)
|
rspec-mocks (3.9.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-rails (4.0.0.beta3)
|
rspec-rails (4.0.0.beta3)
|
||||||
|
@ -261,7 +261,7 @@ GEM
|
||||||
rspec-expectations (~> 3.8)
|
rspec-expectations (~> 3.8)
|
||||||
rspec-mocks (~> 3.8)
|
rspec-mocks (~> 3.8)
|
||||||
rspec-support (~> 3.8)
|
rspec-support (~> 3.8)
|
||||||
rspec-support (3.9.0)
|
rspec-support (3.9.2)
|
||||||
scenic (1.5.1)
|
scenic (1.5.1)
|
||||||
activerecord (>= 4.0.0)
|
activerecord (>= 4.0.0)
|
||||||
railties (>= 4.0.0)
|
railties (>= 4.0.0)
|
||||||
|
@ -285,7 +285,7 @@ GEM
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
thor (1.0.1)
|
thor (1.0.1)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tzinfo (1.2.5)
|
tzinfo (1.2.6)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uber (0.1.0)
|
uber (0.1.0)
|
||||||
url (0.3.2)
|
url (0.3.2)
|
||||||
|
|
|
@ -26,7 +26,7 @@ module CeleryScript
|
||||||
|
|
||||||
def maybe_initialize(parent, leaf_or_node, key = NEVER)
|
def maybe_initialize(parent, leaf_or_node, key = NEVER)
|
||||||
if is_node?(leaf_or_node)
|
if is_node?(leaf_or_node)
|
||||||
AstNode.new(parent, leaf_or_node)
|
AstNode.new(parent, **leaf_or_node)
|
||||||
else
|
else
|
||||||
raise TypeCheckError, LEAVES_NEED_KEYS if key == NEVER
|
raise TypeCheckError, LEAVES_NEED_KEYS if key == NEVER
|
||||||
AstLeaf.new(parent, leaf_or_node, key)
|
AstLeaf.new(parent, leaf_or_node, key)
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe "Body nodes" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "kicks back unexpected nodes" do
|
it "kicks back unexpected nodes" do
|
||||||
tree = CeleryScript::AstNode.new({
|
tree = CeleryScript::AstNode.new(**{
|
||||||
"kind": "baz",
|
"kind": "baz",
|
||||||
"args": {},
|
"args": {},
|
||||||
"body": [{ "kind": "wrong", "args": {}}]
|
"body": [{ "kind": "wrong", "args": {}}]
|
||||||
|
@ -30,7 +30,7 @@ describe "Body nodes" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "handles body members of nodes that shouldn't have bodies." do
|
it "handles body members of nodes that shouldn't have bodies." do
|
||||||
tree = CeleryScript::AstNode.new({
|
tree = CeleryScript::AstNode.new(**{
|
||||||
"kind": "baz",
|
"kind": "baz",
|
||||||
"args": {},
|
"args": {},
|
||||||
"body": [{ "kind": "wrong", "args": {}}]
|
"body": [{ "kind": "wrong", "args": {}}]
|
||||||
|
@ -41,7 +41,7 @@ describe "Body nodes" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'disallows leaves in the body field of a node' do
|
it 'disallows leaves in the body field of a node' do
|
||||||
tree = CeleryScript::AstNode.new({
|
tree = CeleryScript::AstNode.new(**{
|
||||||
"kind": "wrong",
|
"kind": "wrong",
|
||||||
"args": {},
|
"args": {},
|
||||||
"body": [
|
"body": [
|
||||||
|
|
|
@ -14,9 +14,7 @@ describe CeleryScript::Checker do
|
||||||
}.deep_symbolize_keys
|
}.deep_symbolize_keys
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:tree) do
|
let(:tree) { CeleryScript::AstNode.new(**hash) }
|
||||||
CeleryScript::AstNode.new(hash)
|
|
||||||
end
|
|
||||||
|
|
||||||
let (:corpus) { Sequence::Corpus }
|
let (:corpus) { Sequence::Corpus }
|
||||||
|
|
||||||
|
@ -205,14 +203,14 @@ describe CeleryScript::Checker do
|
||||||
|
|
||||||
it "catches bad `axis` nodes" do
|
it "catches bad `axis` nodes" do
|
||||||
t =
|
t =
|
||||||
CeleryScript::AstNode.new({ kind: "home", args: { speed: 100, axis: "?" } })
|
CeleryScript::AstNode.new(kind: "home", args: { speed: 100, axis: "?" })
|
||||||
chk = CeleryScript::Checker.new(t, corpus, device)
|
chk = CeleryScript::Checker.new(t, corpus, device)
|
||||||
expect(chk.valid?).to be false
|
expect(chk.valid?).to be false
|
||||||
expect(chk.error.message).to include("not a valid axis")
|
expect(chk.error.message).to include("not a valid axis")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "catches bad `package` nodes" do
|
it "catches bad `package` nodes" do
|
||||||
t = CeleryScript::AstNode.new({ kind: "factory_reset", args: { package: "?" } })
|
t = CeleryScript::AstNode.new(kind: "factory_reset", args: { package: "?" })
|
||||||
chk = CeleryScript::Checker.new(t, corpus, device)
|
chk = CeleryScript::Checker.new(t, corpus, device)
|
||||||
expect(chk.valid?).to be false
|
expect(chk.valid?).to be false
|
||||||
expect(chk.error.message).to include("not a valid package")
|
expect(chk.error.message).to include("not a valid package")
|
||||||
|
@ -251,7 +249,7 @@ describe CeleryScript::Checker do
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
tree = CeleryScript::AstNode.new(ast)
|
tree = CeleryScript::AstNode.new(**ast)
|
||||||
chk = CeleryScript::Checker.new(tree, corpus, device)
|
chk = CeleryScript::Checker.new(tree, corpus, device)
|
||||||
expect(chk.valid?).to be true
|
expect(chk.valid?).to be true
|
||||||
end
|
end
|
||||||
|
@ -289,7 +287,7 @@ describe CeleryScript::Checker do
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
tree = CeleryScript::AstNode.new(ast)
|
tree = CeleryScript::AstNode.new(**ast)
|
||||||
chk = CeleryScript::Checker.new(tree, corpus, device)
|
chk = CeleryScript::Checker.new(tree, corpus, device)
|
||||||
expect(chk.valid?).to be false
|
expect(chk.valid?).to be false
|
||||||
message = "must provide a value for all parameters"
|
message = "must provide a value for all parameters"
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe CeleryScript::Corpus do
|
||||||
check1 = CeleryScript::Checker.new(ok1, corpus, device)
|
check1 = CeleryScript::Checker.new(ok1, corpus, device)
|
||||||
expect(check1.valid?).to be_truthy
|
expect(check1.valid?).to be_truthy
|
||||||
|
|
||||||
ok2 = CeleryScript::AstNode.new({
|
ok2 = CeleryScript::AstNode.new(**{
|
||||||
kind: "move_absolute",
|
kind: "move_absolute",
|
||||||
args: {
|
args: {
|
||||||
location: {
|
location: {
|
||||||
|
@ -53,7 +53,7 @@ describe CeleryScript::Corpus do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "kicks back invalid move_absolute nodes" do
|
it "kicks back invalid move_absolute nodes" do
|
||||||
bad = CeleryScript::AstNode.new({
|
bad = CeleryScript::AstNode.new(**{
|
||||||
kind: "move_absolute",
|
kind: "move_absolute",
|
||||||
args: {
|
args: {
|
||||||
location: 42,
|
location: 42,
|
||||||
|
@ -109,7 +109,7 @@ describe CeleryScript::Corpus do
|
||||||
it "Handles message_type validations for version 1" do
|
it "Handles message_type validations for version 1" do
|
||||||
# This test is __ONLY__ relevant for version 1.
|
# This test is __ONLY__ relevant for version 1.
|
||||||
# Change / delete / update as needed.
|
# Change / delete / update as needed.
|
||||||
tree = CeleryScript::AstNode.new({
|
tree = CeleryScript::AstNode.new(**{
|
||||||
"kind": "send_message",
|
"kind": "send_message",
|
||||||
"args": {
|
"args": {
|
||||||
"message": "Hello, world!",
|
"message": "Hello, world!",
|
||||||
|
@ -122,7 +122,7 @@ describe CeleryScript::Corpus do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "Handles channel_name validations" do
|
it "Handles channel_name validations" do
|
||||||
tree = CeleryScript::AstNode.new({
|
tree = CeleryScript::AstNode.new(**{
|
||||||
"kind": "send_message",
|
"kind": "send_message",
|
||||||
"args": {
|
"args": {
|
||||||
"message": "Hello, world!",
|
"message": "Hello, world!",
|
||||||
|
@ -141,7 +141,7 @@ describe CeleryScript::Corpus do
|
||||||
|
|
||||||
it "validates tool_ids" do
|
it "validates tool_ids" do
|
||||||
ast = { "kind": "tool", "args": { "tool_id": 0 } }
|
ast = { "kind": "tool", "args": { "tool_id": 0 } }
|
||||||
checker = CeleryScript::Checker.new(CeleryScript::AstNode.new(ast),
|
checker = CeleryScript::Checker.new(CeleryScript::AstNode.new(**ast),
|
||||||
corpus,
|
corpus,
|
||||||
device)
|
device)
|
||||||
expect(checker.valid?).to be(false)
|
expect(checker.valid?).to be(false)
|
||||||
|
@ -154,7 +154,8 @@ describe CeleryScript::Corpus do
|
||||||
"resource_id" => 23, # Mutated to "0" later..
|
"resource_id" => 23, # Mutated to "0" later..
|
||||||
"label" => "mounted_tool_id",
|
"label" => "mounted_tool_id",
|
||||||
"value" => 1 } }
|
"value" => 1 } }
|
||||||
checker = CeleryScript::Checker.new(CeleryScript::AstNode.new(ast), corpus, device)
|
checker = CeleryScript::Checker
|
||||||
|
.new(CeleryScript::AstNode.new(**ast), corpus, device)
|
||||||
expect(checker.valid?).to be(true)
|
expect(checker.valid?).to be(true)
|
||||||
expect(checker.tree.args[:resource_id].value).to eq(device.id)
|
expect(checker.tree.args[:resource_id].value).to eq(device.id)
|
||||||
end
|
end
|
||||||
|
@ -167,7 +168,7 @@ describe CeleryScript::Corpus do
|
||||||
"resource_id" => fake_id,
|
"resource_id" => fake_id,
|
||||||
"label" => "foo",
|
"label" => "foo",
|
||||||
"value" => "Should Fail" } }
|
"value" => "Should Fail" } }
|
||||||
hmm = CeleryScript::AstNode.new(ast)
|
hmm = CeleryScript::AstNode.new(**ast)
|
||||||
expect(hmm.args.fetch(:resource_id).value).to eq(fake_id)
|
expect(hmm.args.fetch(:resource_id).value).to eq(fake_id)
|
||||||
checker = CeleryScript::Checker.new(hmm, corpus, device)
|
checker = CeleryScript::Checker.new(hmm, corpus, device)
|
||||||
expect(checker.valid?).to be(false)
|
expect(checker.valid?).to be(false)
|
||||||
|
@ -180,7 +181,7 @@ describe CeleryScript::Corpus do
|
||||||
"resource_id" => 0,
|
"resource_id" => 0,
|
||||||
"label" => "foo",
|
"label" => "foo",
|
||||||
"value" => "Should Fail" } }
|
"value" => "Should Fail" } }
|
||||||
checker = CeleryScript::Checker.new(CeleryScript::AstNode.new(ast),
|
checker = CeleryScript::Checker.new(CeleryScript::AstNode.new(**ast),
|
||||||
corpus,
|
corpus,
|
||||||
device)
|
device)
|
||||||
expect(checker.valid?).to be(false)
|
expect(checker.valid?).to be(false)
|
||||||
|
@ -222,7 +223,7 @@ describe CeleryScript::Corpus do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "sets a MAX_WAIT_MS limit for `wait` nodes" do
|
it "sets a MAX_WAIT_MS limit for `wait` nodes" do
|
||||||
bad = CeleryScript::AstNode.new({
|
bad = CeleryScript::AstNode.new(**{
|
||||||
kind: "wait",
|
kind: "wait",
|
||||||
args: { milliseconds: CeleryScriptSettingsBag::MAX_WAIT_MS + 10 },
|
args: { milliseconds: CeleryScriptSettingsBag::MAX_WAIT_MS + 10 },
|
||||||
})
|
})
|
||||||
|
@ -236,7 +237,7 @@ describe CeleryScript::Corpus do
|
||||||
pg = PointGroups::Create.run!(device: device,
|
pg = PointGroups::Create.run!(device: device,
|
||||||
name: "cs checks",
|
name: "cs checks",
|
||||||
point_ids: [])
|
point_ids: [])
|
||||||
bad = CeleryScript::AstNode.new({
|
bad = CeleryScript::AstNode.new(**{
|
||||||
kind: "point_group",
|
kind: "point_group",
|
||||||
args: { point_group_id: pg.id },
|
args: { point_group_id: pg.id },
|
||||||
})
|
})
|
||||||
|
@ -247,7 +248,7 @@ describe CeleryScript::Corpus do
|
||||||
|
|
||||||
it "disallows invalid `point_group` nodes" do
|
it "disallows invalid `point_group` nodes" do
|
||||||
device.auto_sync_transaction do
|
device.auto_sync_transaction do
|
||||||
bad = CeleryScript::AstNode.new({
|
bad = CeleryScript::AstNode.new(**{
|
||||||
kind: "point_group",
|
kind: "point_group",
|
||||||
args: { point_group_id: -1 },
|
args: { point_group_id: -1 },
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue