Inanc Gumus inancgumus

View 301redirectrails.rb
1 2 3 4 5 6 7 8 9 10
before_filter :redirect_to_www
 
def redirect_to_www
return unless Rails.env.production? # we only want this feature for production
 
www = 'www.foo.com'
if request.env['HTTP_HOST'] != www
path = "http://#{www + request_path}"
redirect_to path, :status => 301
end
View gist:1165272
1 2 3 4 5 6 7 8 9 10
require 'spec_helper'
 
feature "Spot:" do
 
SPOT = "#spot"
 
background do
@something = Something.make!
visit root_path
end
View gist:1165269
1 2 3 4 5 6 7 8 9 10
Then /^I should see the something within the "([^\"]*)"$/ do |the_scope|
@something = Something.get
@scope = the_scope.id
end
 
Then /^I should see the "picture" of the something$/ do
picture = "#{@something.title.downcase.cssize}.png"
within(@scope) {
page_should_have_image(picture)
}
View gist:1165262
1 2 3 4 5 6 7 8 9 10
 Feature: A feature
Something should quickly see our best somethings
 
Scenario: I can see a something
Given a something exists
When I go to the homepage
Then I should see the something within the "spot"
And I should see the "title" of the something
And I should see the "summary" of the something
And I should see the "picture" of the something
Something went wrong with that request. Please try again.