This file contains 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
# my_test.rb (first line, or at least before you require your 'my_app.rb') | |
ENV['RACK_ENV'] = 'test' | |
# my_app.rb (your sinatra application) | |
enable :sessions unless test? | |
# my_test.rb (in your test block) | |
session = {} OR session = { "username" => "test" } | |
get '/', {}, 'rack.session' => session | |
assert_equal 'value', session[:key] |
This file contains 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
it "Homepage should redirect to locations#index" do | |
get "/" | |
last_response.should be_redirect # This works, but I want it to be more specific | |
follow_redirect! | |
last_request.url.should == 'http://example.org/locations' | |
end |
This file contains 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
If you press the "f" key in normal mode, Vim will move the cursor forward to whatever character you input after "f" is pressed. As an example, consider the following line: | |
a quick brown fox | |
If the cursor was at the absolute beginning of the line, and you pressed "fb" in normal mode, Vim would move the cursor so that it was positioned over the "b" in "brown". | |
If you press "F", Vim will move the cursor backwards instead of forward. Given the previous sentence, if pressed "Fq", and the cursor was at the end of the line, it would move to the "q" in "quick". |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |