Class: Neo::Rails::Mock::MockConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/neo/rails/mock.rb

Instance Method Summary collapse

Constructor Details

#initialize(tags, options = {}) ⇒ MockConfig

Returns a new instance of MockConfig.



58
59
60
61
# File 'lib/neo/rails/mock.rb', line 58

def initialize(tags, options={})
  @tags     = Set.new(tags)
  @options  = options
end

Instance Method Details

#descriptionObject

Returns a human readable tag list.



64
65
66
# File 'lib/neo/rails/mock.rb', line 64

def description
  @tags.map { |tag| tag.to_s.capitalize }.join(", ")
end

#option(name) ⇒ Object



87
88
89
# File 'lib/neo/rails/mock.rb', line 87

def option(name)
  @options[name]
end

#tag(*tags) ⇒ Object

Tag mock with tags.



73
74
75
# File 'lib/neo/rails/mock.rb', line 73

def tag(*tags)
  tags.each { |tag| @tags << tag }
end

#tagged?(tag) ⇒ Boolean

Checks if this mock is tagged with tag.

Returns:

  • (Boolean)


83
84
85
# File 'lib/neo/rails/mock.rb', line 83

def tagged?(tag)
  @tags.include?(tag)
end

#tagsObject



68
69
70
# File 'lib/neo/rails/mock.rb', line 68

def tags
  @tags.to_a
end

#untag(*tags) ⇒ Object

Untag mock.



78
79
80
# File 'lib/neo/rails/mock.rb', line 78

def untag(*tags)
  tags.each { |tag| @tags.delete(tag) }
end