spec/qfill/origin_spec.rb in qfill-0.0.4 vs spec/qfill/origin_spec.rb in qfill-0.1.0
- old
+ new
@@ -1,55 +1,65 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe Qfill::Origin do
- context "#new" do
- context "with no arguments" do
- it "should raise ArgumentError" do
- expect { Qfill::Origin.new() }.to raise_error(ArgumentError)
+ describe '#new' do
+ context 'with no arguments' do
+ it 'raises ArgumentError' do
+ expect { described_class.new }.to raise_error(ArgumentError)
end
end
- context "with name" do
- before :each do
- @arguments = { :name => "High List" }
+
+ context 'with name' do
+ before do
+ @arguments = { name: 'High List' }
end
- it "should not raise any errors" do
- expect { Qfill::Origin.new(@arguments) }.to_not raise_error
+
+ it 'does not raise any errors' do
+ expect { described_class.new(@arguments) }.not_to raise_error
end
- it "should instantiate with name" do
- Qfill::Origin.new(@arguments).name.should == 'High List'
+
+ it 'instantiates with name' do
+ expect(described_class.new(@arguments).name).to eq('High List')
end
end
- context "with elements" do
- before :each do
- @arguments = { :name => "High List",
- :elements => [1,2] }
+
+ context 'with elements' do
+ before do
+ @arguments = { name: 'High List',
+ elements: [1, 2] }
end
- it "should instantiate with elements" do
- Qfill::Origin.new(@arguments).elements.should == [1,2]
+
+ it 'instantiates with elements' do
+ expect(described_class.new(@arguments).elements).to eq([1, 2])
end
end
- context "with backfill" do
- before :each do
- @arguments = { :name => "High List",
- :elements => [1, 2],
- :backfill => "Medium List" }
+
+ context 'with backfill' do
+ before do
+ @arguments = { name: 'High List',
+ elements: [1, 2],
+ backfill: 'Medium List' }
end
- it "should instantiate with elements" do
- Qfill::Origin.new(@arguments).backfill.should == 'Medium List'
+
+ it 'instantiates with elements' do
+ expect(described_class.new(@arguments).backfill).to eq('Medium List')
end
end
- context "with filter" do
- before :each do
- lambda = -> (object) { !object.nil? }
+
+ context 'with filter' do
+ before do
+ lambda = ->(object) { !object.nil? }
@filter = Qfill::Filter.new(lambda)
- @arguments = { :name => "High List",
- :elements => [1, 2],
- :backfill => "Medium List",
- :filter => @filter }
+ @arguments = { name: 'High List',
+ elements: [1, 2],
+ backfill: 'Medium List',
+ filter: @filter }
end
- it "should instantiate with processor" do
- Qfill::Origin.new(@arguments).filter.should be_a(Qfill::Filter)
- Qfill::Origin.new(@arguments).filter.should == @filter
+
+ it 'instantiates with processor' do
+ expect(described_class.new(@arguments).filter).to be_a(Qfill::Filter)
+ expect(described_class.new(@arguments).filter).to eq(@filter)
end
end
end
-
end