named_struct 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/named_struct/config.rb +1 -1
- data/lib/named_struct/version.rb +1 -1
- data/spec/named_struct/config_spec.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48a1c595feb14871618253053d7be409dd0eb203
|
4
|
+
data.tar.gz: 32098978ee3853722724ff27eac4d3c664b5636d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 435a06f747429496c60ebfe63fef4e991967cbc08ef708427c7402efa424467b514bc329cb76a54529676f35a91221341cc9571596ef600b49439fd5ea314fee
|
7
|
+
data.tar.gz: 9acd5fc0edbf0f002430b6aa8e3dbc6a792d9d01d7230bedf9be9d484654a60fdec4f221a0040ff1c52e84429c5f7dc4a7ef7841be435e2c8a7beef7f5e896b6
|
data/lib/named_struct/config.rb
CHANGED
@@ -19,7 +19,7 @@ module NamedStruct
|
|
19
19
|
end
|
20
20
|
keys = args.keys
|
21
21
|
required_keys = self.class.members
|
22
|
-
if keys != required_keys
|
22
|
+
if keys.sort != required_keys.sort
|
23
23
|
if keys.size > required_keys.size
|
24
24
|
raise(ArgumentError, "wrong number of arguments (%d for %d)"%
|
25
25
|
[keys.size, required_keys.size])
|
data/lib/named_struct/version.rb
CHANGED
@@ -45,6 +45,13 @@ RSpec.describe NamedStruct::Config do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
context "with keyword arguments" do
|
48
|
+
context "with all required arguments (random order)" do
|
49
|
+
subject{ MyConfig.new(b: 10, a: 11)}
|
50
|
+
it { is_expected.to be_kind_of(MyConfig) }
|
51
|
+
it { expect{ subject }.to_not raise_error }
|
52
|
+
it { expect(subject.a).to eq(11) }
|
53
|
+
it { expect(subject.b).to eq(10) }
|
54
|
+
end
|
48
55
|
context "with all required arguments" do
|
49
56
|
subject{ MyConfig.new(a: 10, b: 11)}
|
50
57
|
it { is_expected.to be_kind_of(MyConfig) }
|