История изменений
Исправление theNamelessOne, (текущая версия) :
В некоторых случаях отсутствие необходимости ставить скобки при вызове методов улучшает читаемость кода, а также вкупе с другими фичами языка позволяет строить удобные и понятные DSL. Взять хоть тот же RSpec:
describe "Authentication" do
subject { page }
describe "signin page" do
before { visit signin_path }
it { should have_title 'Sign in' }
it { should have_header 'Sign in' }
context "with invalid information" do
before { click_button 'Sign in' }
it { should have_title 'Sign in' }
it { should_not have_link 'Profile' }
it { should_not have_link 'Settings' }
it { should_not have_link 'Users' }
it { should_not have_link 'Sign out', href: signout_path }
it { should have_link 'Sign in', href: signin_path }
it { should have_error_message 'Invalid' }
context "after visiting another page" do
before { click_link "Home" }
it { should_not have_error_message }
end
end
end
end
Кроме того, никто не запрещает ставить скобки, если уж если ты без них жить не можешь.
Исправление theNamelessOne, :
В некоторых случаях отсутствие необходимости ставить скобки при вызове методов улучшает читаемость кода, а также вкупе с другими фичами языка позволяет строить удобные и понятные DSL. Взять хоть тот же RSpec:
describe "Authentication" do
subject { page }
describe "signin page" do
before { visit signin_path }
it { should have_title 'Sign in' }
it { should have_header 'Sign in' }
context "with invalid information" do
before { click_button 'Sign in' }
it { should have_title 'Sign in' }
it { should_not have_link 'Profile' }
it { should_not have_link 'Settings' }
it { should_not have_link 'Users' }
it { should_not have_link 'Sign out', href: signout_path }
it { should have_link 'Sign in', href: signin_path }
it { should have_error_message 'Invalid' }
context "after visiting another page" do
before { click_link "Home" }
it { should_not have_error_message }
end
end
end
end
Исходная версия theNamelessOne, :
В некоторых случаях отсутствие необходимости ставить скобки при вызове методов улучшает читаемость кода, а также вкупе с другими фичами языка позволяет строить удобные и понятные DSL. Взять хоть тот же Rspec:
describe "Authentication" do
subject { page }
describe "signin page" do
before { visit signin_path }
it { should have_title 'Sign in' }
it { should have_header 'Sign in' }
context "with invalid information" do
before { click_button 'Sign in' }
it { should have_title 'Sign in' }
it { should_not have_link 'Profile' }
it { should_not have_link 'Settings' }
it { should_not have_link 'Users' }
it { should_not have_link 'Sign out', href: signout_path }
it { should have_link 'Sign in', href: signin_path }
it { should have_error_message 'Invalid' }
context "after visiting another page" do
before { click_link "Home" }
it { should_not have_error_message }
end
end
end
end