diff options
| author | Luc Donnet | 2017-12-20 10:26:07 +0100 | 
|---|---|---|
| committer | GitHub | 2017-12-20 10:26:07 +0100 | 
| commit | 3df4c7feb809fc6e8eeeec5010147c42447388d8 (patch) | |
| tree | d121af6b31090bcbb46320cbb3c15e6af3d2cf89 /spec/helpers | |
| parent | 2f4094c28cb5f7b32cf40f231e904dafbac7eafb (diff) | |
| parent | 443de38df52143f72d97308c28ac68f99e009757 (diff) | |
| download | chouette-core-3df4c7feb809fc6e8eeeec5010147c42447388d8.tar.bz2 | |
Merge pull request #151 from af83/5281-workbench-import-structural-bug-reading-zip
5281 workbench import structural bug reading zip
Diffstat (limited to 'spec/helpers')
| -rw-r--r-- | spec/helpers/common_helper_spec.rb | 39 | 
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/helpers/common_helper_spec.rb b/spec/helpers/common_helper_spec.rb new file mode 100644 index 000000000..1ffdc5bab --- /dev/null +++ b/spec/helpers/common_helper_spec.rb @@ -0,0 +1,39 @@ +RSpec.describe CommonHelper do + +  subject do +    Object.new.extend( described_class ) +  end + +  describe 'string_keys_to_symbols' do +    context 'nullpotency on symbol keys' do +      it { expect(subject.string_keys_to_symbols({})).to eq({}) } +      it do +        expect(subject.string_keys_to_symbols( +          a: 1, b: 2 +        )).to  eq(a: 1, b: 2) +      end +    end + +    context 'changing string keys' do +      it { expect(subject.string_keys_to_symbols('alpha' => 100)).to eq(alpha: 100) } + +      it do +        expect( subject.string_keys_to_symbols('a' => 10, b: 20) ) +          .to eq(a: 10, b: 20) +      end +      it do +        expect( subject.string_keys_to_symbols('a' => 10, 'b' => 20) ) +          .to eq(a: 10, b: 20) +      end +    end + +    context 'keys, not values, are changed' do +      it do +        expect(subject.string_keys_to_symbols(a: 'a', 'b' => 'b', 'c' => :c)) +          .to eq(a: 'a', b: 'b', c: :c) +      end +    end + + +  end +end  | 
