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

alias given and given! to let and let! #840

Merged
merged 1 commit into from Oct 4, 2012
Merged

alias given and given! to let and let! #840

merged 1 commit into from Oct 4, 2012

Conversation

danryan
Copy link
Contributor

@danryan danryan commented Oct 3, 2012

I use let all over the place in vanilla RSpec, but something just didn't feel right using it with the feature DSL. This pull request adds aliases for let and let! in the form of given and given!. It's only syntactic sugar but it helps remind me I'm writing acceptance tests.

Using these aliases, the DSL example in the README could be rewritten as:

feature "Signing up" do
  given(:user) { User.make(:email => 'user@example.com', :password => 'caplin') }

  scenario "Signing in as another user" do
    within("#session") do
      fill_in 'Login', :with => user.email
      fill_in 'Password', :with => user.password
    end
    click_link 'Sign in'
  end

end

jnicklas added a commit that referenced this pull request Oct 4, 2012
alias given and given! to let and let!
@jnicklas jnicklas merged commit e73628d into teamcapybara:master Oct 4, 2012
@jnicklas
Copy link
Collaborator

jnicklas commented Oct 4, 2012

I like it!

@fabianoalmeida
Copy link

That's great @danryan. Congratulations! Simple and useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants