Refactor spec to use be_false replace eq false

This commit is contained in:
Billy.Zheng 2023-03-09 12:39:25 +08:00
parent 48c7a2bde6
commit e2528d93dd
3 changed files with 18 additions and 18 deletions

View file

@ -7,7 +7,7 @@ module Ameba::AST
node = as_node("return 22") node = as_node("return 22")
flow_expression = FlowExpression.new node, false flow_expression = FlowExpression.new node, false
flow_expression.node.should_not be_nil flow_expression.node.should_not be_nil
flow_expression.in_loop?.should eq false flow_expression.in_loop?.should be_false
end end
describe "#delegation" do describe "#delegation" do

View file

@ -93,7 +93,7 @@ module Ameba::AST
it "returns false if this is a break out of loop" do it "returns false if this is a break out of loop" do
node = as_node("break") node = as_node("break")
subject.flow_command?(node, false).should eq false subject.flow_command?(node, false).should be_false
end end
it "returns true if this is a next in a loop" do it "returns true if this is a next in a loop" do
@ -103,7 +103,7 @@ module Ameba::AST
it "returns false if this is a next out of loop" do it "returns false if this is a next out of loop" do
node = as_node("next") node = as_node("next")
subject.flow_command?(node, false).should eq false subject.flow_command?(node, false).should be_false
end end
it "returns true if this is raise" do it "returns true if this is raise" do
@ -123,7 +123,7 @@ module Ameba::AST
it "returns false otherwise" do it "returns false otherwise" do
node = as_node("foobar") node = as_node("foobar")
subject.flow_command?(node, false).should eq false subject.flow_command?(node, false).should be_false
end end
end end
@ -195,7 +195,7 @@ module Ameba::AST
break break
end end
CRYSTAL CRYSTAL
subject.flow_expression?(node).should eq false subject.flow_expression?(node).should be_false
end end
it "returns true if this until consumed by flow expressions" do it "returns true if this until consumed by flow expressions" do
@ -213,7 +213,7 @@ module Ameba::AST
break break
end end
CRYSTAL CRYSTAL
subject.flow_expression?(node).should eq false subject.flow_expression?(node).should be_false
end end
it "returns true if this expressions consumed by flow expressions" do it "returns true if this expressions consumed by flow expressions" do
@ -230,7 +230,7 @@ module Ameba::AST
exp1 exp1
exp2 exp2
CRYSTAL CRYSTAL
subject.flow_expression?(node).should eq false subject.flow_expression?(node).should be_false
end end
end end
@ -242,12 +242,12 @@ module Ameba::AST
it "returns false if it has a receiver" do it "returns false if it has a receiver" do
node = as_node "obj.raise e" node = as_node "obj.raise e"
subject.raise?(node).should eq false subject.raise?(node).should be_false
end end
it "returns false if size of the arguments doesn't match" do it "returns false if size of the arguments doesn't match" do
node = as_node "raise" node = as_node "raise"
subject.raise?(node).should eq false subject.raise?(node).should be_false
end end
end end
@ -264,12 +264,12 @@ module Ameba::AST
it "returns false if it has a receiver" do it "returns false if it has a receiver" do
node = as_node "obj.exit" node = as_node "obj.exit"
subject.exit?(node).should eq false subject.exit?(node).should be_false
end end
it "returns false if size of the arguments doesn't match" do it "returns false if size of the arguments doesn't match" do
node = as_node "exit 1, 1" node = as_node "exit 1, 1"
subject.exit?(node).should eq false subject.exit?(node).should be_false
end end
end end
@ -291,12 +291,12 @@ module Ameba::AST
it "returns false if it has a receiver" do it "returns false if it has a receiver" do
node = as_node "obj.abort" node = as_node "obj.abort"
subject.abort?(node).should eq false subject.abort?(node).should be_false
end end
it "returns false if size of the arguments doesn't match" do it "returns false if size of the arguments doesn't match" do
node = as_node "abort 1, 1, 1" node = as_node "abort 1, 1, 1"
subject.abort?(node).should eq false subject.abort?(node).should be_false
end end
end end
@ -308,12 +308,12 @@ module Ameba::AST
it "returns false if it has a receiver" do it "returns false if it has a receiver" do
node = as_node "obj.loop" node = as_node "obj.loop"
subject.loop?(node).should eq false subject.loop?(node).should be_false
end end
it "returns false if size of the arguments doesn't match" do it "returns false if size of the arguments doesn't match" do
node = as_node "loop 1" node = as_node "loop 1"
subject.loop?(node).should eq false subject.loop?(node).should be_false
end end
end end

View file

@ -44,12 +44,12 @@ module Ameba::Cli
it "defaults rules? flag to false" do it "defaults rules? flag to false" do
c = Cli.parse_args %w(file.cr) c = Cli.parse_args %w(file.cr)
c.rules?.should eq false c.rules?.should be_false
end end
it "defaults skip_reading_config? flag to false" do it "defaults skip_reading_config? flag to false" do
c = Cli.parse_args %w(file.cr) c = Cli.parse_args %w(file.cr)
c.skip_reading_config?.should eq false c.skip_reading_config?.should be_false
end end
it "accepts --rules flag" do it "accepts --rules flag" do
@ -59,7 +59,7 @@ module Ameba::Cli
it "defaults all? flag to false" do it "defaults all? flag to false" do
c = Cli.parse_args %w(file.cr) c = Cli.parse_args %w(file.cr)
c.all?.should eq false c.all?.should be_false
end end
it "accepts --all flag" do it "accepts --all flag" do