Skip to content

Add dependency on Lucky #103

@matthewmcgarvey

Description

@matthewmcgarvey

Related #20

LuckyFlow was meant to be like Capybara which can be used with any framework or library so it does not have a dependency on Lucky. The problem is that there are still helpful methods added that use classes provided by Lucky and Avram but because the dependency is missing we can't actually use or test those methods because they don't exist from LuckyFlow's point of view.

I believe that we should go ahead and make that dependency explicit so that we can fully exploit that connection and test it correctly.

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.navigate_to(url)
end

def fill_form(
form : Avram::SaveOperation.class | Avram::Operation.class,
**fields_and_values
)
fields_and_values.each do |name, value|
fill "#{form.param_key}:#{name}", with: value
end
end

private def have_current_path(action : Lucky::Action.class)
have_current_path(action.route)
end
private def have_current_path(route_helper : Lucky::RouteHelper)
HaveCurrentPathExpectation.new(route_helper.path)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions