rails-4-1-rspec-3-0 icon indicating copy to clipboard operation
rails-4-1-rspec-3-0 copied to clipboard

Can't pass `bundle exec spec` on 05_controller_basics branch

Open yokoto opened this issue 10 years ago • 3 comments

The following is the error in executing bundle exec rspec on 05_controller_basics branch:

Failures:

  1) ContactsController GET #index without params[:letter] populates an array of all contacts
     Failure/Error: expect(assigns(:contacts)).to match_array([smith, jones])
       expected collection contained:  [#<Contact id: 980190963, firstname: "Madelynn", lastname: "Smith", email: "[email protected]", created_at: "2015-08-17 00:57:45", updated_at: "2015-08-17 00:57:45">, #<Contact id: 980190964, firstname: "Dorothy", lastname: "Jones", email: "[email protected]", created_at: "2015-08-17 00:57:45", updated_at: "2015-08-17 00:57:45">]
       actual collection contained:    [#<Contact id: 298486374, firstname: "MyString", lastname: "MyString", email: "MyString", created_at: "2015-08-13 18:55:03", updated_at: "2015-08-13 18:55:03">, #<Contact id: 980190962, firstname: "MyString", lastname: "MyString", email: "MyString", created_at: "2015-08-13 18:55:03", updated_at: "2015-08-13 18:55:03">, #<Contact id: 980190963, firstname: "Madelynn", lastname: "Smith", email: "[email protected]", created_at: "2015-08-17 00:57:45", updated_at: "2015-08-17 00:57:45">, #<Contact id: 980190964, firstname: "Dorothy", lastname: "Jones", email: "[email protected]", created_at: "2015-08-17 00:57:45", updated_at: "2015-08-17 00:57:45">]
       the extra elements were:        [#<Contact id: 298486374, firstname: "MyString", lastname: "MyString", email: "MyString", created_at: "2015-08-13 18:55:03", updated_at: "2015-08-13 18:55:03">, #<Contact id: 980190962, firstname: "MyString", lastname: "MyString", email: "MyString", created_at: "2015-08-13 18:55:03", updated_at: "2015-08-13 18:55:03">]
     # ./spec/controllers/contacts_controller_spec.rb:24:in `block (4 levels) in <top (required)>'

Finished in 1.15 seconds (files took 3.81 seconds to load)
32 examples, 1 failure

Failed examples:

rspec ./spec/controllers/contacts_controller_spec.rb:20 # ContactsController GET #index without params[:letter] populates an array of all contacts

yokoto avatar Aug 17 '15 01:08 yokoto

Hi, I haven't been able to reproduce. Could you please provide the following?

  • The contents of your Gemfile.lock, in case there's a discrepancy in a gem version
  • run rspec like this: bundle exec spec --order random
    • does it still fail?
    • The last line will read "Randomized with seed ". What is the seed value?

ruralocity avatar Aug 18 '15 23:08 ruralocity

Thank you for your response!

  • The contents of your Gemfile.lock, in case there's a discrepancy in a gem version

This is my Gemfile.lock, immediately after git checkout -b my_branch_name origin/05_controller_basics.

GEM                                                                                      
  remote: https://rubygems.org/
  specs:
    actionmailer (4.1.1)
      actionpack (= 4.1.1)
      actionview (= 4.1.1)
      mail (~> 2.5.4)
    actionpack (4.1.1)
      actionview (= 4.1.1)
      activesupport (= 4.1.1)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    actionview (4.1.1)
      activesupport (= 4.1.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
    activemodel (4.1.1)
      activesupport (= 4.1.1)
      builder (~> 3.1)
    activerecord (4.1.1)
      activemodel (= 4.1.1)
      activesupport (= 4.1.1)
      arel (~> 5.0.0)
    activesupport (4.1.1)
      i18n (~> 0.6, >= 0.6.9)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.1)
      tzinfo (~> 1.1)
    addressable (2.3.6)
    arel (5.0.1.20140414130214)
    bcrypt (3.1.7)
    bootstrap-sass (3.1.1.1)
      sass (~> 3.2)
    builder (3.2.2)
    capybara (2.4.3)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    childprocess (0.5.3)
      ffi (~> 1.0, >= 1.0.11)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.7.0)
    database_cleaner (1.3.0)
    diff-lcs (1.2.5)
    erubis (2.7.0)
    execjs (2.1.0)
    factory_girl (4.4.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.4.1)
      factory_girl (~> 4.4.0)
      railties (>= 3.0.0)
    faker (1.4.3)
      i18n (~> 0.5)
    ffi (1.9.3)
    hike (1.2.3)
    i18n (0.6.9)
    jbuilder (2.0.7)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (3.1.0)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.1)
    launchy (2.4.2)
      addressable (~> 2.3)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.25.1)
    mini_portile (0.6.0)
    minitest (5.3.4)
    multi_json (1.10.1)
    nokogiri (1.6.3.1)
      mini_portile (= 0.6.0)
    polyglot (0.3.5)
    rack (1.5.2)
    rack-test (0.6.2)                                                                    
      rack (>= 1.0)
    rails (4.1.1)
      actionmailer (= 4.1.1)
      actionpack (= 4.1.1)
      actionview (= 4.1.1)
      activemodel (= 4.1.1)
      activerecord (= 4.1.1)
      activesupport (= 4.1.1)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.1.1)
      sprockets-rails (~> 2.0)
    railties (4.1.1)
      actionpack (= 4.1.1)
      activesupport (= 4.1.1)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.3.2)
    rdoc (4.1.1)
      json (~> 1.4)
    rspec-core (3.1.3)
      rspec-support (~> 3.1.0)
    rspec-expectations (3.1.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.1.0)
    rspec-mocks (3.1.0)
      rspec-support (~> 3.1.0)
    rspec-rails (3.1.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.1.0)
      rspec-expectations (~> 3.1.0)
      rspec-mocks (~> 3.1.0)
      rspec-support (~> 3.1.0)
    rspec-support (3.1.0)
    rubyzip (1.1.6)
    sass (3.2.19)
    sass-rails (4.0.3)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.2.0)
      sprockets (~> 2.8, <= 2.11.0)
      sprockets-rails (~> 2.0)
    sdoc (0.4.0)
      json (~> 1.8)
      rdoc (~> 4.0, < 5.0)
    selenium-webdriver (2.43.0)
      childprocess (~> 0.5)
      multi_json (~> 1.0)
      rubyzip (~> 1.0)
      websocket (~> 1.0)
    spring (1.1.3)
    sprockets (2.11.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.1.3)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    sqlite3 (1.3.9)
    thor (0.19.1)
    thread_safe (0.3.4)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (2.2.2)
      coffee-rails
    tzinfo (1.2.1)
      thread_safe (~> 0.1)
    uglifier (2.5.0)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    websocket (1.2.1)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  bcrypt (~> 3.1.7)
  bootstrap-sass (~> 3.1.1)
  capybara (~> 2.4.3)
  coffee-rails (~> 4.0.0)
  database_cleaner (~> 1.3.0)
  factory_girl_rails (~> 4.4.1)
  faker (~> 1.4.3)
  jbuilder (~> 2.0)
  jquery-rails
  launchy (~> 2.4.2)
  rails (= 4.1.1)
  rspec-rails (~> 3.1.0)
  sass-rails (~> 4.0.3)
  sdoc (~> 0.4.0)
  selenium-webdriver (~> 2.43.0)
  spring
  sqlite3
  turbolinks
  uglifier (>= 1.3.0)     

yokoto avatar Aug 19 '15 00:08 yokoto

I could pass the all tests after cloning branch, 05_controller_basics from this repository again. So, the problem should be in my way to proceed the text. Sorry for my misleading issue.

Finished in 1.1 seconds (files took 3.71 seconds to load)
32 examples, 0 failures

yokoto avatar Aug 19 '15 01:08 yokoto