Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow test to be an unparenthesized method #410

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions fixtures/small/rspec_its_actual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
opinion: "please don't name your DSL 'describe', but a little too late now I guess" do
end

test "some really good test name" do
assert(true)
end

RSpec.describe "bees" do
end

Expand Down
4 changes: 4 additions & 0 deletions fixtures/small/rspec_its_expected.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
) do
end

test "some really good test name" do
assert(true)
end

RSpec.describe "bees" do
end

Expand Down
4 changes: 2 additions & 2 deletions librubyfmt/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ pub fn args_has_single_def_expression(args: &ArgsAddStarOrExpressionListOrArgsFo
}

lazy_static! {
static ref RSPEC_METHODS: HashSet<&'static str> = vec!["it", "describe"].into_iter().collect();
static ref TEST_METHODS: HashSet<&'static str> = vec!["it", "describe", "test"].into_iter().collect();
static ref GEMFILE_METHODS: HashSet<&'static str> = vec![
// Gemfile
"gem",
Expand Down Expand Up @@ -2762,7 +2762,7 @@ fn can_elide_parens_for_reserved_names(cc: &[CallChainElement]) -> bool {
Ident(_, ident, _),
))) => {
let ident = ident.as_str();
RSPEC_METHODS.contains(ident) || GEMFILE_METHODS.contains(ident)
TEST_METHODS.contains(ident) || GEMFILE_METHODS.contains(ident)
}
_ => false,
};
Expand Down