This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Gigasecond | |
| def self.from(date) | |
| return date + 1000000000 | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Gigasecond #convert from class to module | |
| extend self | |
| GIGASECOND = 1e9 #use constant | |
| def from(date) #date must be in Time.utc format | |
| return date + GIGASECOND | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rails generate cucumber:install capybara | |
| rails generate cucumber_rails_training_wheels:install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rails generate migration AddDirectorToMovies director:string | |
| bundle exec rake db:migrate #apply migration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Feature: Add the ability to search by director | |
| As a movie fan | |
| So that I can find movies with my favorite director | |
| I want to be able to add a director to a movie and find other movies with that director | |
| Background: movies in database | |
| Given the following movies exist: | |
| | title | rating | director | release_date | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Given(/^the following movies exist:$/) do |movies_table| | |
| movies_table.hashes.each do |movie| | |
| # each returned element will be a hash whose key is the table header. | |
| Movie.create(movie) | |
| end | |
| end | |
| Then(/^the director of "([^"]*)" should be "([^"]*)"$/) do |movie, director| | |
| pending | |
| #still need to do this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # TL;DR: YOU SHOULD DELETE THIS FILE | |
| # | |
| # This file is used by web_steps.rb, which you should also delete | |
| # | |
| # You have been warned | |
| module NavigationHelpers | |
| # Maps a name to a path. Used by the | |
| # | |
| # When /^I go to (.+)$/ do |page_name| | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /for edit.html.haml and new.html.haml | |
| = label :movie, :director, 'Director' | |
| = text_field :movie, 'director' | |
| /for index.html.haml | |
| %table#movies | |
| %thead | |
| %tr | |
| ...blah |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Given(/^the following movies exist:$/) do |movies_table| | |
| movies_table.hashes.each do |movie| | |
| # each returned element will be a hash whose key is the table header. | |
| Movie.create(movie) | |
| end | |
| end | |
| Then(/^the director of "([^"]*)" should be "([^"]*)"$/) do |movie, director| | |
| expect(Movie.find_by_title(movie).director).to eq director #RSpec assertion | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Complement | |
| def self.of_dna(dna) | |
| rna = "" | |
| dna.split("").each do |nucleotide| | |
| case nucleotide | |
| when "G" | |
| rna << "C" | |
| when "C" | |
| rna << "G" | |
| when "T" |