Sha256: 266d3c2920f660b3e4746e33d0e527fa4475a853df37955b24bd2ba035ffc1a3

Contents?: true

Size: 882 Bytes

Versions: 15

Compression:

Stored size: 882 Bytes

Contents

require 'test_helper'

class EastTestContext
  extend Surrounded::Context
  east_oriented_triggers
  
  initialize :user, :other_user
  
  trigger :ask? do
    "asking a question..."
  end
end

describe Surrounded::Context, '.east_oriented_triggers' do
  let(:user){ User.new("Jim") }
  let(:other_user){ User.new("Guille") }
  let(:context){ EastTestContext.new(user, other_user) }

  it 'returns the context object from trigger methods' do
    assert_equal context, context.ask?
  end
end

describe Surrounded::Context, '.east_oriented_triggers with protect_triggers' do
  let(:user){ User.new("Jim") }
  let(:other_user){ User.new("Guille") }
  let(:context){ 
    ctxt = EastTestContext.new(user, other_user)
    ctxt.singleton_class.send(:protect_triggers)
    ctxt
  }

  it 'returns the context object from trigger methods' do
    assert_equal context, context.ask?
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
surrounded-0.9.11 test/east_oriented_triggers_test.rb
surrounded-0.9.10 test/east_oriented_triggers_test.rb
surrounded-0.9.9 test/east_oriented_triggers_test.rb
surrounded-0.9.8 test/east_oriented_triggers_test.rb
surrounded-0.9.7 test/east_oriented_triggers_test.rb
surrounded-0.9.6 test/east_oriented_triggers_test.rb
surrounded-0.9.5 test/east_oriented_triggers_test.rb
surrounded-0.9.4 test/east_oriented_triggers_test.rb
surrounded-0.9.3 test/east_oriented_triggers_test.rb
surrounded-0.9.2 test/east_oriented_triggers_test.rb
surrounded-0.9.1 test/east_oriented_triggers_test.rb
surrounded-0.9.0 test/east_oriented_triggers_test.rb
surrounded-0.8.4 test/east_oriented_triggers_test.rb
surrounded-0.8.3 test/east_oriented_triggers_test.rb
surrounded-0.8.2 test/east_oriented_triggers_test.rb