spec/granite/form/model/scopes_spec.rb in granite-form-0.5.0 vs spec/granite/form/model/scopes_spec.rb in granite-form-0.6.0
- old
+ new
@@ -7,18 +7,18 @@
attribute :name, String
class << self
def except_first
- scope[1..-1]
+ scope[1..]
end
def no_mars
scope.delete_if { |i| i.name == 'Mars' }
end
- private
+ private
def hidden_method() end
end
end
end
@@ -43,10 +43,15 @@
context do
let(:scope) { model.scope([model.new(name: 'Hello'), model.new(name: 'World'), model.new(name: 'Mars')]) }
specify { expect(scope).to be_instance_of model.scope_class }
- specify { expect { model.scope([model.new(name: 'Hello'), {}]) }.to raise_error Granite::Form::AssociationTypeMismatch }
+
+ specify do
+ expect do
+ model.scope([model.new(name: 'Hello'), {}])
+ end.to raise_error Granite::Form::AssociationTypeMismatch
+ end
context 'scopes' do
specify { expect(scope.except_first).to be_instance_of model.scope_class }
specify { expect(scope.no_mars).to be_instance_of model.scope_class }
specify { expect(scope.except_first).to eq(model.scope([model.new(name: 'World'), model.new(name: 'Mars')])) }