Sha256: 4abf2f475732308db060d68309ef18039e17d6fa21ce6d43a0858991256c794a

Contents?: true

Size: 936 Bytes

Versions: 6

Compression:

Stored size: 936 Bytes

Contents

require "spec_helper"

feature 'Visiting a page that checks for a feature' do

  let(:feature) { FactoryGirl.create(:green_flag_feature, code: 'test_feature') }

  scenario 'when the feature does not exist' do
    visit '/feature_checks'
    expect(page).to have_text("NOT ENABLED")
  end

  scenario 'when the feature exists, and is closed' do
    feature
    visit '/feature_checks'
    expect(page).to have_text("NOT ENABLED")
  end

  scenario 'when the feature exists, and is closed, but the user is whitelisted' do
    visit '/feature_checks'
    expect(page).to have_text("NOT ENABLED")

    # manually enable the feature for the visitor
    fd = GreenFlag::FeatureDecision.order(:created_at).last
    fd.enabled = true
    fd.save!

    visit '/feature_checks'
    expect(page).to have_text("IS ENABLED")
  end

  scenario 'when the feature exists, and is open' do
    pending "Set up a rule with everyone 100% open"
  end


end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
green_flag-0.4.0 spec/features/visitor_spec.rb
green_flag-0.3.0 spec/features/visitor_spec.rb
green_flag-0.2.0 spec/features/visitor_spec.rb
green_flag-0.1.2 spec/features/visitor_spec.rb
green_flag-0.1.1 spec/features/visitor_spec.rb
green_flag-0.1.0 spec/features/visitor_spec.rb