spec/unit/settings_spec.rb in evil-client-2.0.0 vs spec/unit/settings_spec.rb in evil-client-2.1.0
- old
+ new
@@ -24,15 +24,16 @@
describe ".policy" do
context "for the root schema settings" do
subject { klass.policy }
it "subclasses Evil::Client::Policy" do
- expect(subject.superclass).to eq Evil::Client::Policy
+ expect(subject.superclass).to eq described_class.policy
+ expect(described_class.policy.superclass).to eq Evil::Client::Policy
end
it "refers back to the settings" do
- expect(subject.settings).to eq klass
+ expect(subject.model).to eq klass
end
end
context "for the scope settings" do
let(:scope_schema) { double :scope_schema }
@@ -42,11 +43,11 @@
it "subclasses policy of parent settings" do
expect(subject.superclass).to eq klass.policy
end
it "refers back to the settings" do
- expect(subject.settings).to eq scope_klass
+ expect(subject.model).to eq scope_klass
end
end
end
describe ".option" do
@@ -64,26 +65,13 @@
it "allows the option to be renamed" do
expect { klass.option :basic_auth, as: :something }.not_to raise_error
end
end
- describe ".param" do
- before do
- klass.param :id, optional: true
- klass.param :email, optional: true
- end
-
- subject { settings.options }
-
- it "acts like .option" do
- expect(subject).to eq id: 42
- end
- end
-
describe ".let" do
before do
- klass.param :id
+ klass.option :id
klass.let(:square_id) { id**2 }
end
subject { settings.square_id }
@@ -99,11 +87,11 @@
end
end
describe ".validate" do
before do
- klass.param :name
+ klass.option :name
klass.validate { errors.add :name_present if name.to_s == "" }
end
let(:options) { { "name" => "" } }
@@ -205,10 +193,10 @@
expect(subject).to respond_to :except
end
end
describe "#datetime" do
- let(:time) { DateTime.parse "2017-07-21 16:58:00 UTC" }
+ let(:time) { Time.parse "2017-07-21 16:58:00 UTC" }
subject { settings.datetime value }
context "with a parceable string" do
let(:value) { time.to_s }