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

[padrino-gen] should create spec/app/spec_helper for sub-apps #1062

Closed
postmodern opened this Issue Feb 20, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@postmodern
Contributor

postmodern commented Feb 20, 2013

When one generates a sub-app, a special test_helper.rb /spec_helperfile should be created which overrides theapp` method used by RackTest.

require 'spec_helper'

def app
  ##
  # You can handle all padrino applications using instead:
  #   Padrino.application
  API.tap { |app|  }
end

@ghost ghost assigned achiu Apr 8, 2013

@achiu

This comment has been minimized.

Show comment
Hide comment
@achiu

achiu Apr 18, 2013

Member

Hm that's an interesting idea. Though this would lead to alot of helpers eventually no?
I've been getting around this by doing something like https://github.com/padrino/padrino-framework/blob/master/padrino-gen/lib/padrino-gen/generators/components/tests/riot.rb#L31.
This allows me to specify in my test something like:

describe "MyController" do
  before do
    app MySubApp.tap { |a| }
  end
  # ...
end

Does this seem like a good solution? If so I can push this to the other generated test/spec helpers.

Member

achiu commented Apr 18, 2013

Hm that's an interesting idea. Though this would lead to alot of helpers eventually no?
I've been getting around this by doing something like https://github.com/padrino/padrino-framework/blob/master/padrino-gen/lib/padrino-gen/generators/components/tests/riot.rb#L31.
This allows me to specify in my test something like:

describe "MyController" do
  before do
    app MySubApp.tap { |a| }
  end
  # ...
end

Does this seem like a good solution? If so I can push this to the other generated test/spec helpers.

@achiu achiu closed this in 53e2c5d Apr 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment