on_the_spot 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,6 @@
3
3
  // now you can use just write
4
4
  // javascript_include_tag :on_the_spot
5
5
  //
6
- //= require jquery.jeditable.mini.js
6
+ //= require jquery.jeditable.js
7
7
  //= require jquery.jeditable.checkbox.js
8
8
  //= require on_the_spot_code
@@ -1,4 +1,6 @@
1
- $(document).on("ready page:load turbolinks:load", function() {
1
+
2
+ function generalOnTheSpotInitializer() {
3
+ //console.log("Init-on-the-spot ...")
2
4
 
3
5
  $(".on_the_spot_editing").mouseover(function() {
4
6
  $(this).addClass('on_the_spot_over');
@@ -6,9 +8,19 @@ $(document).on("ready page:load turbolinks:load", function() {
6
8
  $(".on_the_spot_editing").mouseout(function() {
7
9
  $(this).removeClass('on_the_spot_over');
8
10
  });
11
+
9
12
  $('.on_the_spot_editing').each(initializeOnTheSpot);
13
+ }
14
+
15
+ if (typeof Turbolinks == "undefined") {
16
+ $(function() {
17
+ generalOnTheSpotInitializer();
18
+ });
19
+ } else {
20
+ $(document).on("turbolinks:load", generalOnTheSpotInitializer )
21
+ }
22
+
10
23
 
11
- });
12
24
 
13
25
  function initializeOnTheSpot(n){
14
26
  var el = $(this),
@@ -81,11 +81,9 @@ module OnTheSpot
81
81
  end
82
82
 
83
83
  def convert_array_to_json(id_value_array, selected_id)
84
- conv_arr = id_value_array.map{|idv| "'#{idv[0]}':'#{escape_javascript(idv[1])}'" }
85
- result = "{ #{conv_arr.join(', ')}"
86
- result += ", 'selected':'#{ selected_id.to_s}'" unless selected_id.nil?
87
- result += "}"
88
- result
84
+ result = id_value_array.to_h
85
+ result['selected'] = selected_id unless selected_id.nil?
86
+ result.to_json
89
87
  end
90
88
 
91
89
  end
@@ -2,18 +2,18 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: on_the_spot 1.1.0 ruby lib
5
+ # stub: on_the_spot 1.1.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "on_the_spot"
9
- s.version = "1.1.0"
8
+ s.name = "on_the_spot".freeze
9
+ s.version = "1.1.2"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Nathan Van der Auwera"]
14
- s.date = "2018-03-18"
15
- s.description = "Unobtrusive in place editing, using jEditable; only works in Rails 3"
16
- s.email = "nathan@dixis.com"
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Nathan Van der Auwera".freeze]
14
+ s.date = "2018-05-25"
15
+ s.description = "Unobtrusive in place editing, using jEditable; only works in Rails 3".freeze
16
+ s.email = "nathan@dixis.com".freeze
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE",
19
19
  "README.markdown"
@@ -24,7 +24,6 @@ Gem::Specification.new do |s|
24
24
  ".rspec",
25
25
  ".travis.yml",
26
26
  "Gemfile",
27
- "Gemfile.lock",
28
27
  "History.md",
29
28
  "LICENSE",
30
29
  "README.markdown",
@@ -32,6 +31,7 @@ Gem::Specification.new do |s|
32
31
  "VERSION",
33
32
  "app/assets/css/on_the_spot.css",
34
33
  "app/assets/javascripts/jquery.jeditable.checkbox.js",
34
+ "app/assets/javascripts/jquery.jeditable.js",
35
35
  "app/assets/javascripts/jquery.jeditable.mini.js",
36
36
  "app/assets/javascripts/on_the_spot.js",
37
37
  "app/assets/javascripts/on_the_spot_code.js",
@@ -82,27 +82,27 @@ Gem::Specification.new do |s|
82
82
  "spec/on_the_spot_spec.rb",
83
83
  "spec/spec_helper.rb"
84
84
  ]
85
- s.homepage = "http://github.com/nathanvda/on_the_spot"
86
- s.licenses = ["MIT"]
87
- s.rubygems_version = "2.4.5"
88
- s.summary = "unobtrusive in place editing"
85
+ s.homepage = "http://github.com/nathanvda/on_the_spot".freeze
86
+ s.licenses = ["MIT".freeze]
87
+ s.rubygems_version = "2.6.14".freeze
88
+ s.summary = "unobtrusive in place editing".freeze
89
89
 
90
90
  if s.respond_to? :specification_version then
91
91
  s.specification_version = 4
92
92
 
93
93
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
94
- s.add_development_dependency(%q<rspec>, [">= 2.6.0"])
95
- s.add_development_dependency(%q<actionpack>, [">= 3.0.0"])
96
- s.add_runtime_dependency(%q<json_pure>, [">= 1.4.6"])
94
+ s.add_development_dependency(%q<rspec>.freeze, [">= 2.6.0"])
95
+ s.add_development_dependency(%q<actionpack>.freeze, [">= 3.0.0"])
96
+ s.add_runtime_dependency(%q<json_pure>.freeze, [">= 1.4.6"])
97
97
  else
98
- s.add_dependency(%q<rspec>, [">= 2.6.0"])
99
- s.add_dependency(%q<actionpack>, [">= 3.0.0"])
100
- s.add_dependency(%q<json_pure>, [">= 1.4.6"])
98
+ s.add_dependency(%q<rspec>.freeze, [">= 2.6.0"])
99
+ s.add_dependency(%q<actionpack>.freeze, [">= 3.0.0"])
100
+ s.add_dependency(%q<json_pure>.freeze, [">= 1.4.6"])
101
101
  end
102
102
  else
103
- s.add_dependency(%q<rspec>, [">= 2.6.0"])
104
- s.add_dependency(%q<actionpack>, [">= 3.0.0"])
105
- s.add_dependency(%q<json_pure>, [">= 1.4.6"])
103
+ s.add_dependency(%q<rspec>.freeze, [">= 2.6.0"])
104
+ s.add_dependency(%q<actionpack>.freeze, [">= 3.0.0"])
105
+ s.add_dependency(%q<json_pure>.freeze, [">= 1.4.6"])
106
106
  end
107
107
  end
108
108
 
@@ -15,18 +15,18 @@ describe OnTheSpot::Generators::InstallGenerator do
15
15
  context "in rails 3.0" do
16
16
  context "with no arguments" do
17
17
  before(:each) do
18
- Rails.stub(:version) { '3.0.8' }
18
+ allow(Rails).to receive(:version) { '3.0.8' }
19
19
  prepare_destination
20
20
  run_generator
21
21
  end
22
22
 
23
23
  it "stubs the version correctly" do
24
- Rails.version[0..2].should == "3.0"
24
+ expect(Rails.version[0..2]).to eq("3.0")
25
25
  end
26
26
 
27
27
  it "stubs the version correctly" do
28
28
  test_version = (Rails.version[0..2].to_f >= 3.1)
29
- test_version.should be_false
29
+ expect(test_version).to eq(false)
30
30
  end
31
31
 
32
32
  ['on_the_spot.js', 'jquery.jeditable.mini.js', 'jquery.jeditable.checkbox.js'].each do |js_file|
@@ -44,7 +44,7 @@ describe OnTheSpot::Generators::InstallGenerator do
44
44
  context "in rails 3.1" do
45
45
  context "with no arguments" do
46
46
  before(:each) do
47
- Rails.stub(:version) { '3.1.0' }
47
+ allow(Rails).to receive(:version) { '3.1.0' }
48
48
  prepare_destination
49
49
  run_generator
50
50
  end
@@ -3,7 +3,7 @@ require 'on_the_spot/on_the_spot_helpers'
3
3
 
4
4
  require 'action_controller'
5
5
 
6
- describe "OnTheSpot" do
6
+ RSpec.describe "OnTheSpot" do
7
7
  describe "Helpers" do
8
8
  before(:each) do
9
9
 
@@ -18,151 +18,151 @@ describe "OnTheSpot" do
18
18
 
19
19
  context "lookup values from array" do
20
20
  it "should find value abc for key 1" do
21
- @tester.lookup_display_value(@test_array_nr, 1).should == 'abc'
21
+ expect(@tester.lookup_display_value(@test_array_nr, 1)).to eq('abc')
22
22
  end
23
23
 
24
24
  it "should find value <value2> for key key2" do
25
- @tester.lookup_display_value(@test_array_str, 'key2').should == 'value2'
25
+ expect(@tester.lookup_display_value(@test_array_str, 'key2')).to eq('value2')
26
26
  end
27
27
 
28
28
  it "should return an empty string if key does not exist" do
29
- @tester.lookup_display_value(@test_array_str, 'key1').should == ''
29
+ expect(@tester.lookup_display_value(@test_array_str, 'key1')).to eq('')
30
30
  end
31
31
 
32
32
  it "can handle single quotes normally" do
33
- @tester.lookup_display_value(@test_array_nr, 4).should == "Freddy's Nightmare"
33
+ expect(@tester.lookup_display_value(@test_array_nr, 4)).to eq("Freddy's Nightmare")
34
34
  end
35
35
 
36
36
  end
37
37
 
38
38
  context "convert array to json" do
39
39
  it "should convert correctly" do
40
- @tester.convert_array_to_json(@test_array_nr, 1).should == "{ '1':'abc', '2':'def', '3':'ghi', '4':'Freddy\\'s Nightmare', 'selected':'1'}"
40
+ expect(@tester.convert_array_to_json(@test_array_nr, 1)).to eq("{\"1\":\"abc\",\"2\":\"def\",\"3\":\"ghi\",\"4\":\"Freddy's Nightmare\",\"selected\":1}")
41
41
  end
42
42
 
43
43
  it "convert an array containing an item with single quotes to valid JSON" do
44
44
  test_array_with_single_quote = [[1, "tree"], [2, "bike"], [3, "John's hat"]]
45
45
  json_str = @tester.convert_array_to_json(test_array_with_single_quote, 1)
46
- json_str.should == "{ '1':'tree', '2':'bike', '3':'John\\'s hat', 'selected':'1'}"
46
+ expect(json_str).to eq("{\"1\":\"tree\",\"2\":\"bike\",\"3\":\"John's hat\",\"selected\":1}")
47
47
  end
48
48
  end
49
49
 
50
50
  context "the helpers" do
51
51
  before(:each) do
52
- @dummy = mock()
53
- @dummy.stub!(:content).and_return('test')
54
- @dummy.stub!(:id).and_return('123')
55
- @tester.should_receive(:t).with('on_the_spot.ok').and_return("ok")
56
- @tester.should_receive(:t).with('on_the_spot.cancel').and_return("cancel")
57
- @tester.should_receive(:t).with('on_the_spot.tooltip').and_return("tooltip")
52
+ @dummy = double()
53
+ allow(@dummy).to receive(:content).and_return('test')
54
+ allow(@dummy).to receive(:id).and_return('123')
55
+ expect(@tester).to receive(:t).with('on_the_spot.ok').and_return("ok")
56
+ expect(@tester).to receive(:t).with('on_the_spot.cancel').and_return("cancel")
57
+ expect(@tester).to receive(:t).with('on_the_spot.tooltip').and_return("tooltip")
58
58
  end
59
59
 
60
60
  context "with standard route" do
61
61
  before(:each) do
62
- @tester.should_receive(:url_for).with({:action => 'update_attribute_on_the_spot'}).and_return('/bla')
62
+ expect(@tester).to receive(:url_for).with({:action => 'update_attribute_on_the_spot'}).and_return('/bla')
63
63
  end
64
64
 
65
65
  it "makes the correct html for an edit-field" do
66
66
  @result = @tester.on_the_spot_edit @dummy, :content
67
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
67
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\">test</span>")
68
68
  end
69
69
 
70
70
  it "makes the correct html for an edit-field with text selected on click" do
71
71
  @result = @tester.on_the_spot_edit @dummy, :content, :selected => true
72
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-ok=\"ok\" data-selected=\"true\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
72
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\" data-selected=\"true\">test</span>")
73
73
  end
74
74
 
75
75
  it "makes the correct html for an edit-field and overrule display-text" do
76
76
  @result = @tester.on_the_spot_edit @dummy, :content, :display_text => 'jediknight'
77
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">jediknight</span>"
77
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\">jediknight</span>")
78
78
  end
79
79
 
80
80
  it "makes the correct html for an edit-field and use the display-method as string" do
81
- @dummy.should_receive(:changed_content).and_return("test-changed")
82
- @tester.should_receive(:url_for).with({:action => 'get_attribute_on_the_spot'}).and_return('/bla-again')
81
+ expect(@dummy).to receive(:changed_content).and_return("test-changed")
82
+ expect(@tester).to receive(:url_for).with({:action => 'get_attribute_on_the_spot'}).and_return('/bla-again')
83
83
 
84
84
  @result = @tester.on_the_spot_edit @dummy, :content, :display_method => 'changed_content'
85
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-display-method=\"changed_content\" data-loadurl=\"/bla-again\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test-changed</span>"
85
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\" data-display-method=\"changed_content\" data-loadurl=\"/bla-again\">test-changed</span>")
86
86
  end
87
87
 
88
88
  it "makes the correct html for an edit-field and use the display-method (as symbol)" do
89
- @dummy.should_receive(:changed_content).and_return("test-changed")
90
- @tester.should_receive(:url_for).with({:action => 'get_attribute_on_the_spot'}).and_return('/bla-again')
89
+ allow(@dummy).to receive(:changed_content).and_return("test-changed")
90
+ allow(@tester).to receive(:url_for).with({:action => 'get_attribute_on_the_spot'}).and_return('/bla-again')
91
91
 
92
92
  @result = @tester.on_the_spot_edit @dummy, :content, :display_method => :changed_content
93
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-display-method=\"changed_content\" data-loadurl=\"/bla-again\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test-changed</span>"
93
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\" data-display-method=\"changed_content\" data-loadurl=\"/bla-again\">test-changed</span>")
94
94
  end
95
95
 
96
96
 
97
97
  it "makes the correct html for a text-area" do
98
98
  @result = @tester.on_the_spot_edit @dummy, :content, :type => :textarea
99
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-columns=\"40\" data-edittype=\"textarea\" data-ok=\"ok\" data-rows=\"5\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
99
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-edittype=\"textarea\" data-rows=\"5\" data-columns=\"40\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\">test</span>")
100
100
  end
101
101
 
102
102
  it "makes the correct html for a text-area with text selected on click" do
103
103
  @result = @tester.on_the_spot_edit @dummy, :content, :type => :textarea, :selected => true
104
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-columns=\"40\" data-edittype=\"textarea\" data-ok=\"ok\" data-rows=\"5\" data-selected=\"true\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
104
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-edittype=\"textarea\" data-rows=\"5\" data-columns=\"40\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\" data-selected=\"true\">test</span>")
105
105
  end
106
106
 
107
107
  it "makes the correct html for a select-box" do
108
108
  @result = @tester.on_the_spot_edit @dummy, :content, :type => :select, :data => [['test', 'This a test'], ['prod', 'Pure Production'], ['QA', 'Quality Assurance']]
109
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-edittype=\"select\" data-ok=\"ok\" data-select=\"{ 'test':'This a test', 'prod':'Pure Production', 'QA':'Quality Assurance', 'selected':'test'}\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">This a test</span>"
109
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-edittype=\"select\" data-select=\"{&quot;test&quot;:&quot;This a test&quot;,&quot;prod&quot;:&quot;Pure Production&quot;,&quot;QA&quot;:&quot;Quality Assurance&quot;,&quot;selected&quot;:&quot;test&quot;}\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\">This a test</span>")
110
110
  end
111
111
 
112
112
  it "makes the correct html for a checkbox" do
113
- @dummy.stub!(:content).and_return(true)
113
+ expect(@dummy).to receive(:content).and_return(true)
114
114
  @result = @tester.on_the_spot_edit @dummy, :content, :type => :checkbox
115
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-edittype=\"checkbox\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">true</span>"
115
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-edittype=\"checkbox\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\">true</span>")
116
116
  end
117
117
 
118
118
  it "makes the correct html for an edit-field with a callback" do
119
119
  @result = @tester.on_the_spot_edit @dummy, :content, :callback => 'testCallback(value, settings);'
120
- @result.should == "<span class=\"on_the_spot_editing\" data-callback=\"testCallback(value, settings);\" data-cancel=\"cancel\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
120
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\" data-callback=\"testCallback(value, settings);\">test</span>")
121
121
  end
122
122
 
123
123
  it "makes the correct html for an edit-field with an onblur action" do
124
124
  @result = @tester.on_the_spot_edit @dummy, :content, :onblur => 'submit'
125
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-ok=\"ok\" data-onblur=\"submit\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
125
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\" data-onblur=\"submit\">test</span>")
126
126
  end
127
127
 
128
128
  it "makes the correct html for an edit-field with a loadurl" do
129
129
  @result = @tester.on_the_spot_edit @dummy, :content, :loadurl => '/load/data'
130
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-loadurl=\"/load/data\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
130
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\" data-loadurl=\"/load/data\">test</span>")
131
131
  end
132
132
 
133
133
  context "a select-box with a loadurl" do
134
134
  it "makea the correct html (and not look up the value)" do
135
135
  @result = @tester.on_the_spot_edit @dummy, :content, :type => :select, :loadurl => '/load/data'
136
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-edittype=\"select\" data-loadurl=\"/load/data\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
136
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-edittype=\"select\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\" data-loadurl=\"/load/data\">test</span>")
137
137
  end
138
138
 
139
139
  it "use the display-text preferrably" do
140
140
  @result = @tester.on_the_spot_edit @dummy, :content, :type => :select, :loadurl => '/load/data', :display_text => 'ninja'
141
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-edittype=\"select\" data-loadurl=\"/load/data\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">ninja</span>"
141
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-edittype=\"select\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\" data-loadurl=\"/load/data\">ninja</span>")
142
142
  end
143
143
  end
144
144
  end
145
145
 
146
146
  context "with explicit route" do
147
147
  before(:each) do
148
- @tester.should_receive(:url_for).with({:action => 'update_it_otherwise'}).and_return('/bla')
148
+ allow(@tester).to receive(:url_for).with({:action => 'update_it_otherwise'}).and_return('/bla')
149
149
  end
150
150
 
151
151
  it "make the correct html for an edit-field" do
152
152
  @result = @tester.on_the_spot_edit @dummy, :content, :url => {:action => 'update_it_otherwise' }
153
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
153
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\">test</span>")
154
154
  end
155
155
  end
156
156
 
157
157
  context "with raw parameter" do
158
158
  before(:each) do
159
- @tester.should_receive(:url_for).with({:action => 'update_attribute_on_the_spot', :raw => true}).and_return('/bla?raw=true')
159
+ allow(@tester).to receive(:url_for).with({:action => 'update_attribute_on_the_spot', :raw => true}).and_return('/bla?raw=true')
160
160
  end
161
161
 
162
162
  it "supports raw html" do
163
- @dummy.stub!(:content).and_return('<b>test</b>')
163
+ allow(@dummy).to receive(:content).and_return('<b>test</b>')
164
164
  @result = @tester.on_the_spot_edit @dummy, :content, :raw => true
165
- @result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla?raw=true\" id=\"r_spec/mocks/mock__content__123\"><b>test</b></span>"
165
+ expect(@result).to eq("<span id=\"r_spec/mocks/double__content__123\" class=\"on_the_spot_editing\" data-url=\"/bla?raw=true\" data-ok=\"ok\" data-cancel=\"cancel\" data-tooltip=\"tooltip\"><b>test</b></span>")
166
166
  end
167
167
  end
168
168
  end
@@ -1,13 +1,13 @@
1
1
  # Configure Rails Envinronment
2
2
  ENV["RAILS_ENV"] = "test"
3
+ if ENV["COVERAGE"]
4
+ require 'simplecov'
5
+ SimpleCov.start 'rails'
6
+ end
3
7
 
4
8
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
- require "rails/test_help"
6
9
  require "rspec/rails"
7
10
  require "rspec/mocks"
8
- require 'simplecov'
9
-
10
- SimpleCov.start 'rails'
11
11
 
12
12
  ActionMailer::Base.delivery_method = :test
13
13
  ActionMailer::Base.perform_deliveries = true
@@ -34,7 +34,5 @@ RSpec.configure do |config|
34
34
 
35
35
  # == Mock Framework
36
36
  config.mock_with :rspec
37
-
38
- config.color_enabled = true
39
37
  end
40
38
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: on_the_spot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Van der Auwera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-18 00:00:00.000000000 Z
11
+ date: 2018-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -65,7 +65,6 @@ files:
65
65
  - ".rspec"
66
66
  - ".travis.yml"
67
67
  - Gemfile
68
- - Gemfile.lock
69
68
  - History.md
70
69
  - LICENSE
71
70
  - README.markdown
@@ -73,6 +72,7 @@ files:
73
72
  - VERSION
74
73
  - app/assets/css/on_the_spot.css
75
74
  - app/assets/javascripts/jquery.jeditable.checkbox.js
75
+ - app/assets/javascripts/jquery.jeditable.js
76
76
  - app/assets/javascripts/jquery.jeditable.mini.js
77
77
  - app/assets/javascripts/on_the_spot.js
78
78
  - app/assets/javascripts/on_the_spot_code.js
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  requirements: []
144
144
  rubyforge_project:
145
- rubygems_version: 2.4.5
145
+ rubygems_version: 2.6.14
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: unobtrusive in place editing
@@ -1,176 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- abstract (1.0.0)
5
- actionmailer (3.0.9)
6
- actionpack (= 3.0.9)
7
- mail (~> 2.2.19)
8
- actionpack (3.0.9)
9
- activemodel (= 3.0.9)
10
- activesupport (= 3.0.9)
11
- builder (~> 2.1.2)
12
- erubis (~> 2.6.6)
13
- i18n (~> 0.5.0)
14
- rack (~> 1.2.1)
15
- rack-mount (~> 0.6.14)
16
- rack-test (~> 0.5.7)
17
- tzinfo (~> 0.3.23)
18
- activemodel (3.0.9)
19
- activesupport (= 3.0.9)
20
- builder (~> 2.1.2)
21
- i18n (~> 0.5.0)
22
- activerecord (3.0.9)
23
- activemodel (= 3.0.9)
24
- activesupport (= 3.0.9)
25
- arel (~> 2.0.10)
26
- tzinfo (~> 0.3.23)
27
- activeresource (3.0.9)
28
- activemodel (= 3.0.9)
29
- activesupport (= 3.0.9)
30
- activesupport (3.0.9)
31
- addressable (2.3.5)
32
- arel (2.0.10)
33
- builder (2.1.2)
34
- capybara (2.5.0)
35
- mime-types (>= 1.16)
36
- nokogiri (>= 1.3.3)
37
- rack (>= 1.0.0)
38
- rack-test (>= 0.5.4)
39
- xpath (~> 2.0)
40
- diff-lcs (1.1.2)
41
- erubis (2.6.6)
42
- abstract (>= 1.0.0)
43
- faraday (0.8.8)
44
- multipart-post (~> 1.2.0)
45
- generator_spec (0.8.3)
46
- rails (~> 3.0)
47
- rspec-rails
48
- git (1.2.6)
49
- github_api (0.10.1)
50
- addressable
51
- faraday (~> 0.8.1)
52
- hashie (>= 1.2)
53
- multi_json (~> 1.4)
54
- nokogiri (~> 1.5.2)
55
- oauth2
56
- hashie (2.0.5)
57
- highline (1.6.20)
58
- httpauth (0.2.0)
59
- i18n (0.5.0)
60
- jeweler (1.8.8)
61
- builder
62
- bundler (~> 1.0)
63
- git (>= 1.2.5)
64
- github_api (= 0.10.1)
65
- highline (>= 1.6.15)
66
- nokogiri (= 1.5.10)
67
- rake
68
- rdoc
69
- json (1.8.3)
70
- json_pure (1.5.3)
71
- jwt (0.1.8)
72
- multi_json (>= 1.5)
73
- mail (2.2.19)
74
- activesupport (>= 2.3.6)
75
- i18n (>= 0.4.0)
76
- mime-types (~> 1.16)
77
- treetop (~> 1.4.8)
78
- mime-types (1.16)
79
- multi_json (1.8.2)
80
- multi_xml (0.5.5)
81
- multipart-post (1.2.0)
82
- nokogiri (1.5.10)
83
- oauth2 (0.9.2)
84
- faraday (~> 0.8)
85
- httpauth (~> 0.2)
86
- jwt (~> 0.1.4)
87
- multi_json (~> 1.0)
88
- multi_xml (~> 0.5)
89
- rack (~> 1.2)
90
- polyglot (0.3.1)
91
- power_assert (0.2.4)
92
- rack (1.2.3)
93
- rack-mount (0.6.14)
94
- rack (>= 1.0.0)
95
- rack-test (0.5.7)
96
- rack (>= 1.0)
97
- rails (3.0.9)
98
- actionmailer (= 3.0.9)
99
- actionpack (= 3.0.9)
100
- activerecord (= 3.0.9)
101
- activeresource (= 3.0.9)
102
- activesupport (= 3.0.9)
103
- bundler (~> 1.0)
104
- railties (= 3.0.9)
105
- railties (3.0.9)
106
- actionpack (= 3.0.9)
107
- activesupport (= 3.0.9)
108
- rake (>= 0.8.7)
109
- rdoc (~> 3.4)
110
- thor (~> 0.14.4)
111
- rake (10.4.2)
112
- rdoc (3.8)
113
- rr (1.1.2)
114
- rspec (2.6.0)
115
- rspec-core (~> 2.6.0)
116
- rspec-expectations (~> 2.6.0)
117
- rspec-mocks (~> 2.6.0)
118
- rspec-core (2.6.4)
119
- rspec-expectations (2.6.0)
120
- diff-lcs (~> 1.1.2)
121
- rspec-mocks (2.6.0)
122
- rspec-rails (2.6.1)
123
- actionpack (~> 3.0)
124
- activesupport (~> 3.0)
125
- railties (~> 3.0)
126
- rspec (~> 2.6.0)
127
- simplecov (0.4.2)
128
- simplecov-html (~> 0.4.4)
129
- simplecov-html (0.4.5)
130
- sqlite3 (1.3.3)
131
- sqlite3-ruby (1.3.3)
132
- sqlite3 (>= 1.3.3)
133
- test-unit (3.1.3)
134
- power_assert
135
- test-unit-activesupport (1.0.4)
136
- activesupport
137
- test-unit
138
- test-unit-capybara (1.0.4)
139
- capybara (>= 2.1.0)
140
- json
141
- test-unit (>= 2.5.3)
142
- test-unit-notify (1.0.4)
143
- test-unit (>= 2.4.9)
144
- test-unit-rails (1.0.4)
145
- rails
146
- test-unit-activesupport (>= 1.0.2)
147
- test-unit-capybara
148
- test-unit-notify
149
- test-unit-rr
150
- test-unit-rr (1.0.3)
151
- rr (>= 1.1.1)
152
- test-unit (>= 2.5.2)
153
- thor (0.14.6)
154
- treetop (1.4.9)
155
- polyglot (>= 0.3.1)
156
- tzinfo (0.3.29)
157
- xpath (2.0.0)
158
- nokogiri (~> 1.3)
159
-
160
- PLATFORMS
161
- ruby
162
-
163
- DEPENDENCIES
164
- generator_spec
165
- jeweler
166
- json_pure
167
- rails (>= 3.0.9)
168
- rake
169
- rspec (>= 2.6.0)
170
- rspec-rails
171
- simplecov
172
- sqlite3-ruby
173
- test-unit-rails
174
-
175
- BUNDLED WITH
176
- 1.10.6