spec/lib/base_spec.rb in wrap_it-0.2.0 vs spec/lib/base_spec.rb in wrap_it-1.0.0
- old
+ new
@@ -1,8 +1,8 @@
require 'spec_helper'
-describe WrapIt::Base do
+describe WrapIt::Base, type: :wrapped do
it 'have #tag getter' do
expect(successor.tag).to eq 'div'
end
it 'have default_tag class method' do
@@ -12,42 +12,19 @@
it 'gets tag name from options' do
expect(successor(tag: 'p').tag).to eq 'p'
end
- it 'extends @arguments with ArgumentsArray module' do
- args = nil
- successor_class.class_eval { after_initialize { args = @arguments } }
- successor
- expect(args).to be_kind_of WrapIt::ArgumentsArray
- end
-
- it 'symbolizes options hash' do
- successor.send :options=, 'my' => 'value'
- expect(successor.options).to eq(my: 'value', class: [])
- end
-
- it 'sanitizes options class' do
- successor.send :options=, class: [:one, :two, :two]
- expect(successor.options[:class]).to eq %w(one two)
- end
-
it 'calls after_initialize' do
- successor_class.class_eval { after_initialize { add_html_class :a } }
+ successor_class.class_eval { after_initialize { html_class << :a } }
expect(successor.html_class).to eq %w(a)
end
it 'not omits content by default' do
expect(successor.omit_content?).to be_false
end
it 'provides way to omit content in subclasses' do
successor_class.class_eval { omit_content }
expect(successor.omit_content?).to be_true
- end
-
- it 'removes `helper_name` from options' do
- successor(helper_name: 'test')
- expect(successor.options).to_not include :helper_name
- expect(successor.instance_variable_get(:@helper_name)).to eq :test
end
end