Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove activesupport dependency #22

Merged

Conversation

srabuini
Copy link
Contributor

What do you think about adding a simple helper and removing more than 11.000 lines of code?

@NullVoxPopuli
Copy link
Owner

that sounds great!!!!

@NullVoxPopuli
Copy link
Owner

can you add tests for the present method for things like '', [], {}, 'not empty', [0], 0, etc?

@srabuini srabuini force-pushed the remove_activesupport_dependency branch from a757756 to 9874f17 Compare September 11, 2017 20:35
@srabuini
Copy link
Contributor Author

I've added almost the same blank/non_blank cases that activesupport tests.

Have a look, please, and let me know.

Thanks!

@srabuini srabuini force-pushed the remove_activesupport_dependency branch from 9874f17 to e090764 Compare September 11, 2017 20:42
end

context 'when data is not prsent' do
it 'does not double the data' do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for both of these tests, can you wrap the actual it blocks in a loop with the array of blank/non-blank data?

something like:

context 'when data is not present' do
  command = 'hi'
  identifier = { 'hi': 'there' }
  expected = {
    command: command,
    identifier: identifier.to_json
  }.to_json

  blank_data.each do |blank_datum|
    it "does not set :data if the value would be #{blank_datum.inspect}" do
      # in the data is present test, the expected will need to move in to here, but that's fine.
      # msg = 
      # expect = 
    end
  end
end

this way of organizing the specs allows for super easy at-a-glance debugging in case one of the cases of the loop fails (the test name tells which thing is specifically being tested)

@NullVoxPopuli
Copy link
Owner

looking good! just one more change, I think!

@srabuini srabuini force-pushed the remove_activesupport_dependency branch from e090764 to 49ec3e2 Compare September 11, 2017 21:06
Time.now]

non_blank_data.each do |data|
it "double the identifier and the data if the value would be #{data}" do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should inspect be used here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It produces almost the same output, just a vs "a" but should improve readability, I guess.

@srabuini srabuini force-pushed the remove_activesupport_dependency branch from 49ec3e2 to 9c159ae Compare September 11, 2017 22:23
@NullVoxPopuli
Copy link
Owner

looks good! thanks! I'll release a new version shortly

@NullVoxPopuli NullVoxPopuli merged commit c861e59 into NullVoxPopuli:master Sep 11, 2017
@srabuini srabuini deleted the remove_activesupport_dependency branch September 11, 2017 22:28
@NullVoxPopuli
Copy link
Owner

@srabuini 2.0.1 released. :-)
Apparently I accidentally released 3. oops. that's been yanked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants