Sha256: b5c26ecea38d68f3f9f0eee655fae33052f26a4da23a2e4d4bf0f88a23c0d63d
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require 'spec_helper' require 'pugin/feature/bandiera' describe 'The bandiera client feature set' do method_hash = { 'show-dissolution': :dissolution?, 'show-register': :register_to_vote?, 'show-election': :election?, 'show-post-election': :post_election? } method_hash.each do |flag_name, method_name| context flag_name do context 'when the feature exists in Bandiera' do before :each do Pugin::Feature::Bandiera.instance_variable_set(:@features, {"#{flag_name}" => true}) end it "returns the value of #{flag_name} in the Bandiera database if it exists" do expect(Pugin::Feature::Bandiera.send(method_name)).to equal(true) end end context 'when the feature does not exist in Bandiera' do before :each do Pugin::Feature::Bandiera.instance_variable_set(:@features, {}) end it "returns false because the feature value is nil" do expect(Pugin::Feature::Bandiera.send(method_name)).to equal(false) end end end end context 'when trying to reset the @features instance variable' do before :each do Pugin::Feature::Bandiera.instance_variable_set(:@features, {'show-register' => true}) end it 'resets the @features instance variable back to nil' do Pugin::Feature::Bandiera.reset expect(@features).to equal(nil) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pugin-0.8.1 | spec/lib/pugin/feature/bandiera_spec.rb |
pugin-0.8.0 | spec/lib/pugin/feature/bandiera_spec.rb |