concept new file in category rails

appears as: new file, new files
Rails 3 in Action

This is an excerpt from Manning's book Rails 3 in Action.

This command run the self.up part of this migration. Because this is your first time running migrations in your Rails application, and because you’re using a SQLite3 database, Rails first creates the database in a new file at db/development.sqlite3 and then creates the purchases table inside that. When you run rake db:migrate, it doesn’t just run the self.up method from the latest migration but runs any migration that hasn’t yet been run, allowing you to run multiple migrations sequentially.

In the describe block here you pass through an option of :type => :api. What does this do? Well, you can use it to modify the behavior of this describe block in many ways, such as including modules. The Rack::Test::Methods module you’re going to use needs to be included into each test. Rather than doing this manually, you can use this :type option to do the include for you, as well as some additional behavior. Let’s open a new file at spec/support/api/helper.rb and put the content from the following listing inside.

The first part you’re going to need for this API is two tests: one to make sure you can get XML results back from this API and another for JSON results. Put these new tests in a new file at spec/api/v1/tickets_spec.rb, beginning with the setup required for both of these tests shown in the following listing.