Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@NealJMD
Created August 28, 2015 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NealJMD/99f04b3225085a4fbf0a to your computer and use it in GitHub Desktop.
Save NealJMD/99f04b3225085a4fbf0a to your computer and use it in GitHub Desktop.
Button spec
ShareProgress::Button
instance methods
should respond to #page_url
should respond to #page_url=
should respond to #button_template
should respond to #button_template=
should respond to #page_title
should respond to #page_title=
should respond to #share_button_html
should respond to #share_button_html=
should respond to #is_active
should respond to #is_active=
should respond to #variants
should respond to #variants=
should respond to #advanced_options
should respond to #advanced_options=
should respond to #id
should respond to #id=
should respond to #errors
should not respond to #errors=
should respond to #update_attributes
should respond to #save
update_attributes
with string keys
can update id
cannot read fake keys
can update all base attributes
to strings
to nil
with symbol keys
can update id
cannot read fake keys
can update all base attributes
to strings
to nil
with variants
updates existing Variants when given a list of hashes
save
making requests
requests the update action with full parameters
receiving data
returns true on a successful save
returns false on an unsuccessful save
gets rid of existing errors after successful save
updates auto-populated fields on successful save
destroy
making requests
posts to the delete action with an id
receiving data
should return the button instance when it is successfully deleted
should return false when delete is called and it was already deleted
class methods
should respond to #all
should respond to #find
should respond to #destroy
should respond to #create
should respond to #update
should not respond to #endpoint
should not respond to #filter_keys
should not respond to #optional_keys
should not respond to #advanced_options_keys
all
raises an error when passed a wrong param
making requests
requests the index action
requests the index action with limit and offset params
receiving data
receives an array of Button instances with ids
find
making requests
requests the read action with an id
raises an error without an id
receiving data
returns an instance of button
finds a button with the correct id
populates all the basic fields
raises an ArgumentError when there is no button with that id
create
making requests
requests the update action with base parameters
requests the update action with many parameters
raises an argument error with only one argument
raises an argument error with zero arguments
receiving data
after submitting good params
returns an instance of button
returns a button with the supplied params and an id
has empty errors
after submitting bad params
returns an instance of button
has appropriate errors
destroy
making requests
posts to the delete action with an id
raises an error without an id
receiving data
returns false deleting a button that doesn't exist
returns true deleting a button that does exist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment