Sha256: 4181f5e724ffea3b42043eb1c83ad33b5f1f032fe1171a03dec4e399b5cf76b5

Contents?: true

Size: 1.4 KB

Versions: 35

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Iugu::RegistrationsController do
  before(:each) do
    @request.env["devise.mapping"] = Devise.mappings[:user]
  end

  context "try first" do
    context "enable_guest_user == true" do
      before(:each) do
        IuguSDK::enable_guest_user = true
        post :try_first
      end
      
      after do
        IuguSDK::enable_guest_user = false
      end

      it { flash.now[:notice].should == I18n.t("iugu.notices.guest_login") }
    end

    context "enable_guest_user == false" do
      before(:each) do
        IuguSDK::enable_guest_user = false
      end

      it 'should raise routing error' do
        lambda {
          post :try_first
        }.should raise_error ActionController::RoutingError
      end
    end

  end

  context "new" do
    context "when enable_subscription_features == true and default_subscription_name = nil " do
      before do
        IuguSDK::enable_subscription_features = true
        IuguSDK::default_subscription_name = nil
      end

      after do
        IuguSDK::enable_subscription_features = false
        IuguSDK::default_subscription_name = "free"
      end

      it 'should redirect to pricing' do
        get :new
        response.should redirect_to pricing_index_path
      end

      it 'should not redirect if has param plan' do
        lambda {
          get :new, plan: "test"
        }.should raise_error
      end
    end

  end

end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
iugusdk-1.0.11 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.10 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.9 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.8 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.7 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.6 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.5 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.4 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.3 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.2 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.1 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.0.alpha.32 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.0.alpha.31 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.0.alpha.30 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.0.alpha.29 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.0.alpha.28 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.0.alpha.27 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.0.alpha.26 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.0.alpha.25 spec/controllers/registration_controller_spec.rb
iugusdk-1.0.0.alpha.24 spec/controllers/registration_controller_spec.rb