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

bundle_context: project_name alphanum-ish only; output_dir uses project_name instead of bundle_dir #320

Merged
merged 3 commits into from
Sep 20, 2018

Conversation

ndushay
Copy link
Contributor

@ndushay ndushay commented Sep 19, 2018

Per instructions from Ben on Slack, captured in #78 comments, use the project name rather than the bundle dir in the output directory for a bundle context.

Also, per separate slack conversation, also captured in #78 comments, restrict the characters allowed for the project name.

Lastly, fixes broken travis build.

Connects to #78

@ndushay ndushay added the review label Sep 19, 2018
@coveralls
Copy link

coveralls commented Sep 19, 2018

Pull Request Test Coverage Report for Build 988

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 59.812%

Totals Coverage Status
Change from base Build 969: 0.3%
Covered Lines: 573
Relevant Lines: 958

💛 - Coveralls

it { is_expected.to validate_presence_of(:project_name) }
it 'is not valid with chars other than alphanum, hyphen and underscore' do
attr_hash[:project_name] = 's p a c e s'
expect(bc).not_to be_valid
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this interaction is doing what you expect. attr_hash and bc are decoupled after the subject is established. It would read more cleanly (and work) if you just do assignment on the object like:

bc.project_name = 'foo'

Ideally, start from a valid object and

expect { bc.project_name = 'bad value' }.to change(bc, :valid?).to(false)

Copy link
Member

Choose a reason for hiding this comment

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

makes sense, i think...

for my own clarification, does that mean that the first time attr_hash is edited, it does affect bc (i.e. for the expectation this comment is on), and that for subsequent expectations, the changes to attr_hash don't affect bc, because bc got lazily loaded upon the first reference to it? or is bc already set up before this entire test is even entered, because it's declared using subject? or something else?

anyway, i'd agree the suggested usage is more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, @atz. I have added a commit to address my test giving a false positive.

@jmartin-sul jmartin-sul merged commit b053d10 into master Sep 20, 2018
@jmartin-sul jmartin-sul deleted the output-dir-proj-name branch September 20, 2018 01:11
atz added a commit that referenced this pull request Sep 20, 2018
Also use `File.join` to build it.
Update test to match, same as #320 (minor conflict).
atz added a commit that referenced this pull request Sep 20, 2018
Also use `File.join` to build it.
Update test to match, same as #320 (minor conflict).
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.

None yet

4 participants