-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fix failing test for creation of JPEG2000 derivatives. #142
Changes from 4 commits
f9c61e4
2945c07
4570561
af2af77
c196e6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ pkg/ | |
.ruby-gemset | ||
fcrepo4-data/ | ||
fcrepo4-test-data/ | ||
coverage/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
|
||
describe Hydra::Derivatives::Processors::Jpeg2kImage do | ||
let(:object) { ActiveFedora::Base.new } | ||
let(:filename) { File.expand_path('../../fixtures/test.tif', __FILE__) } | ||
let(:image) { MiniMagick::Image.open(filename) } | ||
|
||
describe "#calculate_recipe" do | ||
it "calculates the number of levels from a size" do | ||
|
@@ -54,4 +56,25 @@ | |
expect(r).to eq(described_class.calculate_recipe(args, 'grey', 7200)) | ||
end | ||
end | ||
|
||
describe "#encode" do | ||
it "executes the external utility" do | ||
expect(described_class).to receive(:execute) { 0 } | ||
described_class.encode('infile', 'recipe', 'outfile') | ||
# expect(Hydra::Derivatives::Processors::ShellBasedProcessor).to have_received(:execute) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove the commented out code. It looks like this is tested in the above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, missed it in the rush for lunch. |
||
end | ||
end | ||
|
||
describe "#tmp_file" do | ||
it "returns a temp file with the correct extension" do | ||
f = described_class.tmp_file('test') | ||
expect(f).to match(/sufia.*test$/) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cjcolvar You had made mention of being concerned about the "sufia" assumption in file names. Could you take a look here? I'm wondering if it would be okay to ignore the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That conversation was based on #99 . I agree that it seems possible to remove the sufia from the regex and maybe change this to an ends_with? ".test". |
||
end | ||
end | ||
|
||
describe "long_dim" do | ||
it "returns the image's largest dimension" do | ||
expect(described_class.long_dim(image)).to eq(386) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing that the following methods are now becoming public. What was your reason for removing the
protected
declaration?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The failing spec that he fixed had this error:
"protected" for class methods apparently doesn't behave in the way you might expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @val99erie for the clarification; Always hesitant to
public
-ize new methods, but this sounds like a necessary reason to open the public facing methods.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an older explanation of why it won't work to have a protected class method and then try to call it from within an instance method. The only receiver that is allowed is
self
;self.class
won't work.http://stackoverflow.com/questions/11461262/what-is-the-value-of-self-in-a-rails-model-and-why-arent-obvious-instance-metho/11461333#11461333
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the follow-up. I missed the context that these were class methods as well. I'm all for this change.