Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 0fbc35b2f6
Fetching contributors…

Cannot retrieve contributors at this time

64 lines (54 sloc) 1.706 kB
# encoding: UTF-8
require "#{File.dirname(__FILE__)}/spec_helper"
include SpecHelper
describe "routes" do
describe "home route" do
before do
@u = FactoryGirl.create :user
end
it "returns the homepage for unsigned user" do
get '/'
last_response.body.must_include 'Farhang'
end
it "returns a 404 upon false address" do
get '/ferf'
last_response.status.must_equal 404
end
it "returns the dashboard for signed user" do
post '/user/login', :email => @u.email, :password => 'secret'
get '/'
last_response.body.must_include 'Einträge'
end
end
describe "search routes" do
it "gets and finds a url search" do
FactoryGirl.create :lemma, :lemma => 'Apfel'
get '/search/Apfel'
last_response.body.must_include 'Apfel'
last_response.body.wont_include 'Augapfel'
get '/search/apfel'
last_response.body.must_include 'Apfel'
last_response.body.wont_include 'Augapfel'
end
it "gets and finds a params search" do
FactoryGirl.create :lemma, :lemma => 'Apfel'
get '/search', :term => 'Apfel'
follow_redirect!
last_response.body.must_include 'Apfel'
last_response.body.wont_include 'Augapfel'
get '/search', :term => 'apfel'
follow_redirect!
last_response.body.must_include 'Apfel'
last_response.body.wont_include 'Augapfel'
end
it "can find a search term with parens in it" do
FactoryGirl.create :lemma, :lemma => 'ca (*:cirka)'
get '/search', :term => 'ca%20(*:cirka)'
follow_redirect!
last_response.body.must_include 'cirka'
end
after do
Lemma.delete_all
end
end
end
Jump to Line
Something went wrong with that request. Please try again.