Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8543839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:24:20+00:00 2026-06-11T12:24:20+00:00

I’ve been taking the SaaS course, and in Chapter 4 we’re supposed to use

  • 0

I’ve been taking the SaaS course, and in Chapter 4 we’re supposed to use Cucumber. I followed all the instructions and watched the screencast showing how everything worked, but still I’m stuck with this error:

  Scenario: Add a movie                              # features/AddMovie.feature:3

    Given I am on the RottenPotatoes home page       # features/step_definitions/web_steps.rb:44

    When I follow "Add new movie"                    # features/step_definitions/web_steps.rb:56

    Then I should be on the Create New Movie page    # features/step_definitions/web_steps.rb:230

    When I fill in "Title" with "Men In Black"       # features/step_definitions/web_steps.rb:60

    And I select "PG-13" from "Rating"               # features/step_definitions/web_steps.rb:85

    And I press "Save Changes"                       # features/step_definitions/web_steps.rb:52

    Then I should be on the RottenPotatoes home page # features/step_definitions/web_steps.rb:230

      <"/movies"> expected but was
      <"/movies/1">. (MiniTest::Assertion)
      ./features/step_definitions/web_steps.rb:235:in `/^(?:|I )should be on (.+)$/'
      features/AddMovie.feature:10:in `Then I should be on the RottenPotatoes home page'
    And I should see "Men In Black"                  # features/step_definitions/web_steps.rb:105

Failing Scenarios:
cucumber features/AddMovie.feature:3 # Scenario: Add a movie

Feature: User can manually add movie

Scenario: Add a movie
    Given I am on the RottenPotatoes home page
    When I follow "Add new movie"
    Then I should be on the Create New Movie page
    When I fill in "Title" with "Men In Black"
    And I select "PG-13" from "Rating"
    And I press "Save Changes"
    Then I should be on the RottenPotatoes home page
    And I should see "Men In Black"

and the code snippet in path.rb

  def path_to(page_name)
    case page_name

    when /^the home\s?page$/
      '/'
    when /^the RottenPotatoes home page/
        movies_path
    when /^the Create New Movie page/
        new_movie_path
  end

movies_controller.rb

class MoviesController < ApplicationController
def index
    @movies = Movie.all( :order => "title" )
end

def show
    id = params[ :id ] #    retrieve movie ID from URI route
    begin
        @movie = Movie.find( id )
    rescue
        flash[ :warning ] = "The movie was not found."
        redirect_to movies_path
    end
    #   will render app/views/movies/show.html.haml by default
end

def new
    #   default: render 'new' template
end

def create
    @movie = Movie.create( params[ :movie ] )
    flash[ :notice ] = "#{ @movie.title } was successfully created."
    redirect_to movie_path( @movie.id )
end

def edit
    id = params[ :id ]
    @movie = Movie.find_by_id( id )
end

def update
    @movie = Movie.find_by_id params[ :id ]
    @movie.update_attributes!( params[ :movie ] )
    flash[ :notice ] = "#{ @movie.title } was successfully updated."
    redirect_to movie_path( @movie )
end

def destroy
    @movie = Movie.find( params[ :id ] )
    @movie.destroy
    flash[ :notice ] = "Movie '#{ @movie.title }' deleted."
    redirect_to movies_path
end

end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:24:21+00:00Added an answer on June 11, 2026 at 12:24 pm

    Judging from what you’ve posted, it looks like your code and your tests don’t line up. In your test you specify that after saving a new movie:

    Then I should be on the RottenPotatoes home page
    

    Which, judging from your path.rb file, looks like it translates to “should be on the movies index page”. However in your code, you don’t redirect to the movies index page at the end of the create action, you redirect to the show page for the movie that was just created. Which would explain why cucumber complains that it expects <"/movies"> (the movies index page) but got <"/movies/1"> (the page for a movie with id = 1).

    Here’s your create action:

    def create
      @movie = Movie.create( params[ :movie ] )
      flash[ :notice ] = "#{ @movie.title } was successfully created."
      redirect_to movie_path( @movie.id )
    end
    

    See in the last line you have redirect_to movie_path(@movie.id), which tells rails to send you to the page for the movie @movie. That makes sense and is often what you want (i.e. after a user creates a new record, you show them the record they created), but it’s also possible that you want to redirect them to the index page where they can see the movie they added with all the other movies. The solution will be different depending on which result you want.

    Assuming your test is correct, you need to change the last line in your create action to:

    redirect_to movies_path
    

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.