Sha256: fa737d504d9a2e4aeae9829ac8b8fdc061218adccf0299d9b3ff388ccb2a0435

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe "RamenRails::Import" 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)

    RamenRails.config do |config|
      config.organization_id = @organization_id
      config.organization_secret = @organization_secret
      config.current_user = Proc.new { @user }
    end
  
    @importer = RamenRails::Import.new
    @importer.user = @user
  end

  it "should have user info in hash" do
    expect(@importer.generate_hash[:user][:email]).
      to eq('ryan@ramen.is')
  end

  it "should not have company data" do
    expect(@importer.generate_hash[:company]).to be_nil
  end

  it "should set :import true" do
    expect(@importer.generate_hash[:import]).to eq(true)
  end

  context "with a company" do
    before :each do
      @company = Hashie::Mash.new({id: 1234, url: 'https://ramen.is', name: 'Fake Rake'})
      @importer.company = @company
    end

    it "should have company data" do
      expect(@importer.generate_hash[:company][:id]).
        to eq("1234")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ramen-rails-0.7.2 spec/lib/import_spec.rb
ramen-rails-0.7.1 spec/lib/import_spec.rb
ramen-rails-0.6.4 spec/lib/import_spec.rb
ramen-rails-0.6.3 spec/lib/import_spec.rb
ramen-rails-0.6.2 spec/lib/import_spec.rb
ramen-rails-0.6.1 spec/lib/import_spec.rb
ramen-rails-0.6.0 spec/lib/import_spec.rb
ramen-rails-0.5.1 spec/lib/import_spec.rb