Skip to content

Commit

Permalink
Extending ActionController::IntegrationTest instead of ActionControll…
Browse files Browse the repository at this point in the history
…er::Integration::Session fixes error with Webrat's select method
  • Loading branch information
brynary committed Nov 26, 2008
1 parent 01fcd0d commit 4f530cf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/webrat/core/methods.rb
Expand Up @@ -32,8 +32,6 @@ def webrat_session
:chooses, :choose,
:selects, :select,
:attaches_file, :attach_file,
:cookies,
:response,
:current_page,
:current_url,
:clicks_link, :click_link,
Expand All @@ -47,7 +45,8 @@ def webrat_session
:selects_date, :selects_time, :selects_datetime,
:select_date, :select_time, :select_datetime,
:wait_for_page_to_load,
:field_by_xpath
:field_by_xpath,
:field_with_id


end
Expand Down
1 change: 1 addition & 0 deletions lib/webrat/core/session.rb
Expand Up @@ -215,6 +215,7 @@ def page_scope #:nodoc:
def_delegators :current_scope, :should_not_see
def_delegators :current_scope, :field_labeled
def_delegators :current_scope, :field_by_xpath
def_delegators :current_scope, :field_with_id

private
# accessor for testing
Expand Down
6 changes: 4 additions & 2 deletions lib/webrat/rails.rb
Expand Up @@ -76,10 +76,12 @@ class Session #:nodoc:
require "webrat/rails/redirect_actions"
include Webrat::RedirectActions
end

include Webrat::Methods
end
end

class IntegrationTest
include Webrat::Methods
end
end

Webrat.configuration.mode = :rails

4 comments on commit 4f530cf

@al
Copy link

@al al commented on 4f530cf Nov 27, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rails.rb:82 “class IntegrationTest” causes “action_controller/integration.rb:583: superclass mismatch for class IntegrationTest”. Should it be “class IntegrationTest < Test::Unit::TestCase”?

@fairchild
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same problem.

@al
Copy link

@al al commented on 4f530cf Nov 28, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems only to be an issue when using as plugin. The gem works okay (something to do with the loading order maybe?).

@weplay
Copy link

@weplay weplay commented on 4f530cf Nov 28, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

I just pushed a commit that should resolve this by adding a require statement. Also, I switched to using class_eval which will fail fast if the class isn’t defined rather than potentially defining a class if it isn’t found.

Please sign in to comment.