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

Undefined method `sub' on Ruby 1.9.2-p290 #2

Open
emachnic opened this issue Aug 11, 2011 · 4 comments
Open

Undefined method `sub' on Ruby 1.9.2-p290 #2

emachnic opened this issue Aug 11, 2011 · 4 comments

Comments

@emachnic
Copy link

I've only been able to get tourbus to run on 1.8.7. When I try to run the tours on 1.9.2 I get the following error:

/Users/evan/.rvm/gems/ruby-1.9.2-p290@tourbus/gems/tourbus-2.0.1/lib/tourist.rb:79:in `block in tours': undefined method `sub' for :tour_projects:Symbol (NoMethodError)

Here is my project_test.rb file:

class ProjectTest < Tourist
  def tour_projects
    visit "http://localhost:3000/projects"
    assert_contain 'Listing projects'
  end
end
@dbrady
Copy link
Owner

dbrady commented Aug 11, 2011

Hrrm, I'll look into this as I am able. I notice that linecache can't even build on 1.9.2-p290 so we may be off the reservation altogether here.

@seryl
Copy link

seryl commented Aug 15, 2011

Have a pull request to handle this.

@DoppioJP
Copy link

DoppioJP commented Jul 4, 2012

In tourbus gem v 2.0.1 method tours has this problem. Here is the code from gem:

  # Returns list of tours this tourist knows about. (Meant to be run on a subclass
  # instance; returns the list of tours available).
  def tours
    methods.grep(/^tour_/).map {|m| m.sub(/^tour_/,'')}
  end

To compare the current code on GitHub is:

  # Returns list of tours this tourist knows about. (Meant to be run on a subclass
  # instance; returns the list of tours available).
  def tours
    methods.map(&:to_s).grep(/^tour_/).map {|m| m.sub(/^tour_/,'')}
  end

where the symbols in methods are converted into string already.

Do you recommend getting this gem from source and building it myself? I am currently using it from https://rubygems.org/gems/tourbus

@keithmgould
Copy link

Hiya, I ran into this problem also, and fixed it, though it seems its fixed in the codebase. Just a reminder that your published gem does not seem to reflect the change that DoppioJP mentioned above.

Keith

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

No branches or pull requests

5 participants