Sha256: 27afcbb2f7452761383766f55a78f72a38bb9f4ab20b9cae5977b348f853a37f

Contents?: true

Size: 510 Bytes

Versions: 1

Compression:

Stored size: 510 Bytes

Contents

require 'test_helper'

class ShortcutContext
  extend Surrounded::Context
  shortcut_triggers
  
  initialize :user, :other
  
  trigger :shorty do
    user.speak
  end
  
  role :user do
    def speak
      'it works, shorty!'
    end
  end
end

describe Surrounded::Context, 'shortcuts' do
  let(:user){ User.new("Jim") }
  let(:other){ User.new("Guille") }
  it 'creates shortcut class methods for triggers' do
    assert_equal 'it works, shorty!', ShortcutContext.shorty(user: user, other: other)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
surrounded-1.0.0 test/context_shortcuts_test.rb