spec/helpers_spec.rb in evil-front-rails-0.3.0 vs spec/helpers_spec.rb in evil-front-rails-0.4.0
- old
+ new
@@ -7,33 +7,33 @@
describe 'flying_quotes' do
it 'accepts blocks' do
get :flying_quotes
- response.should be_success
- response.body.should == '<span class="space-before-quote"> </span>' +
- '<span class="quotes">«<b>text</b>»</span>'
+ expect(response).to be_success
+ expect(response.body).to eq '<span class="space-before-quote"> </span>' +
+ '<span class="quotes">«<b>text</b>»</span>'
end
end
describe 'auto_flying_quotes' do
it 'accepts blocks' do
get :auto_flying_quotes
- response.should be_success
- response.body.should == '<b><span class="quotes">«a»</span></b>'
+ expect(response).to be_success
+ expect(response.body).to eq '<b><span class="quotes">«a»</span></b>'
end
end
describe 'russian_typograph' do
it 'accepts blocks' do
get :russian_typograph
- response.should be_success
- response.body.should == '<b>«<ф>»</b>'
+ expect(response).to be_success
+ expect(response.body).to eq '<b>«<ф>»</b>'
end
end
describe 'typograph_by_locale' do
@@ -41,19 +41,19 @@
I18n.locale = :en
end
it 'accepts blocks' do
get :typograph_by_locale
- response.should be_success
- response.body.should == '“a”'
+ expect(response).to be_success
+ expect(response.body).to eq '“a”'
end
it 'returns origin blocks on unknown locale' do
I18n.locale = :fr
get :typograph_by_locale
- response.should be_success
- response.body.should == '"a"'
+ expect(response).to be_success
+ expect(response.body).to eq '"a"'
end
end
describe 'head_tag' do
@@ -65,81 +65,40 @@
Rails.env = @env
end
it 'generates head tag content' do
get :head
- response.should be_success
- response.body.should == '<head><meta charset="UTF-8" />' +
- '<title>1</title><style>a {}</style></head>'
+ expect(response).to be_success
+ expect(response.body).to eq '<head><meta charset="UTF-8" />' +
+ '<title>1</title><style>a {}</style></head>'
end
it 'adds statistics in production' do
Rails.env = ActiveSupport::StringInquirer.new('production')
get :head
- response.should be_success
- response.body.should == '<head><meta charset="UTF-8" />' +
- "<title>1</title><style>a {}</style>stat\n</head>"
+ expect(response).to be_success
+ expect(response.body).to eq '<head><meta charset="UTF-8" />' +
+ '<title>1</title>' +
+ "<style>a {}</style>stat\n</head>"
end
it 'ignores statistics on demand' do
Rails.env = ActiveSupport::StringInquirer.new('production')
get :unstat
- response.should be_success
- response.body.should == '<head><meta charset="UTF-8" />' +
- '<title>2</title></head>'
+ expect(response).to be_success
+ expect(response.body).to eq '<head><meta charset="UTF-8" />' +
+ '<title>2</title></head>'
end
end
- describe 'standard_assets' do
-
- it 'includes links' do
- Rails.env = ActiveSupport::StringInquirer.new('development')
- get :standard_assets
- response.should be_success
- response.body.should ==
- '<link href="/stylesheets/application.css" ' +
- 'media="all" rel="stylesheet" />' +
- '<script src="/assets/jquery.js"></script>' +
- '<script src="/javascripts/application.js"></script>'
- end
-
- it 'includes CDN jQuery' do
- Rails.env = ActiveSupport::StringInquirer.new('production')
- get :standard_assets
- response.should be_success
- response.body.should ==
- '<link href="/stylesheets/application.css" ' +
- 'media="all" rel="stylesheet" />' +
- '<script src="//ajax.googleapis.com/ajax/libs/jquery/' +
- "#{ JqueryCdn::VERSION }/jquery.min.js\"></script>" +
- "<script>window.jQuery || " +
- "document.write(unescape('%3Cscript " +
- "src=\"/assets/jquery.js\">%3C/script>'))</script>" +
- '<script src="/javascripts/application.js"></script>'
- end
-
- it 'includes additional libraries' do
- Rails.env = ActiveSupport::StringInquirer.new('development')
- get :library
- response.should be_success
- response.body.should ==
- '<link href="/stylesheets/application.css" ' +
- 'media="all" rel="stylesheet" />' +
- '<script src="/assets/jquery.js"></script>' +
- '<link src="a" />' +
- '<script src="/javascripts/application.js"></script>'
- end
-
- end
-
describe 'tel' do
it 'renders telephone link' do
get :tel
- response.should be_success
- response.body.should == '<a class="tel phone" data-role="call" ' +
- 'href="tel:+555">+5 55</a>'
+ expect(response).to be_success
+ expect(response.body).to eq '<a class="tel phone" data-role="call" ' +
+ 'href="tel:+555">+5 55</a>'
end
end
end