1

私はMichael Harltのチュートリアルに従っています。そして、私は Web 開発の初心者です。

SO 私は test を書いている間に多くのエラーに直面しています。私はエラーログを共有しています。インターネットで検索し、自分のコードをよく調べましたが、エラーの内容がわからないので、コードとエラーログの両方を共有しています。
スペックファイルのコード。

require 'spec_helper'


 describe "Static pages" do
        subject{ page }



  describe "Home page" do
        before {visit root_path}

        it { should have_selector('h1',  text: 'Sample App')}
        it {should have_selector ('title',  text: full_title(''))}
       it { should_not have_selector 'title',  text: '|Home'}
   end


describe "Help page" do
         before {visit help_path}

         it { should have_selector('h1',        text:'Help')}
         it { should have_selector('title',     text: full_title('Help'))}

end
    describe "About page"do
          before {visit about_path}

          it {should have_selector('h1',       text:'About')}
          it {should have_selector('title',     text: full_title('About US'))}
    end

  describe "Contact page" do
           before { visit contact_path}

           it {should have_selector('h1',       text:'Contact')}
           it{should have_selector('title',     text: full_title('Contact'))}
  end
end

メソッドのコードfull_title()

   module ApplicationHelper
         def full_title(page_title)
        base_title="Ruby on Rails Tutorial Sample App"
         if page_title.empty?
         base_title
         else
        "#{base_title} | #{page_title} "
         end
         end

   end

そしてエラーログは

コマンド bundle exec rspec spec/requests/static_pages_spec.rb 実行後

it {should have_selector('title',title: full_title(''))} ^

C:/sample_app/spec/request/static_pages_spec.rb:15 syntax error,unexpected keyword_end,expecting '}'
**C:/sample_app/spec/request/static_pages_spec.rb:15 syntax error,unexpected keyword_end,expecting '}' **


@spullen の spec_helper ファイル

require 'spec_helper'
  describe StaticPagesHelper do
      pending "add some examples to (or delete) #{__FILE__}"
  end
4

0 に答える 0