aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/general_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/general_controller_spec.rb')
-rw-r--r--spec/controllers/general_controller_spec.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 642ed0e05..c7d9b5ce3 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -12,7 +12,7 @@ describe GeneralController, "when trying to show the blog" do
it "should fail silently if the blog is returning an error" do
FakeWeb.register_uri(:get, %r|.*|, :body => "Error", :status => ["500", "Error"])
get :blog
- response.status.should == "200 OK"
+ response.status.should == 200
assigns[:blog_items].count.should == 0
end
end
@@ -35,7 +35,7 @@ end
describe GeneralController, "when showing the frontpage" do
- integrate_views
+ render_views
before do
public_body = mock_model(PublicBody, :name => "Example Public Body",
@@ -58,14 +58,14 @@ describe GeneralController, "when showing the frontpage" do
it "should render the front page with default language" do
get :frontpage
- response.should have_tag('html[lang="en"]')
+ response.should have_selector('html[lang="en"]')
end
it "should render the front page with default language" do
old_default_locale = I18n.default_locale
I18n.default_locale = "es"
get :frontpage
- response.should have_tag('html[lang="es"]')
+ response.should have_selector('html[lang="es"]')
I18n.default_locale = old_default_locale
end
@@ -77,7 +77,7 @@ describe GeneralController, "when showing the frontpage" do
old_default_locale = I18n.default_locale
I18n.default_locale = "es"
get :frontpage
- response.should have_tag('html[lang="es"]')
+ response.should have_selector('html[lang="es"]')
I18n.default_locale = old_default_locale
end
@@ -87,7 +87,7 @@ describe GeneralController, "when showing the frontpage" do
accept_language = "es-ES,en-GB,en-US;q=0.8,en;q=0.6"
request.env['HTTP_ACCEPT_LANGUAGE'] = accept_language
get :frontpage
- response.should have_tag('html[lang="es"]')
+ response.should have_selector('html[lang="es"]')
request.env['HTTP_ACCEPT_LANGUAGE'] = nil
end
@@ -120,13 +120,13 @@ describe GeneralController, "when showing the frontpage" do
it 'should generate URLs without a locale prepended' do
get :frontpage
- response.should_not have_text(@default_lang_home_link)
+ response.should_not contain @default_lang_home_link
end
it 'should render the front page in the default language when no locale param
is present and the session locale is not the default' do
get(:frontpage, {}, {:locale => 'es'})
- response.should_not have_text(@other_lang_home_link)
+ response.should_not contain @other_lang_home_link
end
end
@@ -134,7 +134,7 @@ describe GeneralController, "when showing the frontpage" do
INCLUDE_DEFAULT_LOCALE_IN_URLS is true' do
set_default_locale_in_urls(true)
get :frontpage
- response.should have_text(@default_lang_home_link)
+ response.body.should match /#{@default_lang_home_link}/
end
after do
@@ -150,28 +150,28 @@ describe GeneralController, "when showing the frontpage" do
it "should generate URLs with a locale prepended when there's more than one locale set" do
get :frontpage
- response.should have_text(home_link_regex)
+ response.body.should match home_link_regex
end
it "should use our test PO files rather than the application one" do
I18n.default_locale = :es
get :frontpage
- response.should have_text(/XOXO/)
+ response.body.should match /XOXO/
I18n.default_locale = :en
end
it "should generate URLs that include the locale when using one that includes an underscore" do
I18n.default_locale = :"en_GB"
get :frontpage
- response.should have_text(/href="\/en_GB\//)
+ response.body.should match /href="\/en_GB\//
I18n.default_locale = :en
end
it "should fall back to the language if the territory is unknown" do
I18n.default_locale = :"en_US"
get :frontpage
- response.should have_text(/href="\/en\//)
- response.should_not have_text(/href="\/en_US\//)
+ response.body.should match /href="\/en\//
+ response.body.should_not match /href="\/en_US\//
I18n.default_locale = :en
end
@@ -181,7 +181,7 @@ describe GeneralController, "when showing the frontpage" do
FastGettext.default_available_locales = I18n.available_locales = ['en']
get :frontpage
- response.should_not have_text(home_link_regex)
+ response.should_not contain home_link_regex
FastGettext.default_available_locales = old_fgt_available_locales
I18n.available_locales = old_i18n_available_locales
@@ -235,7 +235,7 @@ end
describe GeneralController, 'when using xapian search' do
- integrate_views
+ render_views
# rebuild xapian index after fixtures loaded
before(:each) do