Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Grader TEST database seems NOT to be empty! #36

@efiguerc

Description

@efiguerc

Hi @tansaku, @bill-auger

In my development environment I checked the number of Movie records in both Development and Test databases as you can see here:

edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ RAILS_ENV=test rails c
Loading test environment (Rails 4.2.6)
2.3.0 :001 > Movie.count
   (0.3ms)  SELECT COUNT(*) FROM "movies"
 => 0 
2.3.0 :002 > exit
edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ RAILS_ENV=development rails c                        
Loading development environment (Rails 4.2.6)
2.3.0 :001 > Movie.count
   (0.1ms)  SELECT COUNT(*) FROM "movies"
 => 0 
2.3.0 :002 > exit

edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $  

The I tried cucumber and rspec:

edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ cucumber
Using the default profile...
Feature: search for movies by director
  As a movie buff
  So that I can find movies with my favorite director
  I want to include and serach on director information in movies I enter

  Background: movies in database      # features/search_for_movies_by_director.feature:7
    Given the following movies exist: # features/step_definitions/movie_steps.rb:1
      | title        | rating | director     | release_date |
      | Star Wars    | PG     | George Lucas | 1977-05-25   |
      | Blade Runner | PG     | Ridley Scott | 1982-06-25   |
      | Alien        | R      |              | 1979-05-25   |
      | THX-1138     | R      | George Lucas | 1971-03-11   |

  Scenario: add director to existing movie                # features/search_for_movies_by_director.feature:16
    When I go to the edit page for "Alien"                # features/step_definitions/web_steps.rb:48
    And I fill in "Director" with "Ridley Scott"          # features/step_definitions/web_steps.rb:60
    And I press "Update Movie Info"                       # features/step_definitions/web_steps.rb:52
    Then the director of "Alien" should be "Ridley Scott" # features/step_definitions/movie_steps.rb:9

  Scenario: find movie with same director                       # features/search_for_movies_by_director.feature:22
    Given I am on the details page for "Star Wars"              # features/step_definitions/web_steps.rb:44
    When I follow "Find Movies With Same Director"              # features/step_definitions/web_steps.rb:56
    Then I should be on the Similar Movies page for "Star Wars" # features/step_definitions/web_steps.rb:230
    And I should see "THX-1138"                                 # features/step_definitions/web_steps.rb:105
    But I should not see "Blade Runner"                         # features/step_definitions/web_steps.rb:123

  Scenario: can't find similar movies if we don't know director (sad path) # features/search_for_movies_by_director.feature:29
    Given I am on the details page for "Alien"                             # features/step_definitions/web_steps.rb:44
    Then I should not see "Ridley Scott"                                   # features/step_definitions/web_steps.rb:123
    When I follow "Find Movies With Same Director"                         # features/step_definitions/web_steps.rb:56
    Then I should be on the home page                                      # features/step_definitions/web_steps.rb:230
    And I should see "'Alien' has no director info"                        # features/step_definitions/web_steps.rb:105

3 scenarios (3 passed)
17 steps (17 passed)
0m0.775s
Coverage report generated for Cucumber Features to /home/ubuntu/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes/coverage. 41 / 54 LOC (75.93%) covered.
edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ 
edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ rspec
.............

Finished in 0.21096 seconds (files took 2.74 seconds to load)
13 examples, 0 failures

Coverage report generated for Cucumber Features, RSpec to /home/ubuntu/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes/coverage. 54 / 54 LOC (100.0%) covered.
edagarfc:~/workspace/hw-acceptance-unit-test-cycle/rottenpotatoes (master) $ 

Then when I submited the zip file for grading I got this:

----BEGIN RSPEC----
--------------------------------------------------------------------------------
/usr/share/rvm/rubies/ruby-2.2.2/bin/ruby -I/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.6.0/lib:/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-support-3.6.0/lib /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.6.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
F......F.....

Failures:

  1) MoviesController#index renders index template
     Failure/Error: expect(assigns(:movies).count).to eq 3

       expected: 3
            got: 13

       (compared using ==)
     # ./spec/controllers/movies_controller_spec.rb:14:in `block (3 levels) in '

  2) MoviesController#search_directors when the current movie has a director renders search directors view
     Failure/Error: expect(Movie.count).to eq 3

       expected: 3
            got: 13

       (compared using ==)
     # ./spec/controllers/movies_controller_spec.rb:118:in `block (4 levels) in '

Finished in 0.10881 seconds (files took 2.02 seconds to load)
13 examples, 2 failures

Failed examples:

rspec ./spec/controllers/movies_controller_spec.rb:8 # MoviesController#index renders index template
rspec ./spec/controllers/movies_controller_spec.rb:115 # MoviesController#search_directors when the current movie has a director renders search directors view

Coverage report generated for Cucumber Features, RSpec to /home/ubuntu/rag/submissions/5522a22342656a7dd8965e34d077a07d/assignment4/2017-10-11-17-18-11/coverage. 54 / 54 LOC (100.0%) covered.

/usr/share/rvm/rubies/ruby-2.2.2/bin/ruby -S bundle exec cucumber  --profile default
/usr/share/rvm/rubies/ruby-2.2.2/bin/ruby -I/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.6.0/lib:/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-support-3.6.0/lib /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.6.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed

---------------------------------------- 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions