bcms_bitly 0.0.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,17 +2,37 @@ require 'test_helper'
2
2
 
3
3
  module BcmsBitly
4
4
  class ShortLinkTest < ActiveSupport::TestCase
5
- test "shorten returns a short URL from bitly" do
6
- ShortLink.new.shorten('http://google.com')
5
+ test 'shorten returns a short URL from bitly' do
6
+ ShortLink.new.shorten 'http://google.com'
7
7
  end
8
8
 
9
- test "a created page causes a ShortLink to be created" do
9
+ test 'a created page causes a ShortLink to be created' do
10
10
  assert_difference ['Cms::Page.count', 'BcmsBitly::ShortLink.count'] do
11
- @page = Cms::Page.create(name: 'Test', path: 'test')
11
+ @page = Cms::Page.create name: 'Test', path: '/test'
12
12
  end
13
13
 
14
14
  assert_present @page.short_link
15
15
  assert_equal @page.name, @page.short_link.name
16
16
  end
17
+
18
+ test 'an existing page updates its ShortLink when the path is changed' do
19
+ page = Cms::Page.create name: 'Test', path: '/test'
20
+ old_url = page.short_link.url
21
+ page.update_attribute :path, '/test2'
22
+ page.publish!
23
+ page.reload
24
+
25
+ assert page.short_link.url != old_url
26
+ end
27
+
28
+ test 'ShortLink is not updated when page is saved but path is unchanged' do
29
+ page = Cms::Page.create name: 'Test', path: '/test'
30
+ old_url = page.short_link.url
31
+ page.update_attribute :name, 'Test2'
32
+ page.publish!
33
+ page.reload
34
+
35
+ assert_equal page.short_link.url, old_url
36
+ end
17
37
  end
18
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcms_bitly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-11 00:00:00.000000000 Z
12
+ date: 2012-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: browsercms
@@ -90,7 +90,7 @@ files:
90
90
  - lib/tasks/bcms_bitly_tasks.rake
91
91
  - LICENSE.txt
92
92
  - Rakefile
93
- - README.rdoc
93
+ - README.markdown
94
94
  - test/bcms_bitly_test.rb
95
95
  - test/dummy/app/assets/javascripts/application.js
96
96
  - test/dummy/app/assets/stylesheets/application.css
@@ -633,7 +633,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
633
633
  version: '0'
634
634
  segments:
635
635
  - 0
636
- hash: -4317724634327633707
636
+ hash: -4006397081177284161
637
637
  required_rubygems_version: !ruby/object:Gem::Requirement
638
638
  none: false
639
639
  requirements:
@@ -642,7 +642,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
642
642
  version: '0'
643
643
  segments:
644
644
  - 0
645
- hash: -4317724634327633707
645
+ hash: -4006397081177284161
646
646
  requirements: []
647
647
  rubyforge_project:
648
648
  rubygems_version: 1.8.24