RailsApps / rails_apps_composer

A gem with recipes to create Rails application templates for Rails starter apps.
http://railsapps.github.io/rails_apps_composer/
1.42k stars 304 forks source link

failing tests when using omniauth-facebook authentication with mongoid #216

Closed akshatpradhan closed 10 years ago

akshatpradhan commented 11 years ago

Given I pass the option to use omniauth with facebook and mongoid to the rails_composer for a basic todo app

    question  Install an example application?
          1)  I want to build my own application
          2)  membership/subscription/saas
          3)  rails-prelaunch-signup
          4)  rails3-bootstrap-devise-cancan
          5)  rails3-devise-rspec-cucumber
          6)  rails3-mongoid-devise
          7)  rails3-mongoid-omniauth
          8)  rails3-subdomains
   railsapps  Enter your selection: 1
      recipe  Running setup recipe...
       setup  Your operating system is darwin12.3.0.
       setup  You are using Ruby version 1.9.3.
       setup  You are using Rails version 3.2.13.
    question  Web server for development?
          1)  WEBrick (default)
          2)  Thin
          3)  Unicorn
          4)  Puma
       setup  Enter your selection: 2
    question  Web server for production?
          1)  Same as development
          2)  Thin
          3)  Unicorn
          4)  Puma
       setup  Enter your selection: 1
    question  Database used in development?
          1)  SQLite
          2)  PostgreSQL
          3)  MySQL
          4)  MongoDB
       setup  Enter your selection: 4
    question  How will you connect to MongoDB?
          1)  Mongoid
       setup  Enter your selection: 1
    question  Template engine?
          1)  ERB
          2)  Haml
          3)  Slim (experimental)
       setup  Enter your selection: 1
    question  Unit testing?
          1)  Test::Unit
          2)  RSpec
          3)  MiniTest
       setup  Enter your selection: 2
    question  Integration testing?
          1)  None
          2)  RSpec with Capybara
          3)  Cucumber with Capybara
          4)  Turnip with Capybara
          5)  MiniTest with Capybara
       setup  Enter your selection: 3
    question  Continuous testing?
          1)  None
          2)  Guard
       setup  Enter your selection: 1
    question  Fixture replacement?
          1)  None
          2)  Factory Girl
          3)  Machinist
          4)  Fabrication
       setup  Enter your selection: 2
    question  Front-end framework?
          1)  None
          2)  Twitter Bootstrap
          3)  Zurb Foundation
          4)  Skeleton
          5)  Just normalize CSS for consistent styling
       setup  Enter your selection: 2
    question  Twitter Bootstrap version?
          1)  Twitter Bootstrap (Less)
          2)  Twitter Bootstrap (Sass)
       setup  Enter your selection: 1
    question  Add support for sending email?
          1)  None
          2)  Gmail
          3)  SMTP
          4)  SendGrid
          5)  Mandrill
       setup  Enter your selection: 2
    question  Authentication?
          1)  None
          2)  Devise
          3)  OmniAuth
       setup  Enter your selection: 3
    question  OmniAuth provider?
          1)  Facebook
          2)  Twitter
          3)  GitHub
          4)  LinkedIn
          5)  Google-Oauth-2
          6)  Tumblr
       setup  Enter your selection: 1
    question  Authorization?
          1)  None
          2)  CanCan with Rolify
       setup  Enter your selection: 2
    question  Use a form builder gem?
          1)  None
          2)  SimpleForm
       setup  Enter your selection: 2
    question  Install a starter app?
          1)  None
          2)  Home Page
          3)  Home Page, User Accounts
          4)  Home Page, User Accounts, Admin Dashboard
       setup  Enter your selection: 3

When I run the test suite inside the generated app

Then I see these failing tests related to twitter instead of facebook.

➜  todo git:(master) rake
/Users/akshatpradhan/.rbenv/versions/1.9.3-p392/bin/ruby -S rspec ./spec/controllers/home_controller_spec.rb ./spec/controllers/sessions_controller_spec.rb ./spec/controllers/users_controller_spec.rb ./spec/models/user_spec.rb
FFF.*......

Pending:
  User add some examples to (or delete) /Users/akshatpradhan/Sites/tmp/todo/spec/models/user_spec.rb
    # No reason given
    # ./spec/models/user_spec.rb:4

Failures:

  1) SessionsController GET 'new' redirectes users to authentication
     Failure/Error: assert_redirected_to '/auth/twitter'
     MiniTest::Assertion:
       Expected response to be a redirect to <http://test.host/auth/twitter> but was a redirect to <http://test.host/auth/facebook>
     # ./spec/controllers/sessions_controller_spec.rb:19:in `block (3 levels) in <top (required)>'

  2) SessionsController creates new user redirects new users with blank email to fill in their email
     Failure/Error: page.should have_content('Logged in as Bob')
       expected to find text "Logged in as Bob" in "Todo Logout × Please enter your email address. Email"
     # ./spec/controllers/sessions_controller_spec.rb:27:in `block (3 levels) in <top (required)>'

  3) SessionsController creates new user redirects users with email back to root_url
     Failure/Error: page.should have_content('Signed in!')
       expected to find text "Signed in!" in "Todo Logout × Please enter your email address. Email"
     # ./spec/controllers/sessions_controller_spec.rb:34:in `block (3 levels) in <top (required)>'

Finished in 5.35 seconds
11 examples, 3 failures, 1 pending

Failed examples:

rspec ./spec/controllers/sessions_controller_spec.rb:17 # SessionsController GET 'new' redirectes users to authentication
rspec ./spec/controllers/sessions_controller_spec.rb:24 # SessionsController creates new user redirects new users with blank email to fill in their email
rspec ./spec/controllers/sessions_controller_spec.rb:31 # SessionsController creates new user redirects users with email back to root_url

Randomized with seed 36570

rake aborted!
/Users/akshatpradhan/.rbenv/versions/1.9.3-p392/bin/ruby -S rspec ./spec/controllers/home_controller_spec.rb ./spec/controllers/sessions_controller_spec.rb ./spec/controllers/users_controller_spec.rb ./spec/models/user_spec.rb failed

Tasks: TOP => default => spec
(See full trace by running task with --trace)

Is it possible that the twitter omniauth tests in the recipe are being used instead of the facebook omniauth tests in the recipe? https://github.com/akshatpradhan/todo/blob/master/spec/factories/users.rb

MarkDBlackwell commented 11 years ago

Yes, OmniAuth via Twitter did remain in recipes/testing.rb erroneously—this would be fixed by lines 154 and 157 of pull request #218.

DanielKehoe commented 10 years ago

I'm closing out old issues. Please open a new issue if you see any problems. Thanks for your support.