spec/inputs/readonly_spec.rb in formtastic-3.1.5 vs spec/inputs/readonly_spec.rb in formtastic-4.0.0.rc1
- old
+ new
@@ -1,9 +1,9 @@
# encoding: utf-8
require 'spec_helper'
-describe 'readonly option' do
+RSpec.describe 'readonly option' do
include FormtasticSpecHelper
before do
@output_buffer = ''
@@ -18,30 +18,30 @@
describe "when readonly is found in input_html" do
it "sets readonly attribute" do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => type, input_html: {readonly: true}))
end)
- output_buffer.should have_tag((type == :text ? 'textarea' : 'input') + '[@readonly]')
+ expect(output_buffer).to have_tag((type == :text ? 'textarea' : 'input') + '[@readonly]')
end
end
describe "when readonly not found in input_html" do
describe "when column is not readonly attribute" do
it "doesn't set readonly attribute" do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => type))
end)
- output_buffer.should_not have_tag((type == :text ? 'textarea' : 'input') + '[@readonly]')
+ expect(output_buffer).not_to have_tag((type == :text ? 'textarea' : 'input') + '[@readonly]')
end
end
describe "when column is readonly attribute" do
it "sets readonly attribute" do
input_class = "Formtastic::Inputs::#{type.to_s.camelize}Input".constantize
expect_any_instance_of(input_class).to receive(:readonly_attribute?).at_least(1).and_return(true)
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => type))
end)
- output_buffer.should have_tag((type == :text ? 'textarea' : 'input') + '[@readonly]')
+ expect(output_buffer).to have_tag((type == :text ? 'textarea' : 'input') + '[@readonly]')
end
end
end
end
end