Вопрос

Я получаю сообщения об ошибках, когда я запускаю SPEC SPEC. Когда я прочитал выход терминала, похоже, что может быть что-то происходит с RVM. Все в курсе. Если кто-то может предложить руководство по этим ошибкам, я признателен за это. Я также включаю в себя контроллер страницы, который я также построил, но я следую в руководстве, и поэтому он в основном просто выворачиваемая копия.

    Z-Kidds-MacBook-Air:sample_app zkidd$ rspec spec
/Users/zkidd/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `load': /Users/zkidd/Sites/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb:87: syntax error, unexpected tIDENTIFIER, expecting tCONSTANT (SyntaxError)
...                      ::content => "#{@base_title} +  | Cont...
...                               ^
/Users/zkidd/Sites/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb:87: syntax error, unexpected ')', expecting keyword_end
/Users/zkidd/Sites/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb:103: syntax error, unexpected $end, expecting keyword_end
    from /Users/zkidd/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `block in load_spec_files'
    from /Users/zkidd/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `map'
    from /Users/zkidd/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/configuration.rb:306:in `load_spec_files'
    from /Users/zkidd/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:18:in `run'
    from /Users/zkidd/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:55:in `run_in_process'
    from /Users/zkidd/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:46:in `run'
    from /Users/zkidd/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:10:in `block in autorun'
Z-Kidds-MacBook-Air:sample_app zkidd$ 

Вот страницы_Controller_spec.rb

require 'spec_helper'

describe PagesController do
  render_views

  before(:each) do
    #
    # Define @base_title here.
    #
  end

  describe "GET 'home'" do
    it "should be successful" do
      get 'home'
      response.should be_success
    end

    it "should have the right title" do
      get 'home'
      response.should have_selector("title",
                                    :content => "#{@base_title} +  | Home")
    end
  end

  describe "GET 'contact'" do
    it "should be successful" do
      get 'contact'
      response.should be_success
    end

    it "should have the right title" do
      get 'contact'
      response.should have_selector("title",
                                    ::content => "#{@base_title} +  | Contact")
    end
  end

  describe "GET 'about'" do
    it "should be successful" do
      get 'about'
      response.should be_success
    end

    it "should have the right title" do
      get 'about'
      response.should have_selector("title",
                                    :content => "#{@base_title} +  | About")
    end
  end
end
Это было полезно?

Решение

::content => должно быть :content =>

Другие советы

Если вы работаете с TextMate, вы, вероятно, должны попытаться использовать Dr-Nics Ruby and Rails Pubdes. У них есть встроенная синтаксическая проверка!

https://github.com/drnic/

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top