Sha256: 8c6f1fcd02be0bce0aff19cacc53b7ca1ea468b269bd16badbea7afe55536633

Contents?: true

Size: 972 Bytes

Versions: 19

Compression:

Stored size: 972 Bytes

Contents

require 'spec_helper'

describe "RamenRails::Config" do

  before :each do
    @user = Hashie::Mash.new(name: 'Ryan', email: 'ryan@ramen.is', id: '1234')
    @organization_id = rand(1_000_000)
    @organization_secret = rand(1_000_000)
  end

  it "should set things" do
    RamenRails.config do |config|
      config.organization_id = @organization_id
      config.organization_secret = @organization_secret
      config.current_user = Proc.new { @user }
    end

    expect(instance_eval(&RamenRails.config.current_user).id).to eq('1234')
    
    expect(RamenRails.config.current_user.call.id).to eq('1234')
    expect(RamenRails.config.organization_id).to eq(@organization_id)
    expect(RamenRails.config.organization_secret).to eq(@organization_secret)
  end

  it "should error if passed a lambda" do
    expect do
      RamenRails.config do |c|
        c.current_user = -> { @user }
      end
    end.to raise_error(RamenRails::Config::NoLambdasPlease)
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ramen-rails-0.7.2 spec/lib/config_spec.rb
ramen-rails-0.7.1 spec/lib/config_spec.rb
ramen-rails-0.6.4 spec/lib/config_spec.rb
ramen-rails-0.6.3 spec/lib/config_spec.rb
ramen-rails-0.6.2 spec/lib/config_spec.rb
ramen-rails-0.6.1 spec/lib/config_spec.rb
ramen-rails-0.6.0 spec/lib/config_spec.rb
ramen-rails-0.5.1 spec/lib/config_spec.rb
ramen-rails-0.5.0 spec/lib/config_spec.rb
ramen-rails-0.4.0 spec/lib/config_spec.rb
ramen-rails-0.3.1 spec/lib/config_spec.rb
ramen-rails-0.3.0 spec/lib/config_spec.rb
ramen-rails-0.2.0 spec/lib/config_spec.rb
ramen-rails-0.1.3 spec/lib/config_spec.rb
ramen-rails-0.1.2 spec/lib/config_spec.rb
ramen-rails-0.1.1 spec/lib/config_spec.rb
ramen-rails-0.1.0 spec/lib/config_spec.rb
ramen-rails-0.0.9 spec/lib/config_spec.rb
ramen-rails-0.0.8 spec/lib/config_spec.rb