<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>caleb328 (Caleb)</title>
    <link>https://ruby-china.org/caleb328</link>
    <description/>
    <language>en-us</language>
    <item>
      <title>在这问大家一个在测试的时候用 rspec 的问题</title>
      <description>&lt;p&gt;我运行 bundle exec rspec spec/的时候terminal给我了下面的error信息, 跪求大神们来分析一下是哪里出了问题&lt;/p&gt;

&lt;p&gt;CalebdeMacBook-Pro:sample_app Caleb$ bundle exec rspec spec/&lt;/p&gt;

&lt;p&gt;/Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:434:in &lt;code&gt;add_route': Invalid route name, already in use: 'root'  (ArgumentError)
You may have defined two routes with the same name using the&lt;/code&gt;:as&lt;code&gt;option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with&lt;/code&gt;resources` as explained here: 
&lt;a href="http://guides.rubyonrails.org/routing.html#restricting-the-routes-created" rel="nofollow" target="_blank"&gt;http://guides.rubyonrails.org/routing.html#restricting-the-routes-created&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1445:in &lt;code&gt;add_route'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1422:in&lt;/code&gt;decomposed_match'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1403:in &lt;code&gt;block in match'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1394:in&lt;/code&gt;each'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1394:in &lt;code&gt;match'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:330:in&lt;/code&gt;root'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/mapper.rb:1464:in &lt;code&gt;root'
    from /Users/Caleb/rubyonrails/sample_app/config/routes.rb:13:in&lt;/code&gt;block in '
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:in &lt;code&gt;instance_exec'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:in&lt;/code&gt;eval_block'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:319:in &lt;code&gt;draw'
    from /Users/Caleb/rubyonrails/sample_app/config/routes.rb:1:in&lt;/code&gt;'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in &lt;code&gt;load'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in&lt;/code&gt;block in load'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in &lt;code&gt;load_dependency'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:223:in&lt;/code&gt;load'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in &lt;code&gt;block in load_paths'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in&lt;/code&gt;each'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in &lt;code&gt;load_paths'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:16:in&lt;/code&gt;reload!'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:26:in &lt;code&gt;block in updater'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.3/lib/active_support/file_update_checker.rb:75:in&lt;/code&gt;call'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.3/lib/active_support/file_update_checker.rb:75:in &lt;code&gt;execute'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:27:in&lt;/code&gt;updater'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:6:in &lt;code&gt;execute_if_updated'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/application/finisher.rb:69:in&lt;/code&gt;block in &lt;a rel="nofollow" target="_blank"&gt;module:Finisher&lt;/a&gt;'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/initializable.rb:30:in &lt;code&gt;instance_exec'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/initializable.rb:30:in&lt;/code&gt;run'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/initializable.rb:55:in &lt;code&gt;block in run_initializers'
    from /Users/Caleb/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:150:in&lt;/code&gt;block in tsort_each'
    from /Users/Caleb/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:183:in &lt;code&gt;block (2 levels) in each_strongly_connected_component'
    from /Users/Caleb/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:219:in&lt;/code&gt;each_strongly_connected_component_from'
    from /Users/Caleb/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:182:in &lt;code&gt;block in each_strongly_connected_component'
    from /Users/Caleb/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:in&lt;/code&gt;each'
    from /Users/Caleb/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:in &lt;code&gt;each_strongly_connected_component'
    from /Users/Caleb/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:148:in&lt;/code&gt;tsort_each'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/initializable.rb:54:in &lt;code&gt;run_initializers'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/application.rb:215:in&lt;/code&gt;initialize!'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.3/lib/rails/railtie/configurable.rb:30:in &lt;code&gt;method_missing'
    from /Users/Caleb/rubyonrails/sample_app/config/environment.rb:5:in&lt;/code&gt;'
    from /Users/Caleb/rubyonrails/sample_app/spec/spec_helper.rb:3:in &lt;code&gt;require'
    from /Users/Caleb/rubyonrails/sample_app/spec/spec_helper.rb:3:in&lt;/code&gt;'
    from /Users/Caleb/rubyonrails/sample_app/spec/models/event_spec.rb:1:in &lt;code&gt;require'
    from /Users/Caleb/rubyonrails/sample_app/spec/models/event_spec.rb:1:in&lt;/code&gt;'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in &lt;code&gt;load'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in&lt;/code&gt;block in load_spec_files'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in &lt;code&gt;each'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in&lt;/code&gt;load_spec_files'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in &lt;code&gt;run'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in&lt;/code&gt;run'
    from /Users/Caleb/.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'&lt;/p&gt;</description>
      <author>caleb328</author>
      <pubDate>Mon, 17 Mar 2014 19:44:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/17952</link>
      <guid>https://ruby-china.org/topics/17952</guid>
    </item>
  </channel>
</rss>
