about summary refs log tree commit diff
path: root/spec/models/concerns
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-10-10 17:26:08 +0200
committerThibaut Girka <thib@sitedethib.com>2019-10-10 17:26:08 +0200
commit61631f475163c5640a78ff66f0ac6c053cda2f84 (patch)
tree78920c924924b76872d420c27a8c62fb1b7f6bb7 /spec/models/concerns
parentbc0399d54dde2ad058a8382fc3edbe5506a92985 (diff)
parenta57ac0723f5918b12838da8373d51706cb461a4e (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- README.md
- app/javascript/styles/mastodon/components.scss
  conflicts caused by image URLs being different
- app/models/status.rb
  as_home_timeline removed, kept glitch-soc-only as_direct_timeline
- app/views/statuses/_simple_status.html.haml
- config/locales/en.yml
  some strings were changed upstream
- spec/models/status_spec.rb
  as_home_timeline removed, kept glitch-soc-only as_direct_timeline
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/remotable_spec.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/models/concerns/remotable_spec.rb b/spec/models/concerns/remotable_spec.rb
index a4289cc45..99a60cbf6 100644
--- a/spec/models/concerns/remotable_spec.rb
+++ b/spec/models/concerns/remotable_spec.rb
@@ -18,6 +18,8 @@ RSpec.describe Remotable do
 
     def hoge=(arg); end
 
+    def hoge_file_name; end
+
     def hoge_file_name=(arg); end
 
     def has_attribute?(arg); end
@@ -109,12 +111,21 @@ RSpec.describe Remotable do
       end
 
       context 'foo[attribute_name] == url' do
-        it 'makes no request' do
+        it 'makes no request if file is saved' do
           allow(foo).to receive(:[]).with(attribute_name).and_return(url)
+          allow(foo).to receive(:hoge_file_name).and_return('foo.jpg')
 
           foo.hoge_remote_url = url
           expect(request).not_to have_been_requested
         end
+
+        it 'makes request if file is not saved' do
+          allow(foo).to receive(:[]).with(attribute_name).and_return(url)
+          allow(foo).to receive(:hoge_file_name).and_return(nil)
+
+          foo.hoge_remote_url = url
+          expect(request).to have_been_requested
+        end
       end
 
       context "scheme is https, parsed_url.host isn't empty, and foo[attribute_name] != url" do