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

Move Lucky specific methods to a separate module #20

Open
paulcsmith opened this issue Jun 12, 2018 · 1 comment
Open

Move Lucky specific methods to a separate module #20

paulcsmith opened this issue Jun 12, 2018 · 1 comment
Labels
good first issue Good for newcomers help wanted Additional expertise needed

Comments

@paulcsmith
Copy link
Member

paulcsmith commented Jun 12, 2018

Move these...

  • def visit(action : Lucky::Action.class, as user : User? = nil)
    visit(action.route, as: user)
    end
    def visit(route_helper : Lucky::RouteHelper, as user : User? = nil)
    url = route_helper.url
    uri = URI.parse(url)
    if uri.query && user
    url += "&backdoor_user_id=#{user.id}"
    elsif uri.query.nil? && user
    url += "?backdoor_user_id=#{user.id}"
    end
    session.url = url
    end
  • # Fill a form created by Lucky that uses a LuckyRecord::Form
    #
    # Note that Lucky and LuckyRecord are required to use this method
    #
    # ```
    # fill_form QuestionForm,
    # title: "Hello there!",
    # body: "Just wondering what day it is"
    # ```
    def fill_form(
    form : LuckyRecord::Form.class | LuckyRecord::VirtualForm.class,
    **fields_and_values
    )
    fields_and_values.each do |name, value|
    fill "#{form.new.form_name}:#{name}", with: value
    end
    end

Into a module called LuckyFlow::LuckyHelpers

Will likely require splitting spec into Lucky specific tests.

There should also be a flag similar to what is done in Carbon: https://github.com/luckyframework/carbon/blob/master/README.md#development that let's you run specs with and without Lucky to ensure that it works for no matter what

@paulcsmith paulcsmith added the help wanted Additional expertise needed label Jun 12, 2018
@paulcsmith paulcsmith added the good first issue Good for newcomers label Jul 2, 2018
@jwoertink
Copy link
Member

One question here is, would the lucky specs be default, or if this is geared for any framework, then would you want something to wrap the spec call like ./bin/spec which runs crystal spec -D include-lucky or whatever?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Additional expertise needed
Projects
None yet
Development

No branches or pull requests

2 participants